Mirror reflection library 0.5.13

mirror/meta_prog/as_a.hpp

Go to the documentation of this file.
00001 
00010 #ifndef MIRROR_META_PROG_AS_A_1011291729_HPP
00011 #define MIRROR_META_PROG_AS_A_1011291729_HPP
00012 
00013 #include <mirror/meta_prog/forward_decl.hpp>
00014 #include <mirror/meta_prog/not.hpp>
00015 #include <type_traits>
00016 
00017 MIRROR_NAMESPACE_BEGIN
00018 namespace mp {
00019 namespace aux {
00020 
00021 template <class X, class RealConcept, class QueriedConcept, class True>
00022 struct as_a_getter
00023 {
00024     typedef X type;
00025 };
00026 
00027 template <class X, class RealConcept, class QueriedConcept>
00028 struct as_a_helper
00029  : public as_a_getter<
00030     X, RealConcept, QueriedConcept,
00031     typename ::std::is_base_of<QueriedConcept, RealConcept>::type
00032 >
00033 { };
00034 
00035 template <class X, class Concept>
00036 struct as_a_helper<X, Concept, Concept>
00037 {
00038     typedef X type;
00039 };
00040 
00041 template <class X, class QueriedConcept>
00042 struct as_a_helper<X, non_meta_object_tag, QueriedConcept>
00043  : public as_a_getter<X, non_meta_object_tag, QueriedConcept, std::false_type>
00044 { };
00045 
00046 template <class X, class RealConcept, class QueriedConcept>
00047 struct as_a_getter<X, RealConcept, QueriedConcept, std::false_type>
00048  : public as_a_helper<
00049     typename X::type,
00050     typename meta_object_category<typename X::type>::type,
00051     QueriedConcept
00052 >{ };
00053 
00054 } // namespace aux
00055 
00056 #ifdef MIRROR_DOCUMENTATION_ONLY
00057 
00058 
00064 template <class MetaObjectExpr, class Concept>
00065 struct as_a
00066 {
00068     typedef unspecified type;
00069 };
00070 #else
00071 template <class X, class Concept>
00072 struct as_a : aux::as_a_helper<
00073     X,
00074     typename meta_object_category<X>::type,
00075     Concept
00076 >
00077 { };
00078 #endif
00079 
00080 } // namespace mp
00081 MIRROR_NAMESPACE_END
00082 
00083 #endif //include guard
00084 

Copyright © 2006-2011 Matus Chochlik, University of Zilina, Zilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Fri Dec 16 2011 by Doxygen (version 1.7.3).
Important note: Although the 'boostified' version of Mirror uses the Boost C++ libraries Coding Guidelines and is implemented inside of the boost namespace, it IS NOT an officially reviewed and accepted Boost library. Mirror is being developed with the intention to be submitted for review for inclusion to the Boost C++ libraries.