-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
type_traits: Separate type traits helpers into a new header file
This commit adds cista/type_traits.h and move is_char_array_helper and is_string_helper into that new header file.
- Loading branch information
Showing
5 changed files
with
27 additions
and
18 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
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 @@ | ||
#pragma once | ||
|
||
#include <type_traits> | ||
|
||
namespace cista { | ||
|
||
template <typename T, typename = void> | ||
struct is_char_array_helper : std::false_type {}; | ||
|
||
template <std::size_t N> | ||
struct is_char_array_helper<char const[N]> : std::true_type {}; | ||
|
||
template <std::size_t N> | ||
struct is_char_array_helper<char[N]> : std::true_type {}; | ||
|
||
template <typename T> | ||
constexpr bool is_char_array_v = is_char_array_helper<T>::value; | ||
|
||
template <typename Ptr> | ||
struct is_string_helper : std::false_type {}; | ||
|
||
template <class T> | ||
constexpr bool is_string_v = is_string_helper<std::remove_cv_t<T>>::value; | ||
|
||
} // namespace cista |