7a4e374280
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@188242 91177308-0d34-0410-b5e6-96231b3b80d8
53 lines
2.0 KiB
C++
53 lines
2.0 KiB
C++
#include <functional>
|
|
#include <string>
|
|
|
|
template <class _Tp>
|
|
struct is_transparent
|
|
{
|
|
private:
|
|
struct __two {char __lx; char __lxx;};
|
|
template <class _Up> static __two __test(...);
|
|
template <class _Up> static char __test(typename _Up::is_transparent* = 0);
|
|
public:
|
|
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
|
};
|
|
|
|
|
|
int main () {
|
|
#if _LIBCPP_STD_VER > 11
|
|
|
|
static_assert ( !is_transparent<std::plus<int>>::value, "" );
|
|
static_assert ( !is_transparent<std::plus<std::string>>::value, "" );
|
|
static_assert ( is_transparent<std::plus<void>>::value, "" );
|
|
static_assert ( is_transparent<std::plus<>>::value, "" );
|
|
|
|
static_assert ( !is_transparent<std::minus<int>>::value, "" );
|
|
static_assert ( !is_transparent<std::minus<std::string>>::value, "" );
|
|
static_assert ( is_transparent<std::minus<void>>::value, "" );
|
|
static_assert ( is_transparent<std::minus<>>::value, "" );
|
|
|
|
static_assert ( !is_transparent<std::multiplies<int>>::value, "" );
|
|
static_assert ( !is_transparent<std::multiplies<std::string>>::value, "" );
|
|
static_assert ( is_transparent<std::multiplies<void>>::value, "" );
|
|
static_assert ( is_transparent<std::multiplies<>>::value, "" );
|
|
|
|
static_assert ( !is_transparent<std::divides<int>>::value, "" );
|
|
static_assert ( !is_transparent<std::divides<std::string>>::value, "" );
|
|
static_assert ( is_transparent<std::divides<void>>::value, "" );
|
|
static_assert ( is_transparent<std::divides<>>::value, "" );
|
|
|
|
static_assert ( !is_transparent<std::modulus<int>>::value, "" );
|
|
static_assert ( !is_transparent<std::modulus<std::string>>::value, "" );
|
|
static_assert ( is_transparent<std::modulus<void>>::value, "" );
|
|
static_assert ( is_transparent<std::modulus<>>::value, "" );
|
|
|
|
static_assert ( !is_transparent<std::negate<int>>::value, "" );
|
|
static_assert ( !is_transparent<std::negate<std::string>>::value, "" );
|
|
static_assert ( is_transparent<std::negate<void>>::value, "" );
|
|
static_assert ( is_transparent<std::negate<>>::value, "" );
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
}
|