/*
 * 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.
 */

/* NOTE: This is an internal header file, included by other STL headers.
 *   You should not attempt to use it directly.
 */

#ifndef __SGI_STL_INTERNAL_TRIPLET_H
#define __SGI_STL_INTERNAL_TRIPLET_H

__STL_BEGIN_NAMESPACE

template <class T1, class T2, class T3>
struct triplet {
  typedef T1 first_type;
  typedef T2 second_type;
  typedef T3 third_type;

  T1 first;
  T2 second;
  T3 third;
  triplet() : first(T1()), second(T2()), third(T3()) {}
  triplet(const T1& a, const T2& b, const T3& c) : first(a), second(b), third(c) {}

#ifdef __STL_MEMBER_TEMPLATES
  template <class U1, class U2, class U3>
  triplet(const triplet<U1, U2, U3>& t)
    : first(t.first), second(t.second), third(t.third) {}
#endif
};

template <class T1, class T2, class T3>
inline bool operator==(const triplet<T1, T2, T3>& x, const triplet<T1, T2, T3>& y) { 
  return x.first == y.first && x.second == y.second && x.third == y.third;
}

template <class T1, class T2, class T3>
inline bool operator<(const triplet<T1, T2, T3>& x, const triplet<T1, T2, T3>& y) { 
  return x.first < y.first ||
      (!(y.first < x.first) && x.second < y.second) ||
      (!(y.first < x.first) && !(y.second < x.second) && x.third < y.third);
}

template <class T1, class T2, class T3>
inline triplet<T1, T2, T3> make_triplet(const T1& x, const T2& y, const T3& z) {
  return triplet<T1, T2, T3>(x, y, z);
}

__STL_END_NAMESPACE

#endif /* __SGI_STL_INTERNAL_TRIPLET_H */

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