imgtools/imglib/boostlibrary/boost/concept/detail/general.hpp
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 // Copyright David Abrahams 2006. Distributed under the Boost
       
     2 // Software License, Version 1.0. (See accompanying
       
     3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       
     4 #ifndef BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
       
     5 # define BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
       
     6 
       
     7 # include <boost/preprocessor/cat.hpp>
       
     8 
       
     9 # ifdef BOOST_OLD_CONCEPT_SUPPORT
       
    10 #  include <boost/concept/detail/has_constraints.hpp>
       
    11 #  include <boost/mpl/if.hpp>
       
    12 # endif
       
    13 
       
    14 // This implementation works on Comeau and GCC, all the way back to
       
    15 // 2.95
       
    16 namespace boost { namespace concept {
       
    17 
       
    18 template <class ModelFn>
       
    19 struct requirement_;
       
    20 
       
    21 namespace detail
       
    22 {
       
    23   template <void(*)()> struct instantiate {};
       
    24 }
       
    25 
       
    26 template <class Model>
       
    27 struct requirement
       
    28 {
       
    29     static void failed() { ((Model*)0)->~Model(); }
       
    30 };
       
    31 
       
    32 # ifdef BOOST_OLD_CONCEPT_SUPPORT
       
    33 
       
    34 template <class Model>
       
    35 struct constraint
       
    36 {
       
    37     static void failed() { ((Model*)0)->constraints(); }
       
    38 };
       
    39   
       
    40 template <class Model>
       
    41 struct requirement_<void(*)(Model)>
       
    42   : mpl::if_<
       
    43         concept::not_satisfied<Model>
       
    44       , constraint<Model>
       
    45       , requirement<Model>
       
    46     >::type
       
    47 {};
       
    48   
       
    49 # else
       
    50 
       
    51 // For GCC-2.x, these can't have exactly the same name
       
    52 template <class Model>
       
    53 struct requirement_<void(*)(Model)>
       
    54   : requirement<Model>
       
    55 {};
       
    56   
       
    57 # endif
       
    58 
       
    59 #  define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr )             \
       
    60     typedef ::boost::concept::detail::instantiate<          \
       
    61     &::boost::concept::requirement_<ModelFnPtr>::failed>    \
       
    62       BOOST_PP_CAT(boost_concept_check,__LINE__)
       
    63 
       
    64 }}
       
    65 
       
    66 #endif // BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP