/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly.
*/
///////////////////////////////////////////////////////////////////////////////
//
// File: _triple.h
//
// Author: Mick Leong
//
// Desc: This is the implementation of the triplet<> template for use with STLPort.
// This work was derived from STLPort's "_pair.h" template with added enhancements
// and modifications to support 3D vectors.
//
// Usage:
// #include "triplet"
// using namespace = std
//
// History:
// Ver 1.0 2008-12-22
// - First release
//
// License:
// Permission to use or copy this software for any purpose is hereby granted
// without fee, provided the above notices are retained on all copies.
// Permission to modify the code and to distribute modified code is granted,
// provided the above notices are retained, and a notice that the code was
// modified is included with the above copyright notice.
// 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 _STLP_INTERNAL_TRIPLET_H
#define _STLP_INTERNAL_TRIPLET_H
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
# ifndef _STLP_TYPE_TRAITS_H
# include <stl/type_traits.h>
# endif
# if !defined (_STLP_MOVE_CONSTRUCT_FWK_H) && !defined (_STLP_NO_MOVE_SEMANTIC)
# include <stl/_move_construct_fwk.h>
# endif
#endif
_STLP_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;
#if defined (_STLP_CONST_CONSTRUCTOR_BUG)
triplet() {}
#else
triplet() : first(_T1()), second(_T2()), third(_T3()) {}
#endif
triplet(const _T1& __a, const _T2& __b, const _T3& __c) : first(__a), second(__b), third(__c) {}
#if defined (_STLP_MEMBER_TEMPLATES)
template <class _U1, class _U2, class _U3>
triplet(const triplet<_U1, _U2, _U3>& __p) : first(__p.first), second(__p.second), third(__p.third) {}
#endif
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
triplet(__move_source<triplet<_T1, _T2, _T3> > src) : first (_STLP_PRIV _AsMoveSource(src.get().first)),
second(_STLP_PRIV _AsMoveSource(src.get().second)),
third (_STLP_PRIV _AsMoveSource(src.get().third)) {}
#endif
__TRIVIAL_DESTRUCTOR(triplet)
};
template <class _T1, class _T2, class _T3>
inline bool _STLP_CALL triplet_eq (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 _STLP_CALL triplet_less231 (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 _STLP_CALL 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 _STLP_CALL 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);
}
#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
template <class _T1, class _T2, class _T3>
inline bool _STLP_CALL operator!=(const triplet<_T1, _T2, _T3>& __x, const triplet<_T1, _T2, _T3>& __y)
{ return !(__x == __y); }
template <class _T1, class _T2, class _T3>
inline bool _STLP_CALL operator>(const triplet<_T1, _T2, _T3>& __x, const triplet<_T1, _T2, _T3>& __y)
{ return __y < __x; }
template <class _T1, class _T2, class _T3>
inline bool _STLP_CALL operator<=(const triplet<_T1, _T2, _T2>& __x, const triplet<_T1, _T2, _T3>& __y)
{ return !(__y < __x); }
template <class _T1, class _T2, class _T3>
inline bool _STLP_CALL operator>=(const triplet<_T1, _T2, _T3>& __x, const triplet<_T1, _T2, _T3>& __y)
{ return !(__x < __y); }
#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_EXTENSIONS)
template <class _T1, class _T2, class _T3, int _Sz>
inline triplet<_T1 const*, _T2, _T3> make_triplet( _T1 const (&__x)[_Sz],
_T2 const& __y,
_T3 const& __z )
{ return triplet<_T1 const*, _T2, _T3>(static_cast<_T1 const*>(__x), __y, __z); }
template <class _T1, class _T2, class _T3, int _Sz>
inline triplet<_T1, _T2 const*, _T3> make_triplet( _T1 const& __x,
_T2 const (&__y)[_Sz],
_T3 const& __z )
{ return triplet<_T1, _T2 const*, _T3>(__x, static_cast<_T2 const*>(__y), __z); }
template <class _T1, class _T2, class _T3, int _Sz>
inline triplet<_T1, _T2, _T3 const*> make_triplet( _T1 const& __x,
_T2 const& __y,
_T3 const (&__z)[_Sz] )
{ return triplet<_T1, _T2, _T3 const*>(__x, __y, static_cast<_T3 const*>(__z) ); }
template <class _T1, class _T2, class _T3, int _Sz1, int _Sz2>
inline triplet<_T1 const*, _T2 const*, _T3> make_triplet( _T1 const (&__x)[_Sz1],
_T2 const (&__y)[_Sz2],
_T3 const& __z )
{ return triplet<_T1 const*, _T2 const*, _T3>( static_cast<_T1 const*>(__x), static_cast<_T2 const*>(__y), __z); }
template <class _T1, class _T2, class _T3, int _Sz1, int _Sz2>
inline triplet<_T1, _T2 const*, _T3 const*> make_triplet( _T1 const& __x,
_T2 const (&__y)[_Sz1],
_T3 const (&__z)[_Sz2] )
{ return triplet<_T1, _T2 const*, _T3 const*>( __x, static_cast<_T2 const*>(__y), static_cast<_T2 const*>(__z) ); }
template <class _T1, class _T2, class _T3, int _Sz1, int _Sz2, int _Sz3>
inline triplet<_T1 const*, _T2 const*, _T3 const*> make_triplet(_T1 const (&__x)[_Sz1],
_T2 const (&__y)[_Sz2],
_T3 const (&__z)[_Sz3] )
{ return triplet<_T1 const*, _T2 const*, _T3 const*>( static_cast<_T1 const*>(__x),
static_cast<_T2 const*>(__y),
static_cast<_T3 const*>(__z) );
}
#endif
template <class _T1, class _T2, class _T3>
inline triplet<_T1, _T2, _T3> _STLP_CALL make_triplet(_T1 __x, _T2 __y, _T3 __z)
{ return triplet<_T1, _T2, _T3>(__x, __y, __z); }
_STLP_END_NAMESPACE
#if defined (_STLP_USE_NAMESPACES) || !defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
_STLP_BEGIN_RELOPS_NAMESPACE
_STLP_END_RELOPS_NAMESPACE
#endif
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
_STLP_BEGIN_NAMESPACE
template <class _T1, class _T2, class _T3>
struct __type_traits<triplet<_T1, _T2, _T3> > {
typedef __type_traits<_T1> _T1Traits;
typedef __type_traits<_T2> _T2Traits;
typedef __type_traits<_T3> _T3Traits;
typedef typename _Land2<typename _T1Traits::has_trivial_default_constructor,
typename _T2Traits::has_trivial_default_constructor>::_Ret has_trivial_default_constructor;
typedef typename _Land2<typename _T1Traits::has_trivial_copy_constructor,
typename _T2Traits::has_trivial_copy_constructor>::_Ret has_trivial_copy_constructor;
typedef typename _Land2<typename _T1Traits::has_trivial_assignment_operator,
typename _T2Traits::has_trivial_assignment_operator>::_Ret has_trivial_assignment_operator;
typedef typename _Land2<typename _T1Traits::has_trivial_destructor,
typename _T2Traits::has_trivial_destructor>::_Ret has_trivial_destructor;
typedef __false_type is_POD_type;
};
# if !defined (_STLP_NO_MOVE_SEMANTIC)
template <class _T1, class _T2, class _T3>
struct __move_traits<triplet<_T1, _T2, _T3> >
: _STLP_PRIV __move_traits_help1<_T1, _T2, _T3> {};
# endif
_STLP_END_NAMESPACE
#endif
#endif /* _STLP_INTERNAL_TRIPLET_H */
// Local Variables:
// mode:C++
// End: