@@ -34,7 +34,7 @@ namespace utl { | |||||
template <typename _T1, typename _T2, typename _Ret =_T1> | template <typename _T1, typename _T2, typename _Ret =_T1> | ||||
using use_if_same_t = meta::eval< | using use_if_same_t = meta::eval< | ||||
meta::enable_if< | meta::enable_if< | ||||
meta::same_<_T1, _T2>::value, _Ret | |||||
meta::same<_T1, _T2>::value, _Ret | |||||
> | > | ||||
>; | >; | ||||
@@ -43,7 +43,7 @@ namespace utl { | |||||
* Same | * Same | ||||
*/ | */ | ||||
template <class T, class U> | template <class T, class U> | ||||
_utlConcept Same = meta::same_<T, U>::value; | |||||
_utlConcept Same = meta::same<T, U>::value; | |||||
// template<class T> | // template<class T> | ||||
// _utlConcept Decayed = Same<T, std::decay_t<T>>; | // _utlConcept Decayed = Same<T, std::decay_t<T>>; | ||||
@@ -398,7 +398,7 @@ namespace utl { | |||||
typename T::difference_type; | typename T::difference_type; | ||||
typename T::pointer; | typename T::pointer; | ||||
typename T::reference; | typename T::reference; | ||||
requires same_< | |||||
requires same< | |||||
typename T::iterator_category, | typename T::iterator_category, | ||||
std::output_iterator_tag | std::output_iterator_tag | ||||
>::value; | >::value; | ||||
@@ -675,7 +675,7 @@ namespace utl { | |||||
typename T::difference_type; | typename T::difference_type; | ||||
typename T::pointer; | typename T::pointer; | ||||
typename T::reference; | typename T::reference; | ||||
requires same_ < | |||||
requires same < | |||||
typename T::iterator_category, | typename T::iterator_category, | ||||
std::input_iterator_tag | std::input_iterator_tag | ||||
>::value; | >::value; | ||||
@@ -960,7 +960,7 @@ namespace utl { | |||||
typename T::difference_type; | typename T::difference_type; | ||||
typename T::pointer; | typename T::pointer; | ||||
typename T::reference; | typename T::reference; | ||||
requires same_< | |||||
requires same< | |||||
typename T::iterator_category, | typename T::iterator_category, | ||||
std::input_iterator_tag | std::input_iterator_tag | ||||
>::value; | >::value; | ||||
@@ -292,13 +292,13 @@ namespace meta{ | |||||
//! \name same | //! \name same | ||||
//! @{ | //! @{ | ||||
template<typename T1, typename T2> | template<typename T1, typename T2> | ||||
struct same_ : false_ { }; | |||||
struct same : false_ { }; | |||||
template<typename Tp> | template<typename Tp> | ||||
struct same_ <Tp, Tp> : true_ { }; | |||||
struct same <Tp, Tp> : true_ { }; | |||||
template<typename T1, typename T2> | template<typename T1, typename T2> | ||||
using not_same_ = not_<eval<same_<T1, T2>>>; | |||||
using not_same = not_<eval<same<T1, T2>>>; | |||||
//! @} | //! @} | ||||
//! @} | //! @} | ||||
@@ -179,7 +179,7 @@ namespace meta { | |||||
template <typename Expected, | template <typename Expected, | ||||
template<typename...> class Op, typename... Args > | template<typename...> class Op, typename... Args > | ||||
using is_detected_exact = eval < | using is_detected_exact = eval < | ||||
same_<Expected, detected_t<Op, Args...>> | |||||
same<Expected, detected_t<Op, Args...>> | |||||
>; | >; | ||||
//! evaluates to true if evaluation of Op<Args...> is \p Expected and to false if not | //! evaluates to true if evaluation of Op<Args...> is \p Expected and to false if not | ||||
@@ -140,7 +140,7 @@ namespace meta{ | |||||
static nil_ check (...); //< all other combinations | static nil_ check (...); //< all other combinations | ||||
using type = if_ < | using type = if_ < | ||||
not_same_< | |||||
not_same< | |||||
nil_, | nil_, | ||||
decltype(check<F>(0)) | decltype(check<F>(0)) | ||||
>, true_, false_ | >, true_, false_ | ||||
@@ -419,13 +419,13 @@ namespace meta{ | |||||
template <typename T1> | template <typename T1> | ||||
struct same_as { | struct same_as { | ||||
template <typename T2> | template <typename T2> | ||||
struct apply : same_<T1, T2> { }; | |||||
struct apply : same<T1, T2> { }; | |||||
}; | }; | ||||
template <typename T1> | template <typename T1> | ||||
struct not_same_as { | struct not_same_as { | ||||
template <typename T2> | template <typename T2> | ||||
struct apply : not_same_<T1, T2> { }; | |||||
struct apply : not_same<T1, T2> { }; | |||||
}; | }; | ||||
}} | }} | ||||
@@ -54,12 +54,12 @@ namespace meta { | |||||
//! If same type resolves to _Ret, else SFINAE | //! If same type resolves to _Ret, else SFINAE | ||||
template <typename _T1, typename _T2, typename _Ret =_T1> | template <typename _T1, typename _T2, typename _Ret =_T1> | ||||
using use_if_same_t = enable_if_t< | using use_if_same_t = enable_if_t< | ||||
same_<_T1, _T2>::value, _Ret | |||||
same<_T1, _T2>::value, _Ret | |||||
>; | >; | ||||
//! If not same type resolves to _Ret, else SFINAE | //! If not same type resolves to _Ret, else SFINAE | ||||
template <typename _T1, typename _T2, typename _Ret =_T1> | template <typename _T1, typename _T2, typename _Ret =_T1> | ||||
using use_if_not_same_t = enable_if_t< | using use_if_not_same_t = enable_if_t< | ||||
!same_<_T1, _T2>::value, _Ret | |||||
!same<_T1, _T2>::value, _Ret | |||||
>; | >; | ||||
//! If any type (_T1 or _T2) type resolves to _Ret, else to SFINAE | //! If any type (_T1 or _T2) type resolves to _Ret, else to SFINAE | ||||
template <typename T1, typename... Ts> | template <typename T1, typename... Ts> | ||||
@@ -705,6 +705,9 @@ namespace meta { | |||||
using seek = seek_if <List, same_as<T>>; | using seek = seek_if <List, same_as<T>>; | ||||
//! @} | //! @} | ||||
template <typename List, typename Pred> | |||||
using first_if = front<seek_if<List, Pred>>; | |||||
//! \name count_if | //! \name count_if | ||||
//! @{ | //! @{ | ||||
namespace count_if_impl { | namespace count_if_impl { | ||||
@@ -140,9 +140,9 @@ namespace TmetaBasic { | |||||
EXPECT_EQ (true, (std::is_same<true_, and_<true_, true_, true_>>())); | EXPECT_EQ (true, (std::is_same<true_, and_<true_, true_, true_>>())); | ||||
EXPECT_EQ (true, (std::is_same<false_, and_<true_, true_, false_>>())); | EXPECT_EQ (true, (std::is_same<false_, and_<true_, true_, false_>>())); | ||||
EXPECT_EQ (true, (same_<Foo, Foo>())); | |||||
EXPECT_EQ (false, (same_<Foo, Bar>())); | |||||
EXPECT_EQ (true, (not_same_<Foo, Bar>())); | |||||
EXPECT_EQ (true, (same<Foo, Foo>())); | |||||
EXPECT_EQ (false, (same<Foo, Bar>())); | |||||
EXPECT_EQ (true, (not_same<Foo, Bar>())); | |||||
} | } | ||||
@@ -218,11 +218,11 @@ namespace TmetaBasic { | |||||
/* | /* | ||||
* SFINAE | * SFINAE | ||||
*/ | */ | ||||
template <typename T, typename =when<same_<T, int>::type::value>> | |||||
template <typename T, typename =when<same<T, int>::type::value>> | |||||
int check1 (T x) { return x; } | int check1 (T x) { return x; } | ||||
int check1 (...) { return 0; } | int check1 (...) { return 0; } | ||||
template <typename T, typename =enable_if_t<same_<T, int>::type::value, void>> | |||||
template <typename T, typename =enable_if_t<same<T, int>::type::value, void>> | |||||
int check2 (T x) { return x; } | int check2 (T x) { return x; } | ||||
int check2 (...) { return 0; } | int check2 (...) { return 0; } | ||||