00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MTL_RANGE_GENERATOR_INCLUDE
00013 #define MTL_RANGE_GENERATOR_INCLUDE
00014
00015 #include <boost/numeric/mtl/detail/range_generator.hpp>
00016 #include <boost/numeric/mtl/utility/complexity.hpp>
00017 #include <boost/numeric/mtl/utility/tag.hpp>
00018 #include <boost/numeric/mtl/concept/collection.hpp>
00019 #include <boost/type_traits.hpp>
00020 #include <boost/mpl/if.hpp>
00021
00022 namespace mtl {
00023
00024 namespace traits
00025 {
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 template <typename Tag, typename Collection>
00047 struct range_generator
00048 {
00049 typedef complexity_classes::infinite complexity;
00050 static int const level = 0;
00051 typedef Tag tag;
00052
00053
00054
00055
00056 };
00057 }
00058
00059
00060
00062
00064 template <class Tag, class Collection>
00065 typename traits::range_generator<Tag, Collection>::type
00066 inline begin(Collection const& c)
00067 {
00068 return traits::range_generator<Tag, Collection>().begin(c);
00069 }
00070
00071 template <class Tag, class Collection>
00072 typename traits::range_generator<Tag, Collection>::type
00073 inline begin(Collection& c)
00074 {
00075 return traits::range_generator<Tag, Collection>().begin(c);
00076 }
00077
00079 template <class Tag, class Collection>
00080 typename traits::range_generator<Tag, Collection>::type
00081 inline end(Collection const& c)
00082 {
00083 return traits::range_generator<Tag, Collection>().end(c);
00084 }
00085
00086 template <class Tag, class Collection>
00087 typename traits::range_generator<Tag, Collection>::type
00088 inline end(Collection& c)
00089 {
00090 return traits::range_generator<Tag, Collection>().end(c);
00091 }
00092
00094
00108 template <class Tag, class Coll>
00109 typename traits::range_generator<Tag, Coll>::type
00110 inline lower_bound(Coll const& c, typename Collection<Coll>::size_type position)
00111 {
00112 return traits::range_generator<Tag, Coll>().lower_bound(c, position);
00113 }
00114
00115 template <class Tag, class Coll>
00116 typename traits::range_generator<Tag, Coll>::type
00117 inline lower_bound(Coll& c, typename Collection<Coll>::size_type position)
00118 {
00119 return traits::range_generator<Tag, Coll>().lower_bound(c, position);
00120 }
00121
00122
00123 namespace traits {
00124
00125
00126 template <typename Matrix>
00127 struct range_generator<tag::major, Matrix>
00128 : public range_generator<
00129 typename boost::mpl::if_<
00130 boost::is_same<typename Matrix::orientation, row_major>
00131 , ::mtl::tag::row
00132 , ::mtl::tag::col
00133 >::type,
00134 Matrix>
00135 {};
00136
00137
00138 template <typename Matrix>
00139 struct range_generator<tag::minor, Matrix>
00140 : public range_generator<
00141 typename boost::mpl::if_<
00142 boost::is_same<typename Matrix::orientation, row_major>
00143 , ::mtl::tag::col
00144 , ::mtl::tag::row
00145 >::type,
00146 Matrix>
00147 {};
00148
00149 }
00150
00151
00152 }
00153
00154 #endif // MTL_RANGE_GENERATOR_INCLUDE