1
0
forked from boostorg/mp11

Add mp_valid_q

This commit is contained in:
Peter Dimov
2019-02-14 20:15:29 +02:00
parent beb9c2dd59
commit ca7e140827
2 changed files with 13 additions and 0 deletions

View File

@@ -92,6 +92,8 @@ template<template<class...> class F, class... T> using mp_valid = typename detai
#endif
template<class Q, class... T> using mp_valid_q = mp_valid<Q::template fn, T...>;
// mp_defer
namespace detail
{

View File

@@ -34,6 +34,7 @@ using Q_add_pointer = mp_quote<add_pointer>;
int main()
{
using boost::mp11::mp_valid;
using boost::mp11::mp_valid_q;
using boost::mp11::mp_identity;
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_identity>));
@@ -50,6 +51,11 @@ int main()
BOOST_TEST_TRAIT_FALSE((mp_valid<QX::fn, int>));
BOOST_TEST_TRAIT_FALSE((mp_valid<QX::fn, void, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid_q<QX>));
BOOST_TEST_TRAIT_TRUE((mp_valid_q<QX, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid_q<QX, int>));
BOOST_TEST_TRAIT_FALSE((mp_valid_q<QX, void, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<add_pointer>));
BOOST_TEST_TRAIT_TRUE((mp_valid<add_pointer, void>));
BOOST_TEST_TRAIT_TRUE((mp_valid<add_pointer, int>));
@@ -64,6 +70,11 @@ int main()
BOOST_TEST_TRAIT_TRUE((mp_valid<Q_add_pointer::fn, int>));
BOOST_TEST_TRAIT_FALSE((mp_valid<Q_add_pointer::fn, void, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid_q<Q_add_pointer>));
BOOST_TEST_TRAIT_TRUE((mp_valid_q<Q_add_pointer, void>));
BOOST_TEST_TRAIT_TRUE((mp_valid_q<Q_add_pointer, int>));
BOOST_TEST_TRAIT_FALSE((mp_valid_q<Q_add_pointer, void, void>));
#if !BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 70000 )
// g++ up to at least 6.3 doesn't like add_reference for some reason or other
BOOST_TEST_TRAIT_FALSE((mp_valid<add_reference>));