- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# D:/Programmation/Sources/Tensor2/Utils/include/frost_utils_makepair.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     // Frost's version of std::make_pair.
    00005     // This function automatically converts PODs to Frost's types,
    00006     // so writing :
    00007     //      MakePair(1, 1u)
    00008     // ... creates a s_pair<s_int, s_uint> rather than a s_pair<int, uint>, and :
    00009     //      MakePair(1, "bla")
    00010     // ... creates a s_pair<s_int, s_str> rather than throwing a compiler error,
    00011     // as std::make_pair does if your implementation is standard compliant.
    00012     // See : http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#181
    00013
    00014     template<class T, class N>
    00015     s_pair<typename TypeTraits<T>::FrostType, typename TypeTraits<N>::FrostType> MakePair(const T& mFirst, const N& mSecond)
    00016     {
    00017         return s_pair<typename TypeTraits<T>::FrostType, typename TypeTraits<N>::FrostType>(mFirst, mSecond);
    00018     }
    00019
    00020     template<class N>
    00021     s_pair<s_str_t<char>, typename TypeTraits<N>::FrostType> MakePair(const char* mFirst, const N& mSecond)
    00022     {
    00023         return s_pair<s_str_t<char>, typename TypeTraits<N>::FrostType>(mFirst, mSecond);
    00024     }
    00025
    00026     template<class T>
    00027     s_pair< typename TypeTraits<T>::FrostType, s_str_t<char> > MakePair(const T& mFirst, const char* mSecond)
    00028     {
    00029         return s_pair< typename TypeTraits<T>::FrostType, s_str_t<char> >(mFirst, mSecond);
    00030     }
    00031 }