mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Fix size trait detection for containers
This commit is contained in:
parent
e3ff28f58d
commit
4c7a8663b5
|
@ -340,6 +340,21 @@ namespace sol {
|
|||
static const bool value = sizeof(test<T>(0)) == sizeof(char);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct has_traits_size_test {
|
||||
private:
|
||||
typedef std::array<char, 1> one;
|
||||
typedef std::array<char, 2> two;
|
||||
|
||||
template <typename C>
|
||||
static one test(decltype(&C::size));
|
||||
template <typename C>
|
||||
static two test(...);
|
||||
|
||||
public:
|
||||
static const bool value = sizeof(test<T>(0)) == sizeof(char);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using has_clear = meta::boolean<has_clear_test<T>::value>;
|
||||
|
||||
|
@ -383,7 +398,7 @@ namespace sol {
|
|||
using has_traits_add = meta::boolean<has_traits_add_test<T>::value>;
|
||||
|
||||
template <typename T>
|
||||
using has_traits_size = meta::has_size<T>;
|
||||
using has_traits_size = meta::boolean<has_traits_size_test<T>::value>;
|
||||
|
||||
template <typename T>
|
||||
using has_traits_clear = has_clear<T>;
|
||||
|
|
Loading…
Reference in New Issue
Block a user