summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/callable_traits/example/args.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/callable_traits/example/args.cpp')
-rw-r--r--src/boost/libs/callable_traits/example/args.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/boost/libs/callable_traits/example/args.cpp b/src/boost/libs/callable_traits/example/args.cpp
new file mode 100644
index 000000000..9e0ef2d9a
--- /dev/null
+++ b/src/boost/libs/callable_traits/example/args.cpp
@@ -0,0 +1,69 @@
+/*<-
+Copyright (c) 2016 Barrett Adair
+
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+->*/
+
+#include <boost/callable_traits/detail/config.hpp>
+#ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
+int main(){ return 0; }
+#else
+
+//[ args
+#include <type_traits>
+#include <memory>
+#include <boost/callable_traits.hpp>
+
+namespace ct = boost::callable_traits;
+
+template<typename T, typename Expect>
+void test(){
+ using args_t = ct::args_t<T>;
+ static_assert(std::is_same<args_t, Expect>::value, "");
+}
+
+int main() {
+
+ {
+ auto lamda = [](int, float&, const char*){};
+ using lam = decltype(lamda);
+ using expect = std::tuple<int, float&, const char*>;
+
+ test<lam, expect>();
+ }
+
+ {
+ struct foo;
+ using pmf = void(foo::*)(int, float&, const char*);
+ using expect = std::tuple<foo&, int, float&, const char*>;
+
+ test<pmf, expect>();
+ }
+
+ {
+ using function_ptr = void(*)(int, float&, const char*);
+ using expect = std::tuple<int, float&, const char*>;
+ test<function_ptr, expect>();
+ }
+
+ {
+ using function_ref = void(&)(int, float&, const char*);
+ using expect = std::tuple<int, float&, const char*>;
+ test<function_ref, expect>();
+ }
+
+ {
+ using function = void(int, float&, const char*);
+ using expect = std::tuple<int, float&, const char*>;
+ test<function, expect>();
+ }
+
+ {
+ using abominable = void(int, float&, const char*) const;
+ using expect = std::tuple<int, float&, const char*>;
+ test<abominable, expect>();
+ }
+}
+//]
+#endif //#ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS