LibraryLink Utilities  3.0.1
Modern C++ wrapper over LibraryLink and WSTP
UtilityTypeTraits.hpp
Go to the documentation of this file.
1 
7 #ifndef LLU_WSTP_UTILITYTYPETRAITS_HPP_
8 #define LLU_WSTP_UTILITYTYPETRAITS_HPP_
9 
10 #include <type_traits>
11 
12 #include "wstp.h"
13 
14 #include "LLU/Utilities.hpp"
15 
16 namespace LLU::WS {
17 
22  template<typename T>
23  inline constexpr bool supportedInWSArithmeticQ = false;
24 
26  template<>
27  inline constexpr bool supportedInWSArithmeticQ<unsigned char> = true;
28  template<>
29  inline constexpr bool supportedInWSArithmeticQ<short> = true;
30  template<>
31  inline constexpr bool supportedInWSArithmeticQ<int> = true;
32  template<>
33  inline constexpr bool supportedInWSArithmeticQ<wsint64> = true;
34  template<>
35  inline constexpr bool supportedInWSArithmeticQ<float> = true;
36  template<>
37  inline constexpr bool supportedInWSArithmeticQ<double> = true;
39 
41  template<typename T>
42  inline constexpr bool ScalarSupportedTypeQ = supportedInWSArithmeticQ<remove_cv_ref<T>>;
43 
48  template<typename T>
49  inline constexpr bool supportedInWSStringQ = false;
50 
52  template<>
53  inline constexpr bool supportedInWSStringQ<char> = true;
54  template<>
55  inline constexpr bool supportedInWSStringQ<unsigned char> = true;
56  template<>
57  inline constexpr bool supportedInWSStringQ<unsigned short> = true;
58  template<>
59  inline constexpr bool supportedInWSStringQ<unsigned int> = true;
61 
63  template<typename T>
64  inline constexpr bool StringTypeQ = supportedInWSStringQ<remove_cv_ref<T>>;
65 
66 } // namespace LLU::WS
67 
68 #endif /* LLU_WSTP_UTILITYTYPETRAITS_HPP_ */
LLU::WS::ScalarSupportedTypeQ
constexpr bool ScalarSupportedTypeQ
Convenient alias for supportedInWSArithmeticQ<T> that strips T from cv-qualifiers and reference.
Definition: UtilityTypeTraits.hpp:42
LLU::WS::StringTypeQ
constexpr bool StringTypeQ
Convenient alias for supportedInWSStringQ<T> that strips T from cv-qualifiers and reference.
Definition: UtilityTypeTraits.hpp:64
LLU::WS
Contains definitions related to WSTP functionality in LLU.
Definition: EncodingTraits.hpp:15
LLU::WS::supportedInWSStringQ
constexpr bool supportedInWSStringQ
Utility trait that determines whether type T is a suitable character type for WSPut*String and WSGet*...
Definition: UtilityTypeTraits.hpp:49
Utilities.hpp
Short but generally useful functions.
LLU::WS::supportedInWSArithmeticQ
constexpr bool supportedInWSArithmeticQ
Utility trait that determines whether type T is a suitable data type for functions like WSPut*Array,...
Definition: UtilityTypeTraits.hpp:23