Mirror reflection library 0.5.13

mirror/meta_prog/before.hpp

Go to the documentation of this file.
00001 
00011 #ifndef MIRROR_META_PROG_BEFORE_1107061248_HPP
00012 #define MIRROR_META_PROG_BEFORE_1107061248_HPP
00013 
00014 
00015 #include <mirror/meta_prog/range.hpp>
00016 #include <mirror/meta_prog/traits.hpp>
00017 
00018 MIRROR_NAMESPACE_BEGIN
00019 namespace mp {
00020 
00021 #ifdef MIRROR_DOCUMENTATION_ONLY
00022 
00023 
00029 template <typename Range, typename Type>
00030 struct before
00031 {
00032     typedef Range type;
00033 };
00034 #endif
00035 
00036 // specialization of before for other expressions
00037 template <typename X, typename T>
00038 struct before
00039 {
00040     MIRROR_ASSERT_RETURNS_RANGE(X);
00041     typedef typename before<typename X::type, T>::type type;
00042 };
00043 
00044 // specialization of before for empty ranges
00045 template <typename T>
00046 struct before<range<>, T>
00047 {
00048     typedef range<> type;
00049 };
00050 
00051 namespace aux {
00052 
00053 template <typename Result, typename Range, typename T>
00054 struct bfr_hlpr;
00055 
00056 template <typename ... R, typename ... P, typename T>
00057 struct bfr_hlpr<
00058     mirror::mp::range<R...>,
00059     mirror::mp::range<T, P...>,
00060     T
00061 >
00062 {
00063     typedef mirror::mp::range<R...> type;
00064 };
00065 
00066 template <typename ... R, typename L, typename ... P, typename T>
00067 struct bfr_hlpr<
00068     mirror::mp::range<R...>,
00069     mirror::mp::range<L, P...>,
00070     T
00071 >
00072 {
00073     typedef typename bfr_hlpr<
00074         mirror::mp::range<R..., L>,
00075         mirror::mp::range<P...>,
00076         T
00077     >::type type;
00078 };
00079 
00080 template <typename ... R, typename T>
00081 struct bfr_hlpr<
00082     mirror::mp::range<R...>,
00083     mirror::mp::range<>,
00084     T
00085 >
00086 {
00087     typedef mirror::mp::range<R...> type;
00088 };
00089 
00090 } // namespace aux
00091 
00092 template <typename H, typename ... P, typename T>
00093 struct before<range<H, P...>, T>
00094 {
00095     typedef typename mirror::mp::aux::bfr_hlpr<
00096         mirror::mp::range<>,
00097         mirror::mp::range<H, P...>,
00098         T
00099     >::type type;
00100 };
00101 
00102 } // namespace mp
00103 MIRROR_NAMESPACE_END
00104 
00105 #endif //include guard
00106 

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.