-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: comparison operators only accept base pointer
- Loading branch information
Showing
3 changed files
with
157 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// Copyright (c) 2024 Yat Ho ([email protected]) | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// https://www.boost.org/LICENSE_1_0.txt | ||
// | ||
|
||
#ifndef SMALL_DETAIL_TRAITS_PTR_TO_CONST_HPP | ||
#define SMALL_DETAIL_TRAITS_PTR_TO_CONST_HPP | ||
|
||
#include <type_traits> | ||
|
||
namespace small { | ||
namespace detail { | ||
/// Convert a pointer to pointer-to-const | ||
template <typename T, typename = std::enable_if_t<std::is_pointer_v<T>>> | ||
using ptr_to_const = std::add_pointer< | ||
std::add_const_t<std::remove_pointer_t<T>>>; | ||
|
||
template <typename T> | ||
using ptr_to_const_t = typename ptr_to_const<T>::type; | ||
} // namespace detail | ||
} // namespace small | ||
|
||
#endif // SMALL_DETAIL_TRAITS_PTR_TO_CONST_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters