// -*- C++ -*-
//===-------------------------- utility -----------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP_UTILITY
#define _LIBCPP_UTILITY

/*
    utility synopsis

namespace std
{

template <class T>
    void
    swap(T& a, T& b);

namespace rel_ops
{
    template<class T> bool operator!=(const T&, const T&);
    template<class T> bool operator> (const T&, const T&);
    template<class T> bool operator<=(const T&, const T&);
    template<class T> bool operator>=(const T&, const T&);
}

template<class T> void swap(T& a, T& b);
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]);

template <class T, class U> T&& forward(U&&);
template <class T> typename remove_reference<T>::type&& move(T&&);

template <class T>
    typename conditional
    <
        !has_nothrow_move_constructor<T>::value && has_copy_constructor<T>::value,
        const T&,
        T&&
    >::type
    move_if_noexcept(T& x);

template <class T> typename add_rvalue_reference<T>::type declval() noexcept;

template <class T1, class T2>
struct pair
{
    typedef T1 first_type;
    typedef T2 second_type;

    T1 first;
    T2 second;

    pair(const pair&) = default;
    constexpr pair();
    pair(const T1& x, const T2& y);
    template <class U, class V> pair(U&& x, V&& y);
    template <class U, class V> pair(const pair<U, V>& p);
    template <class U, class V> pair(pair<U, V>&& p);
    template <class... Args1, class... Args2>
        pair(piecewise_construct_t, tuple<Args1...> first_args,
             tuple<Args2...> second_args);

    template <class U, class V> pair& operator=(const pair<U, V>& p);
    pair& operator=(pair&& p);
    template <class U, class V> pair& operator=(pair<U, V>&& p);

    void swap(pair& p);
};

template <class T1, class T2> bool operator==(const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2> bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2> bool operator< (const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2> bool operator> (const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2> bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2> bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&);

template <class T1, class T2> pair<V1, V2> make_pair(T1&&, T2&&);
template <class T1, class T2> void swap(pair<T1, T2>& x, pair<T1, T2>& y);

struct piecewise_construct_t { };
constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();

template <class T> class tuple_size;
template <size_t I, class T> class tuple_element;

template <class T1, class T2> struct tuple_size<std::pair<T1, T2> >;
template <class T1, class T2> struct tuple_element<0, std::pair<T1, T2> >;
template <class T1, class T2> struct tuple_element<1, std::pair<T1, T2> >;

template<size_t I, class T1, class T2>
    typename tuple_element<I, std::pair<T1, T2> >::type&
    get(std::pair<T1, T2>&);

template<size_t I, class T1, class T2>
    const typename const tuple_element<I, std::pair<T1, T2> >::type&
    get(const std::pair<T1, T2>&);

}  // std

*/

#include <__config>
#include <__tuple>
#include <type_traits>

#pragma GCC system_header

_LIBCPP_BEGIN_NAMESPACE_STD

namespace rel_ops
{

template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const _Tp& __x, const _Tp& __y)
{
    return !(__x == __y);
}

template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const _Tp& __x, const _Tp& __y)
{
    return __y < __x;
}

template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const _Tp& __x, const _Tp& __y)
{
    return !(__y < __x);
}

template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const _Tp& __x, const _Tp& __y)
{
    return !(__x < __y);
}

}  // rel_ops

// swap_ranges

template <class _ForwardIterator1, class _ForwardIterator2>
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator2
swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2)
{
    for(; __first1 != __last1; ++__first1, ++__first2)
        swap(*__first1, *__first2);
    return __first2;
}

template<class _Tp, size_t _N>
inline _LIBCPP_INLINE_VISIBILITY
void
swap(_Tp (&__a)[_N], _Tp (&__b)[_N])
{
    _STD::swap_ranges(__a, __a + _N, __b);
}

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typename conditional
<
    !has_nothrow_move_constructor<_Tp>::value && has_copy_constructor<_Tp>::value,
    const _Tp&,
    _Tp&&
>::type
#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
const _Tp&
#endif
move_if_noexcept(_Tp& __x)
{
    return _STD::move(__x);
}

struct _LIBCPP_VISIBLE piecewise_construct_t { };
//constexpr
extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();

template <class _T1, class _T2> struct pair;
template <class _T1, class _T2> void swap(pair<_T1, _T2>&, pair<_T1, _T2>&);

template <class _T1, class _T2>
struct _LIBCPP_VISIBLE pair
{
    typedef _T1 first_type;
    typedef _T2 second_type;

    _T1 first;
    _T2 second;

    _LIBCPP_INLINE_VISIBILITY pair() : first(), second() {}

    _LIBCPP_INLINE_VISIBILITY pair(const _T1& __x, const _T2& __y)
        : first(__x), second(__y) {}

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

    template <class _U1, class _U2,
              class = typename enable_if<is_convertible<_U1, first_type >::value &&
                                         is_convertible<_U2, second_type>::value>::type>
        _LIBCPP_INLINE_VISIBILITY
        pair(_U1&& __u1, _U2&& __u2)
            : first(_STD::forward<_U1>(__u1)),
              second(_STD::forward<_U2>(__u2))
            {}

#ifndef _LIBCPP_HAS_NO_VARIADICS

