OKlibrary  0.2.1.6
ConceptsMetafunctions.hpp
Go to the documentation of this file.
00001 // Oliver Kullmann, 25.5.2005 (Swansea)
00002 /* Copyright 2005 - 2007 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00008 #ifndef CONCEPTSMETAFUNCTIONS_olNb4T
00009 #define CONCEPTSMETAFUNCTIONS_olNb4T
00010 
00016 #include <tr1/type_traits>
00017 
00018 #include <boost/mpl/if.hpp>
00019 #include <boost/mpl/or.hpp>
00020 #include <boost/mpl/and.hpp>
00021 #include <boost/type_traits.hpp>
00022 #include <boost/mpl/has_xxx.hpp>
00023 
00024 #include <OKlib/Programming/MetaProgramming/Logical.hpp>
00025 
00026 #include <OKlib/Concepts/ConceptsBase.hpp>
00027 #include <OKlib/Concepts/traits/concept_tag.hpp>
00028 
00029 namespace OKlib {
00030   namespace Concepts {
00031 
00037     template <class T, class concept_tag>
00038     class IsTagModel {
00039       typedef typename ::OKlib::Concepts::traits::concept_tag<T>::type t_concept_tag;
00040     public :
00041       typedef typename std::tr1::is_base_of<concept_tag, t_concept_tag>::type type;
00042       OKLIB_META_VALUE_T
00043     };
00044 
00045      // -------------------------------------------------------------------------------------------------------------------
00046 
00052     template <class Tag>
00053     struct IsConceptTag : ::boost::is_base_and_derived< ::OKlib::Concepts::ConceptsBase_tag, Tag> {};
00054 
00060     namespace implementation_has_concept_tag {
00061       BOOST_MPL_HAS_XXX_TRAIT_DEF(type)
00062       template <bool has_concept_tag, typename T>
00063       struct is_concept_tag : ::boost::mpl::bool_<false> {};
00064       template <typename T>
00065       struct is_concept_tag<true, T> : IsConceptTag<typename ::OKlib::Concepts::traits::concept_tag<T>::type> {};
00066     }
00067     template <class T>
00068     struct HasConceptTag : implementation_has_concept_tag::is_concept_tag<implementation_has_concept_tag::has_type< ::OKlib::Concepts::traits::concept_tag<T> >::value, T> {};
00069 
00070   }
00071 
00072 }
00073 
00074 #endif