• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*<-
2 Copyright (c) 2016 Barrett Adair
3 
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
6 ->*/
7 
8 #include <boost/callable_traits/detail/config.hpp>
9 
10 
11 #ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
main()12 int main(){}
13 #else
14 
15 #include <boost/callable_traits/add_transaction_safe.hpp>
16 #include "test.hpp"
17 
18 template<typename Safe, typename NotSafe>
test()19 void test() {
20 
21     CT_ASSERT(std::is_same<Safe,  TRAIT(add_transaction_safe, NotSafe)>::value);
22 
23     //sanity check
24     CT_ASSERT(!std::is_same<Safe, NotSafe>::value);
25 }
26 
27 #define TEST_TRANSACTION_SAFE(not_safe) test<not_safe transaction_safe, not_safe>()
28 
main()29 int main() {
30 
31     TEST_TRANSACTION_SAFE(int(int) &);
32     TEST_TRANSACTION_SAFE(int(*)(int));
33     TEST_TRANSACTION_SAFE(int(int, ...) &&);
34     TEST_TRANSACTION_SAFE(int(*)(int, ...));
35 
36     struct foo;
37 
38     TEST_TRANSACTION_SAFE(int(foo::*)(int));
39     TEST_TRANSACTION_SAFE(int(foo::*)(int) const);
40     TEST_TRANSACTION_SAFE(int(foo::*)(int, ...));
41     TEST_TRANSACTION_SAFE(int(foo::*)(int, ...) volatile);
42 }
43 
44 #endif
45 
46