summaryrefslogtreecommitdiffstats
path: root/libcxx/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2013-08-13 01:12:41 +0000
committerMarshall Clow <mclow.lists@gmail.com>2013-08-13 01:12:41 +0000
commit75f9aa9993acc7e611cde614fdb71c8c2d5bbdaa (patch)
tree6f36fe5a2f6a2469cd28e92b9ee1ef319d14803d /libcxx/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp
parent25d3402c6a595cdf5555a82de0eee8d8a58df25a (diff)
downloadbcm5719-llvm-75f9aa9993acc7e611cde614fdb71c8c2d5bbdaa.tar.gz
bcm5719-llvm-75f9aa9993acc7e611cde614fdb71c8c2d5bbdaa.zip
More support for N3657; tests for is_transparent
llvm-svn: 188242
Diffstat (limited to 'libcxx/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp')
-rw-r--r--libcxx/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/libcxx/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp b/libcxx/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp
new file mode 100644
index 00000000000..43e2e2120b2
--- /dev/null
+++ b/libcxx/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp
@@ -0,0 +1,52 @@
+#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;
+ }
OpenPOWER on IntegriCloud