    template<class _Tuple,
             class = typename enable_if<__tuple_convertible<_Tuple, pair>::value>::type>
        _LIBCPP_INLINE_VISIBILITY
        pair(_Tuple&& __p)
            : first(_STD::forward<typename tuple_element<0,
                                  typename __make_tuple_types<_Tuple>::type>::type>(get<0>(__p))),
              second(_STD::forward<typename tuple_element<1,
                                   typename __make_tuple_types<_Tuple>::type>::type>(get<1>(__p)))
            {}

    template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
        _LIBCPP_INLINE_VISIBILITY
        pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
                                    tuple<_Args2...> __second_args)
            : pair(__pc, __first_args, __second_args,
                   typename __make_tuple_indices<sizeof...(_Args1)>::type(),
                   typename __make_tuple_indices<sizeof...(_Args2) >::type())
            {}

    template <class _Tuple,
              class = typename enable_if<__tuple_assignable<_Tuple, pair>::value>::type>
        _LIBCPP_INLINE_VISIBILITY
        pair&
        operator=(_Tuple&& __p)
        {
            typedef typename __make_tuple_types<_Tuple>::type _TupleRef;
            typedef typename tuple_element<0, _TupleRef>::type _U0;
            typedef typename tuple_element<1, _TupleRef>::type _U1;
            first  = _STD::forward<_U0>(_STD::get<0>(__p));
            second = _STD::forward<_U1>(_STD::get<1>(__p));
            return *this;
        }

#endif  // _LIBCPP_HAS_NO_VARIADICS

#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
    template<class _U1, class _U2>
        _LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p)
            : first(__p.first), second(__p.second) {}
#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
    void _LIBCPP_INLINE_VISIBILITY swap(pair& __p) {_STD::swap(*this, __p);}
private:

#ifndef _LIBCPP_HAS_NO_VARIADICS
    template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
        pair(piecewise_construct_t,
             tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
             __tuple_indices<_I1...>, __tuple_indices<_I2...>);
#endif  // _LIBCPP_HAS_NO_VARIADICS
};

template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
{
    return __x.first == __y.first && __x.second == __y.second;
}

template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
{
    return !(__x == __y);
}

template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
{
    return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second);
}

template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
{
    return __y < __x;
}

template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
{
    return !(__x < __y);
}

template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
{
    return !(__y < __x);
}

template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
void
swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
{
    swap(__x.first, __y.first);
    swap(__x.second, __y.second);
}

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp> class reference_wrapper;

template <class _Tp>
struct ___make_pair_return
{
    typedef _Tp type;
};

template <class _Tp>
struct ___make_pair_return<reference_wrapper<_Tp>>
{
    typedef _Tp& type;
};

template <class _Tp>
struct __make_pair_return
{
    typedef typename ___make_pair_return<typename decay<_Tp>::type>::type type;
};

template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
pair<typename __make_pair_return<_T1>::type, typename __make_pair_return<_T2>::type>
make_pair(_T1&& __t1, _T2&& __t2)
{
    return pair<typename __make_pair_return<_T1>::type, typename __make_pair_return<_T2>::type>
               (_STD::forward<_T1>(__t1), _STD::forward<_T2>(__t2));
}

#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
pair<_T1,_T2>
make_pair(_T1 __x, _T2 __y)
{
    return pair<_T1, _T2>(__x, __y);
}

#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

#ifndef _LIBCPP_HAS_NO_VARIADICS

template <class _T1, class _T2>
  class _LIBCPP_VISIBLE tuple_size<pair<_T1, _T2> >
    : public integral_constant<size_t, 2> {};

template <class _T1, class _T2>
  class _LIBCPP_VISIBLE tuple_size<const pair<_T1, _T2> >
    : public integral_constant<size_t, 2> {};

template <class _T1, class _T2>
class _LIBCPP_VISIBLE tuple_element<0, pair<_T1, _T2> >
{
public:
    typedef _T1 type;
};

template <class _T1, class _T2>
class _LIBCPP_VISIBLE tuple_element<1, pair<_T1, _T2> >
{
public:
    typedef _T2 type;
};

template <class _T1, class _T2>
class _LIBCPP_VISIBLE tuple_element<0, const pair<_T1, _T2> >
{
public:
    typedef const _T1 type;
};

template <class _T1, class _T2>
class _LIBCPP_VISIBLE tuple_element<1, const pair<_T1, _T2> >
{
public:
    typedef const _T2 type;
};

template <size_t _Ip> struct __get_pair;

template <>
struct __get_pair<0>
{
    template <class _T1, class _T2>
    static
    _LIBCPP_INLINE_VISIBILITY
    _T1&
    get(pair<_T1, _T2>& __p) {return __p.first;}

    template <class _T1, class _T2>
    static
    _LIBCPP_INLINE_VISIBILITY
    const _T1&
    get(const pair<_T1, _T2>& __p) {return __p.first;}
};

template <>
struct __get_pair<1>
{
    template <class _T1, class _T2>
    static
    _LIBCPP_INLINE_VISIBILITY
    _T2&
    get(pair<_T1, _T2>& __p) {return __p.second;}

    template <class _T1, class _T2>
    static
    _LIBCPP_INLINE_VISIBILITY
    const _T2&
    get(const pair<_T1, _T2>& __p) {return __p.second;}
};

template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY inline
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>& __p)
{
    return __get_pair<_Ip>::get(__p);
}

template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY inline
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>& __p)
{
    return __get_pair<_Ip>::get(__p);
}

#endif  // _LIBCPP_HAS_NO_VARIADICS

_LIBCPP_END_NAMESPACE_STD

#endif  // _LIBCPP_UTILITY
