- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# D:/Programmation/Sources/Tensor2/Utils/include/frost_utils_range.h

Go to the documentation of this file.

    00001 // Warning : If you need to use this file, include frost_utils_types.h
    00002 namespace Frost
    00003 {
    00004     /// Base type : range
    00005     /** This class is a special case of s_pair.<br>
    00006     *   It should only contain iterators, but you can use it
    00007     *   with other types if you know what you're doing.<br>
    00008     *   <b>Note</b> : can be used in the "foreach" macro.
    00009     */
    00010     template<class T>
    00011     class s_range
    00012     {
    00013     public :
    00014
    00015         /// Default constructor.
    00016         s_range()
    00017         {
    00018         }
    00019
    00020         /// Constructor.
    00021         /** \param mBegin The begin iterator
    00022         *   \param mEnd   The end iterator
    00023         */
    00024         s_range(const T& mBegin, const T& mEnd) : mPair_(mBegin, mEnd)
    00025         {
    00026         }
    00027
    00028         /// Constructor.
    00029         /** \param mPair The pair to convert
    00030         */
    00031         s_range(const s_pair<T, T>& mPair) : mPair_(mPair)
    00032         {
    00033         }
    00034
    00035         /// Constructor.
    00036         /** \param mPair The pair to convert
    00037         *   \note Allows full compatiblity with STL.
    00038         */
    00039         s_range(const std::pair<T, T>& mPair) : mPair_(mPair)
    00040         {
    00041         }
    00042
    00043         const T& Begin() const
    00044         {
    00045             return mPair_.First();
    00046         }
    00047
    00048         const T& End() const
    00049         {
    00050             return mPair_.Second();
    00051         }
    00052
    00053         const T& begin() const
    00054         {
    00055             return mPair_.First();
    00056         }
    00057
    00058         const T& end() const
    00059         {
    00060             return mPair_.Second();
    00061         }
    00062
    00063     private :
    00064
    00065         s_pair<T, T> mPair_;
    00066
    00067     };
    00068 }