- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# D:/Programmation/Sources/Tensor2/Utils/include/frost_utils_pair.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 : pair
    00005     /** Not much to say about this one : a typedef could have
    00006     *   been enough, but its not possible in the current C++
    00007     *   version (might be with C++0X).
    00008     */
    00009     template<class T, class N>
    00010     class s_pair
    00011     {
    00012     public :
    00013
    00014         /// Default constructor.
    00015         s_pair()
    00016         {
    00017         }
    00018
    00019         /// Constructor.
    00020         /** \param mFirst  The first element of the pair
    00021         *   \param mSecond The second element of the pair
    00022         */
    00023         s_pair(const T& mFirst, const N& mSecond)
    00024         {
    00025             mPair_.first = mFirst; mPair_.second = mSecond;
    00026         }
    00027
    00028         /// Conversion constructor.
    00029         /** \param mPair The pair to convert
    00030         *   \note Allows full compatiblity with STL.
    00031         */
    00032         s_pair(const std::pair<T, N>& mPair) : mPair_(mPair)
    00033         {
    00034         }
    00035
    00036         const T& First() const
    00037         {
    00038             return mPair_.first;
    00039         }
    00040
    00041         const N& Second() const
    00042         {
    00043             return mPair_.second;
    00044         }
    00045
    00046         T& First()
    00047         {
    00048             return mPair_.first;
    00049         }
    00050
    00051         N& Second()
    00052         {
    00053             return mPair_.second;
    00054         }
    00055
    00056     private :
    00057
    00058         std::pair<T, N> mPair_;
    00059     };
    00060 }