Skip to content

Commit 01ff79e

Browse files
vendethielingydotnet
authored andcommitted
add boost::callable_traits
1 parent 803ebf7 commit 01ff79e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+6202
-0
lines changed

src/cpp/ext/boost/.DS_Store

6 KB
Binary file not shown.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
3+
@Copyright Barrett Adair 2015-2017
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+
9+
#ifndef BOOST_CLBL_TRTS_BOOST_CLBL_TRTS_HPP
10+
#define BOOST_CLBL_TRTS_BOOST_CLBL_TRTS_HPP
11+
12+
#include <boost/callable_traits/detail/core.hpp>
13+
#include <boost/callable_traits/add_member_const.hpp>
14+
#include <boost/callable_traits/add_member_cv.hpp>
15+
#include <boost/callable_traits/add_member_lvalue_reference.hpp>
16+
#include <boost/callable_traits/add_member_rvalue_reference.hpp>
17+
#include <boost/callable_traits/add_member_volatile.hpp>
18+
#include <boost/callable_traits/add_noexcept.hpp>
19+
#include <boost/callable_traits/add_transaction_safe.hpp>
20+
#include <boost/callable_traits/add_varargs.hpp>
21+
#include <boost/callable_traits/apply_member_pointer.hpp>
22+
#include <boost/callable_traits/apply_return.hpp>
23+
#include <boost/callable_traits/args.hpp>
24+
#include <boost/callable_traits/class_of.hpp>
25+
#include <boost/callable_traits/function_type.hpp>
26+
#include <boost/callable_traits/has_member_qualifiers.hpp>
27+
#include <boost/callable_traits/has_varargs.hpp>
28+
#include <boost/callable_traits/has_void_return.hpp>
29+
#include <boost/callable_traits/is_const_member.hpp>
30+
#include <boost/callable_traits/is_invocable.hpp>
31+
#include <boost/callable_traits/is_lvalue_reference_member.hpp>
32+
#include <boost/callable_traits/is_reference_member.hpp>
33+
#include <boost/callable_traits/is_rvalue_reference_member.hpp>
34+
#include <boost/callable_traits/is_noexcept.hpp>
35+
#include <boost/callable_traits/is_transaction_safe.hpp>
36+
#include <boost/callable_traits/is_volatile_member.hpp>
37+
#include <boost/callable_traits/qualified_class_of.hpp>
38+
#include <boost/callable_traits/remove_member_const.hpp>
39+
#include <boost/callable_traits/remove_member_cv.hpp>
40+
#include <boost/callable_traits/remove_member_reference.hpp>
41+
#include <boost/callable_traits/remove_member_volatile.hpp>
42+
#include <boost/callable_traits/remove_noexcept.hpp>
43+
#include <boost/callable_traits/remove_transaction_safe.hpp>
44+
#include <boost/callable_traits/remove_varargs.hpp>
45+
#include <boost/callable_traits/return_type.hpp>
46+
47+
#endif
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
3+
@Copyright Barrett Adair 2015-2017
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+
9+
#ifndef BOOST_CLBL_TRTS_ADD_MEMBER_CONST_HPP
10+
#define BOOST_CLBL_TRTS_ADD_MEMBER_CONST_HPP
11+
12+
#include <boost/callable_traits/detail/core.hpp>
13+
14+
namespace boost { namespace callable_traits {
15+
16+
//[ add_member_const_hpp
17+
/*`
18+
[section:ref_add_member_const add_member_const]
19+
[heading Header]
20+
``#include <boost/callable_traits/add_member_const.hpp>``
21+
[heading Definition]
22+
*/
23+
24+
template<typename T>
25+
using add_member_const_t = //see below
26+
//<-
27+
#ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
28+
29+
detail::sfinae_try<
30+
typename detail::traits<T>::add_member_const,
31+
32+
detail::fail_when_same<typename detail::traits<T>::add_member_const,
33+
detail::abominable_functions_not_supported_on_this_compiler,
34+
this_compiler_doesnt_support_abominable_function_types>,
35+
36+
detail::fail_if_invalid<typename detail::traits<T>::add_member_const,
37+
member_qualifiers_are_illegal_for_this_type>>;
38+
#else
39+
40+
detail::try_but_fail_if_invalid<
41+
typename detail::traits<T>::add_member_const,
42+
member_qualifiers_are_illegal_for_this_type>;
43+
44+
#endif // #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
45+
46+
namespace detail {
47+
48+
template<typename T, typename = std::false_type>
49+
struct add_member_const_impl {};
50+
51+
template<typename T>
52+
struct add_member_const_impl <T, typename std::is_same<
53+
add_member_const_t<T>, detail::dummy>::type>
54+
{
55+
using type = add_member_const_t<T>;
56+
};
57+
}
58+
59+
//->
60+
61+
template<typename T>
62+
struct add_member_const : detail::add_member_const_impl<T> {};
63+
64+
//<-
65+
}} // namespace boost::callable_traits
66+
//->
67+
68+
69+
/*`
70+
[heading Constraints]
71+
* `T` must be a function type or a member function pointer type
72+
* If `T` is a pointer, it may not be cv/ref qualified
73+
74+
[heading Behavior]
75+
* A substitution failure occurs if the constraints are violated.
76+
* Adds a member `const` qualifier to `T`, if not already present.
77+
78+
[heading Input/Output Examples]
79+
[table
80+
[[`T`] [`add_member_const_t<T>`]]
81+
[[`int()`] [`int() const`]]
82+
[[`int(foo::*)()`] [`int(foo::*)() const`]]
83+
[[`int(foo::*)() &`] [`int(foo::*)() const &`]]
84+
[[`int(foo::*)() &&`] [`int(foo::*)() const &&`]]
85+
[[`int(foo::*)() const`] [`int(foo::*)() const`]]
86+
[[`int(foo::*)() volatile`] [`int(foo::*)() const volatile`]]
87+
[[`int(foo::*)() transaction_safe`] [`int(foo::*)() const transaction_safe`]]
88+
[[`int`] [(substitution failure)]]
89+
[[`int (&)()`] [(substitution failure)]]
90+
[[`int (*)()`] [(substitution failure)]]
91+
[[`int foo::*`] [(substitution failure)]]
92+
[[`int (foo::* const)()`] [(substitution failure)]]
93+
]
94+
95+
[heading Example Program]
96+
[import ../example/add_member_const.cpp]
97+
[add_member_const]
98+
[endsect]
99+
*/
100+
//]
101+
102+
#endif // #ifndef BOOST_CLBL_TRTS_ADD_MEMBER_CONST_HPP
103+
104+
105+
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/*
2+
3+
@Copyright Barrett Adair 2015-2017
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+
9+
#ifndef BOOST_CLBL_TRTS_ADD_MEMBER_CV_HPP
10+
#define BOOST_CLBL_TRTS_ADD_MEMBER_CV_HPP
11+
12+
#include <boost/callable_traits/detail/core.hpp>
13+
14+
namespace boost { namespace callable_traits {
15+
16+
//[ add_member_cv_hpp
17+
/*`
18+
[section:ref_add_member_cv add_member_cv]
19+
[heading Header]
20+
``#include <boost/callable_traits/add_member_cv.hpp>``
21+
[heading Definition]
22+
*/
23+
24+
template<typename T>
25+
using add_member_cv_t = //see below
26+
//<-
27+
#ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
28+
29+
detail::sfinae_try<
30+
typename detail::traits<T>::add_member_cv,
31+
32+
detail::fail_when_same<typename detail::traits<T>::add_member_cv,
33+
detail::abominable_functions_not_supported_on_this_compiler,
34+
this_compiler_doesnt_support_abominable_function_types>,
35+
36+
detail::fail_if_invalid<typename detail::traits<T>::add_member_cv,
37+
member_qualifiers_are_illegal_for_this_type>>;
38+
#else
39+
40+
detail::try_but_fail_if_invalid<
41+
typename detail::traits<T>::add_member_cv,
42+
member_qualifiers_are_illegal_for_this_type>;
43+
44+
#endif // #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
45+
46+
namespace detail {
47+
48+
template<typename T, typename = std::false_type>
49+
struct add_member_cv_impl {};
50+
51+
template<typename T>
52+
struct add_member_cv_impl <T, typename std::is_same<
53+
add_member_cv_t<T>, detail::dummy>::type>
54+
{
55+
using type = add_member_cv_t<T>;
56+
};
57+
}
58+
59+
//->
60+
61+
template<typename T>
62+
struct add_member_cv : detail::add_member_cv_impl<T> {};
63+
64+
//<-
65+
}} // namespace boost::callable_traits
66+
//->
67+
68+
/*`
69+
[heading Constraints]
70+
* `T` must be a function type or a member function pointer type
71+
* If `T` is a pointer, it may not be cv/ref qualified
72+
73+
[heading Behavior]
74+
* A substitution failure occurs if the constraints are violated.
75+
* Adds member `const` and `volatile` qualifiers to `T`, if not already present.
76+
77+
[heading Input/Output Examples]
78+
[table
79+
[[`T`] [`add_member_cv_t<T>`]]
80+
[[`int()`] [`int() const volatile`]]
81+
[[`int(foo::*)()`] [`int(foo::*)() const volatile`]]
82+
[[`int(foo::*)() &`] [`int(foo::*)() const volatile &`]]
83+
[[`int(foo::*)() &&`] [`int(foo::*)() const volatile &&`]]
84+
[[`int(foo::*)() const`] [`int(foo::*)() const volatile`]]
85+
[[`int(foo::*)() volatile`] [`int(foo::*)() const volatile`]]
86+
[[`int(foo::*)() transaction_safe`] [`int(foo::*)() const volatile transaction_safe`]]
87+
[[`int`] [(substitution failure)]]
88+
[[`int (&)()`] [(substitution failure)]]
89+
[[`int (*)()`] [(substitution failure)]]
90+
[[`int foo::*`] [(substitution failure)]]
91+
[[`int (foo::* const)()`] [(substitution failure)]]
92+
]
93+
94+
[heading Example Program]
95+
[import ../example/add_member_cv.cpp]
96+
[add_member_cv]
97+
[endsect]
98+
*/
99+
//]
100+
101+
#endif
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
3+
@Copyright Barrett Adair 2015-2017
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+
9+
#ifndef BOOST_CLBL_TRTS_ADD_MEMBER_LVALUE_REFERENCE_HPP
10+
#define BOOST_CLBL_TRTS_ADD_MEMBER_LVALUE_REFERENCE_HPP
11+
12+
#include <boost/callable_traits/detail/core.hpp>
13+
14+
namespace boost { namespace callable_traits {
15+
16+
//[ add_member_lvalue_reference_hpp
17+
/*`
18+
[section:ref_add_member_lvalue_reference add_member_lvalue_reference]
19+
[heading Header]
20+
``#include <boost/callable_traits/add_member_lvalue_reference.hpp>``
21+
[heading Definition]
22+
*/
23+
24+
#ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
25+
26+
template<typename T>
27+
struct add_member_lvalue_reference_t {
28+
static_assert(std::is_same<T, detail::dummy>::value,
29+
"Reference member qualifiers are not supported by this configuration.");
30+
};
31+
32+
#else
33+
34+
template<typename T>
35+
using add_member_lvalue_reference_t = //see below
36+
//<-
37+
#ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
38+
39+
detail::sfinae_try<
40+
typename detail::traits<T>::add_member_lvalue_reference,
41+
42+
detail::fail_when_same<typename detail::traits<T>::add_member_lvalue_reference,
43+
detail::abominable_functions_not_supported_on_this_compiler,
44+
this_compiler_doesnt_support_abominable_function_types>,
45+
46+
detail::fail_if_invalid<
47+
typename detail::traits<T>::add_member_lvalue_reference,
48+
member_qualifiers_are_illegal_for_this_type>>;
49+
#else
50+
51+
detail::try_but_fail_if_invalid<
52+
typename detail::traits<T>::add_member_lvalue_reference,
53+
member_qualifiers_are_illegal_for_this_type>;
54+
55+
#endif // #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
56+
#endif // #ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
57+
58+
namespace detail {
59+
60+
template<typename T, typename = std::false_type>
61+
struct add_member_lvalue_reference_impl {};
62+
63+
template<typename T>
64+
struct add_member_lvalue_reference_impl <T, typename std::is_same<
65+
add_member_lvalue_reference_t<T>, detail::dummy>::type>
66+
{
67+
using type = add_member_lvalue_reference_t<T>;
68+
};
69+
}
70+
//->
71+
72+
template<typename T>
73+
struct add_member_lvalue_reference
74+
: detail::add_member_lvalue_reference_impl<T> {};
75+
76+
//<-
77+
}} // namespace boost::callable_traits
78+
//->
79+
80+
/*`
81+
[heading Constraints]
82+
* `T` must be a function type or a member function pointer type
83+
* If `T` is a pointer, it may not be cv/ref qualified
84+
85+
[heading Behavior]
86+
* A substitution failure occurs if the constraints are violated.
87+
* Adds a member lvalue reference qualifier (`&`) to `T`, if not already present.
88+
* If an rvalue reference qualifier is present, the lvalue reference qualifier replaces it (in accordance with reference collapsing rules).
89+
90+
[heading Input/Output Examples]
91+
[table
92+
[[`T`] [`add_member_lvalue_reference_t<T>`]]
93+
[[`int()`] [`int() &`]]
94+
[[`int(foo::*)()`] [`int(foo::*)() &`]]
95+
[[`int(foo::*)() &`] [`int(foo::*)() &`]]
96+
[[`int(foo::*)() &&`] [`int(foo::*)() &`]]
97+
[[`int(foo::*)() const`] [`int(foo::*)() const &`]]
98+
[[`int(foo::*)() transaction_safe`] [`int(foo::*)() & transaction_safe`]]
99+
[[`int`] [(substitution failure)]]
100+
[[`int (&)()`] [(substitution failure)]]
101+
[[`int (*)()`] [(substitution failure)]]
102+
[[`int foo::*`] [(substitution failure)]]
103+
[[`int (foo::* const)()`] [(substitution failure)]]
104+
]
105+
106+
[heading Example Program]
107+
[import ../example/add_member_lvalue_reference.cpp]
108+
[add_member_lvalue_reference]
109+
[endsect]
110+
*/
111+
//]
112+
113+
#endif
114+

0 commit comments

Comments
 (0)