Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:44:40

0001 // Copyright David Abrahams 2006. Distributed under the Boost
0002 // Software License, Version 1.0. (See accompanying
0003 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0004 #ifndef BOOST_CONCEPT_REQUIRES_DWA2006430_HPP
0005 # define BOOST_CONCEPT_REQUIRES_DWA2006430_HPP
0006 
0007 # include <boost/config.hpp>
0008 # include <boost/concept/assert.hpp>
0009 # include <boost/preprocessor/seq/for_each.hpp>
0010 
0011 namespace boost { 
0012 
0013 // unaryfunptr_arg_type from parameter/aux_/parenthesized_type.hpp
0014 
0015 namespace ccheck_aux {
0016 
0017 // A metafunction that transforms void(*)(T) -> T
0018 template <class UnaryFunctionPointer>
0019 struct unaryfunptr_arg_type;
0020 
0021 template <class Arg>
0022 struct unaryfunptr_arg_type<void(*)(Arg)>
0023 {
0024     typedef Arg type;
0025 };
0026 
0027 template <>
0028 struct unaryfunptr_arg_type<void(*)(void)>
0029 {
0030     typedef void type;
0031 };
0032 
0033 } // namespace ccheck_aux
0034 
0035 // Template for use in handwritten assertions
0036 template <class Model, class More>
0037 struct requires_ : More
0038 {
0039     BOOST_CONCEPT_ASSERT((Model));
0040 };
0041 
0042 // Template for use by macros, where models must be wrapped in parens.
0043 // This isn't in namespace detail to keep extra cruft out of resulting
0044 // error messages.
0045 template <class ModelFn>
0046 struct _requires_
0047 {
0048     enum { value = 0 };
0049     BOOST_CONCEPT_ASSERT_FN(ModelFn);
0050 };
0051 
0052 template <int check, class Result>
0053 struct Requires_ : ::boost::ccheck_aux::unaryfunptr_arg_type<Result>
0054 {
0055 };
0056 
0057 # if BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(1010))
0058 #  define BOOST_CONCEPT_REQUIRES_(r,data,t) | (::boost::_requires_<void(*)t>::value)
0059 # else 
0060 #  define BOOST_CONCEPT_REQUIRES_(r,data,t) + (::boost::_requires_<void(*)t>::value)
0061 # endif
0062 
0063 #if defined(NDEBUG)
0064 
0065 # define BOOST_CONCEPT_REQUIRES(models, result)                                    \
0066     typename ::boost::ccheck_aux::unaryfunptr_arg_type<void(*)result>::type
0067 
0068 #elif BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
0069 
0070 // Same thing as below without the initial typename
0071 # define BOOST_CONCEPT_REQUIRES(models, result)                                \
0072     ::boost::Requires_<                                                        \
0073       (0 BOOST_PP_SEQ_FOR_EACH(BOOST_CONCEPT_REQUIRES_, ~, models)),           \
0074       ::boost::ccheck_aux::unaryfunptr_arg_type<void(*)result>          \
0075                      >::type
0076 
0077 #else
0078 
0079 // This just ICEs on MSVC6 :(
0080 # define BOOST_CONCEPT_REQUIRES(models, result)                                        \
0081     typename ::boost::Requires_<                                                       \
0082       (0 BOOST_PP_SEQ_FOR_EACH(BOOST_CONCEPT_REQUIRES_, ~, models)),                   \
0083       void(*)result                                                                 \
0084     >::type
0085 
0086 #endif 
0087 
0088 // C++0x proposed syntax changed.  This supports an older usage
0089 #define BOOST_CONCEPT_WHERE(models,result) BOOST_CONCEPT_REQUIRES(models,result)
0090 
0091 } // namespace boost::concept_check
0092 
0093 #endif // BOOST_CONCEPT_REQUIRES_DWA2006430_HPP