Mirror reflection library 0.5.13

mirror/meta_prog/fold.hpp

Go to the documentation of this file.
00001 
00010 #ifndef MIRROR_META_PROG_FOLD_1011291729_HPP
00011 #define MIRROR_META_PROG_FOLD_1011291729_HPP
00012 
00013 
00014 #include <mirror/meta_prog/range.hpp>
00015 #include <mirror/meta_prog/lambda.hpp>
00016 
00017 MIRROR_NAMESPACE_BEGIN
00018 namespace mp {
00019 
00020 #ifdef MIRROR_DOCUMENTATION_ONLY
00021 
00022 
00033 template <
00034     typename Range,
00035     typename Status,
00036     typename ForwardOp
00037 > struct fold
00038 {
00040     typedef unspecified_type type;
00041 };
00042 #endif
00043 
00044 template <
00045     typename X,
00046     typename Status,
00047     class ForwardOp
00048 > struct fold
00049 {
00050     MIRROR_ASSERT_RETURNS_RANGE(X);
00051 
00052     typedef typename fold<
00053         typename X::type,
00054         Status,
00055         ForwardOp
00056     >::type type;
00057 };
00058 
00059 template <typename Status, class ForwardOp>
00060 struct fold<range<>, Status, ForwardOp>
00061 {
00062     typedef Status type;
00063 };
00064 
00065 template <
00066     typename T,
00067     typename Status,
00068     class ForwardOp
00069 > struct fold<range<T>, Status, ForwardOp>
00070 {
00071     typedef typename apply<
00072         ForwardOp,
00073         Status,
00074         T
00075     >::type type;
00076 };
00077 
00078 template <
00079     typename T,
00080     typename ... P,
00081     typename Status,
00082     class ForwardOp
00083 > struct fold<range<T, P...>, Status, ForwardOp>
00084 {
00085     typedef typename fold<
00086         range<P...>,
00087         typename apply<
00088             ForwardOp,
00089             Status,
00090             T
00091         >::type,
00092         ForwardOp
00093     >::type type;
00094 };
00095 
00096 
00097 } // namespace mp
00098 MIRROR_NAMESPACE_END
00099 
00100 #endif //include guard
00101 

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.