comparison DEPENDENCIES/generic/include/boost/concept/requires.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4 #ifndef BOOST_CONCEPT_REQUIRES_DWA2006430_HPP 4 #ifndef BOOST_CONCEPT_REQUIRES_DWA2006430_HPP
5 # define BOOST_CONCEPT_REQUIRES_DWA2006430_HPP 5 # define BOOST_CONCEPT_REQUIRES_DWA2006430_HPP
6 6
7 # include <boost/config.hpp> 7 # include <boost/config.hpp>
8 # include <boost/parameter/aux_/parenthesized_type.hpp>
9 # include <boost/concept/assert.hpp> 8 # include <boost/concept/assert.hpp>
10 # include <boost/preprocessor/seq/for_each.hpp> 9 # include <boost/preprocessor/seq/for_each.hpp>
11 10
12 namespace boost { 11 namespace boost {
13 12
13 // unaryfunptr_arg_type from parameter/aux_/parenthesized_type.hpp
14
15 namespace ccheck_aux {
16
17 // A metafunction that transforms void(*)(T) -> T
18 template <class UnaryFunctionPointer>
19 struct unaryfunptr_arg_type;
20
21 template <class Arg>
22 struct unaryfunptr_arg_type<void(*)(Arg)>
23 {
24 typedef Arg type;
25 };
26
27 template <>
28 struct unaryfunptr_arg_type<void(*)(void)>
29 {
30 typedef void type;
31 };
32
33 } // namespace ccheck_aux
34
14 // Template for use in handwritten assertions 35 // Template for use in handwritten assertions
15 template <class Model, class More> 36 template <class Model, class More>
16 struct requires_ : More 37 struct requires_ : More
17 { 38 {
18 # if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
19 typedef typename More::type type;
20 # endif
21 BOOST_CONCEPT_ASSERT((Model)); 39 BOOST_CONCEPT_ASSERT((Model));
22 }; 40 };
23 41
24 // Template for use by macros, where models must be wrapped in parens. 42 // Template for use by macros, where models must be wrapped in parens.
25 // This isn't in namespace detail to keep extra cruft out of resulting 43 // This isn't in namespace detail to keep extra cruft out of resulting
30 enum { value = 0 }; 48 enum { value = 0 };
31 BOOST_CONCEPT_ASSERT_FN(ModelFn); 49 BOOST_CONCEPT_ASSERT_FN(ModelFn);
32 }; 50 };
33 51
34 template <int check, class Result> 52 template <int check, class Result>
35 struct Requires_ : ::boost::parameter::aux::unaryfunptr_arg_type<Result> 53 struct Requires_ : ::boost::ccheck_aux::unaryfunptr_arg_type<Result>
36 { 54 {
37 # if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
38 typedef typename ::boost::parameter::aux::unaryfunptr_arg_type<Result>::type type;
39 # endif
40 }; 55 };
41 56
42 # if BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(1010)) 57 # if BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(1010))
43 # define BOOST_CONCEPT_REQUIRES_(r,data,t) | (::boost::_requires_<void(*)t>::value) 58 # define BOOST_CONCEPT_REQUIRES_(r,data,t) | (::boost::_requires_<void(*)t>::value)
44 # else 59 # else
45 # define BOOST_CONCEPT_REQUIRES_(r,data,t) + (::boost::_requires_<void(*)t>::value) 60 # define BOOST_CONCEPT_REQUIRES_(r,data,t) + (::boost::_requires_<void(*)t>::value)
46 # endif 61 # endif
47 62
48 #if defined(NDEBUG) || BOOST_WORKAROUND(BOOST_MSVC, < 1300) 63 #if defined(NDEBUG)
49 64
50 # define BOOST_CONCEPT_REQUIRES(models, result) \ 65 # define BOOST_CONCEPT_REQUIRES(models, result) \
51 typename ::boost::parameter::aux::unaryfunptr_arg_type<void(*)result>::type 66 typename ::boost::ccheck_aux::unaryfunptr_arg_type<void(*)result>::type
52 67
53 #elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) 68 #elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
54 69
55 // Same thing as below without the initial typename 70 // Same thing as below without the initial typename
56 # define BOOST_CONCEPT_REQUIRES(models, result) \ 71 # define BOOST_CONCEPT_REQUIRES(models, result) \
57 ::boost::Requires_< \ 72 ::boost::Requires_< \
58 (0 BOOST_PP_SEQ_FOR_EACH(BOOST_CONCEPT_REQUIRES_, ~, models)), \ 73 (0 BOOST_PP_SEQ_FOR_EACH(BOOST_CONCEPT_REQUIRES_, ~, models)), \
59 ::boost::parameter::aux::unaryfunptr_arg_type<void(*)result> \ 74 ::boost::ccheck_aux::unaryfunptr_arg_type<void(*)result> \
60 >::type 75 >::type
61 76
62 #else 77 #else
63 78
64 // This just ICEs on MSVC6 :( 79 // This just ICEs on MSVC6 :(