/*
 * Copyright (c) 1999 Johnny C. Lam.
 * All rights reserved.
 *
 * Permission to use, copy, modify, distribute and sell this software
 * and its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.  The author makes no representations
 * about the suitability of this software for any purpose.  It is
 * provided "as is" without express or implied warranty.
 */

#ifndef __SGI_STL_INTERNAL_REFERENCE_PAIR_H
#define __SGI_STL_INTERNAL_REFERENCE_PAIR_H

__STL_BEGIN_NAMESPACE

template <typename T1, typename T2>
class reference_pair {
public:
#ifdef __STL_MEMBER_TEMPLATES
    template <typename U1, typename U2>
    void operator=(const pair<U1,U2>&);
#else
    void operator=(const pair<T1,T2>&);
#endif /* __STL_MEMBER_TEMPLATES */

private:
    reference_pair();				// not implemented
    reference_pair(const reference_pair&);	// not implemented
    reference_pair(T1& first, T2& second) : _first(first), _second(second) {}

    T1& _first;
    T2& _second;

    friend reference_pair<T1,T2> bind_pair<T1,T2>(T1&, T2&);
};

template <typename T1, typename T2>
#ifdef __STL_MEMBER_TEMPLATES
template <typename U1, typename U2>
inline
void
reference_pair<T1,T2>::operator=(const pair<U1,U2>& value)
#else
inline
void
reference_pair<T1,T2>::operator=(const pair<T1,T2>& value)
#endif /* __STL_MEMBER_TEMPLATES */
{
    _first = value.first;
    _second = value.second;
}

template <typename T1, typename T2>
inline
reference_pair<T1,T2>
bind_pair(T1& first, T2& second)
{
    return reference_pair<T1,T2>(first, second);
}

__STL_END_NAMESPACE

#endif /* __SGI_STL_INTERNAL_REFERENCE_PAIR_H */

// Local Variables:
// mode:C++
// End:
