openbox lab initialized
This commit is contained in:
137
openflow/usr/include/c++/5/experimental/algorithm
Normal file
137
openflow/usr/include/c++/5/experimental/algorithm
Normal file
@@ -0,0 +1,137 @@
|
||||
// <experimental/algorithm> -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/algorithm
|
||||
* This is a TS C++ Library header.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_ALGORITHM
|
||||
#define _GLIBCXX_EXPERIMENTAL_ALGORITHM 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus <= 201103L
|
||||
# include <bits/c++14_warning.h>
|
||||
#else
|
||||
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
inline namespace fundamentals_v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
template<typename _ForwardIterator, typename _Searcher>
|
||||
inline _ForwardIterator
|
||||
search(_ForwardIterator __first, _ForwardIterator __last,
|
||||
const _Searcher& __searcher)
|
||||
{ return __searcher(__first, __last); }
|
||||
|
||||
#define __cpp_lib_experimental_sample 201402
|
||||
|
||||
/// Reservoir sampling algorithm.
|
||||
template<typename _InputIterator, typename _RandomAccessIterator,
|
||||
typename _Size, typename _UniformRandomNumberGenerator>
|
||||
_RandomAccessIterator
|
||||
__sample(_InputIterator __first, _InputIterator __last, input_iterator_tag,
|
||||
_RandomAccessIterator __out, random_access_iterator_tag,
|
||||
_Size __n, _UniformRandomNumberGenerator&& __g)
|
||||
{
|
||||
using __distrib_type = std::uniform_int_distribution<_Size>;
|
||||
using __param_type = typename __distrib_type::param_type;
|
||||
__distrib_type __d{};
|
||||
_Size __sample_sz = 0;
|
||||
while (__first != __last && __sample_sz != __n)
|
||||
__out[__sample_sz++] = *__first++;
|
||||
for (auto __pop_sz = __sample_sz; __first != __last;
|
||||
++__first, ++__pop_sz)
|
||||
{
|
||||
const auto __k = __d(__g, __param_type{0, __pop_sz});
|
||||
if (__k < __n)
|
||||
__out[__k] = *__first;
|
||||
}
|
||||
return __out + __sample_sz;
|
||||
}
|
||||
|
||||
/// Selection sampling algorithm.
|
||||
template<typename _ForwardIterator, typename _OutputIterator, typename _Cat,
|
||||
typename _Size, typename _UniformRandomNumberGenerator>
|
||||
_OutputIterator
|
||||
__sample(_ForwardIterator __first, _ForwardIterator __last,
|
||||
forward_iterator_tag,
|
||||
_OutputIterator __out, _Cat,
|
||||
_Size __n, _UniformRandomNumberGenerator&& __g)
|
||||
{
|
||||
using __distrib_type = std::uniform_int_distribution<_Size>;
|
||||
using __param_type = typename __distrib_type::param_type;
|
||||
__distrib_type __d{};
|
||||
_Size __unsampled_sz = std::distance(__first, __last);
|
||||
for (__n = std::min(__n, __unsampled_sz); __n != 0; ++__first)
|
||||
if (__d(__g, __param_type{0, --__unsampled_sz}) < __n)
|
||||
{
|
||||
*__out++ = *__first;
|
||||
--__n;
|
||||
}
|
||||
return __out;
|
||||
}
|
||||
|
||||
/// Take a random sample from a population.
|
||||
template<typename _PopulationIterator, typename _SampleIterator,
|
||||
typename _Distance, typename _UniformRandomNumberGenerator>
|
||||
_SampleIterator
|
||||
sample(_PopulationIterator __first, _PopulationIterator __last,
|
||||
_SampleIterator __out, _Distance __n,
|
||||
_UniformRandomNumberGenerator&& __g)
|
||||
{
|
||||
using __pop_cat = typename
|
||||
std::iterator_traits<_PopulationIterator>::iterator_category;
|
||||
using __samp_cat = typename
|
||||
std::iterator_traits<_SampleIterator>::iterator_category;
|
||||
|
||||
static_assert(
|
||||
__or_<is_convertible<__pop_cat, forward_iterator_tag>,
|
||||
is_convertible<__samp_cat, random_access_iterator_tag>>::value,
|
||||
"output range must use a RandomAccessIterator when input range"
|
||||
" does not meet the ForwardIterator requirements");
|
||||
|
||||
static_assert(is_integral<_Distance>::value,
|
||||
"sample size must be an integer type");
|
||||
|
||||
return std::experimental::__sample(
|
||||
__first, __last, __pop_cat{}, __out, __samp_cat{},
|
||||
__n, std::forward<_UniformRandomNumberGenerator>(__g));
|
||||
}
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#endif // C++14
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_ALGORITHM
|
||||
437
openflow/usr/include/c++/5/experimental/any
Normal file
437
openflow/usr/include/c++/5/experimental/any
Normal file
@@ -0,0 +1,437 @@
|
||||
// <experimental/any> -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/any
|
||||
* This is a TS C++ Library header.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_ANY
|
||||
#define _GLIBCXX_EXPERIMENTAL_ANY 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus <= 201103L
|
||||
# include <bits/c++14_warning.h>
|
||||
#else
|
||||
|
||||
#include <typeinfo>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
inline namespace fundamentals_v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/**
|
||||
* @defgroup any Type-safe container of any type
|
||||
* @ingroup experimental
|
||||
*
|
||||
* A type-safe container for single values of value types, as
|
||||
* described in n3804 "Any Library Proposal (Revision 3)".
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define __cpp_lib_experimental_any 201411
|
||||
|
||||
/**
|
||||
* @brief Exception class thrown by a failed @c any_cast
|
||||
* @ingroup exceptions
|
||||
*/
|
||||
class bad_any_cast : public bad_cast
|
||||
{
|
||||
public:
|
||||
virtual const char* what() const noexcept { return "bad any_cast"; }
|
||||
};
|
||||
|
||||
[[gnu::noreturn]] inline void __throw_bad_any_cast()
|
||||
{
|
||||
#if __cpp_exceptions
|
||||
throw bad_any_cast{};
|
||||
#else
|
||||
__builtin_abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A type-safe container of any type.
|
||||
*
|
||||
* An @c any object's state is either empty or it stores a contained object
|
||||
* of CopyConstructible type.
|
||||
*/
|
||||
class any
|
||||
{
|
||||
// Holds either pointer to a heap object or the contained object itself.
|
||||
union _Storage
|
||||
{
|
||||
void* _M_ptr;
|
||||
std::aligned_storage<sizeof(_M_ptr), sizeof(_M_ptr)>::type _M_buffer;
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Safe = is_trivially_copyable<_Tp>,
|
||||
bool _Fits = (sizeof(_Tp) <= sizeof(_Storage))>
|
||||
using _Internal = std::integral_constant<bool, _Safe::value && _Fits>;
|
||||
|
||||
template<typename _Tp>
|
||||
struct _Manager_internal; // uses small-object optimization
|
||||
|
||||
template<typename _Tp>
|
||||
struct _Manager_external; // creates contained object on the heap
|
||||
|
||||
template<typename _Tp>
|
||||
using _Manager = conditional_t<_Internal<_Tp>::value,
|
||||
_Manager_internal<_Tp>,
|
||||
_Manager_external<_Tp>>;
|
||||
|
||||
template<typename _Tp, typename _Decayed = decay_t<_Tp>>
|
||||
using _Decay = enable_if_t<!is_same<_Decayed, any>::value, _Decayed>;
|
||||
|
||||
public:
|
||||
// construct/destruct
|
||||
|
||||
/// Default constructor, creates an empty object.
|
||||
any() noexcept : _M_manager(nullptr) { }
|
||||
|
||||
/// Copy constructor, copies the state of @p __other
|
||||
any(const any& __other) : _M_manager(__other._M_manager)
|
||||
{
|
||||
if (!__other.empty())
|
||||
{
|
||||
_Arg __arg;
|
||||
__arg._M_any = this;
|
||||
_M_manager(_Op_clone, &__other, &__arg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Move constructor, transfer the state from @p __other
|
||||
*
|
||||
* @post @c __other.empty() (not guaranteed for other implementations)
|
||||
*/
|
||||
any(any&& __other) noexcept
|
||||
: _M_manager(__other._M_manager),
|
||||
_M_storage(__other._M_storage)
|
||||
{ __other._M_manager = nullptr; }
|
||||
|
||||
/// Construct with a copy of @p __value as the contained object.
|
||||
template <typename _ValueType, typename _Tp = _Decay<_ValueType>,
|
||||
typename _Mgr = _Manager<_Tp>>
|
||||
any(_ValueType&& __value)
|
||||
: _M_manager(&_Mgr::_S_manage),
|
||||
_M_storage(_Mgr::_S_create(std::forward<_ValueType>(__value)))
|
||||
{
|
||||
static_assert(is_copy_constructible<_Tp>::value,
|
||||
"The contained object must be CopyConstructible");
|
||||
}
|
||||
|
||||
/// Destructor, calls @c clear()
|
||||
~any() { clear(); }
|
||||
|
||||
// assignments
|
||||
|
||||
/// Copy the state of
|
||||
any& operator=(const any& __rhs)
|
||||
{
|
||||
any(__rhs).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator
|
||||
*
|
||||
* @post @c __rhs.empty() (not guaranteed for other implementations)
|
||||
*/
|
||||
any& operator=(any&& __rhs) noexcept
|
||||
{
|
||||
any(std::move(__rhs)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Store a copy of @p __rhs as the contained object.
|
||||
template<typename _ValueType>
|
||||
any& operator=(_ValueType&& __rhs)
|
||||
{
|
||||
any(std::forward<_ValueType>(__rhs)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// modifiers
|
||||
|
||||
/// If not empty, destroy the contained object.
|
||||
void clear() noexcept
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
_M_manager(_Op_destroy, this, nullptr);
|
||||
_M_manager = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/// Exchange state with another object.
|
||||
void swap(any& __rhs) noexcept
|
||||
{
|
||||
std::swap(_M_manager, __rhs._M_manager);
|
||||
std::swap(_M_storage, __rhs._M_storage);
|
||||
}
|
||||
|
||||
// observers
|
||||
|
||||
/// Reports whether there is a contained object or not.
|
||||
bool empty() const noexcept { return _M_manager == nullptr; }
|
||||
|
||||
#if __cpp_rtti
|
||||
/// The @c typeid of the contained object, or @c typeid(void) if empty.
|
||||
const type_info& type() const noexcept
|
||||
{
|
||||
if (empty())
|
||||
return typeid(void);
|
||||
_Arg __arg;
|
||||
_M_manager(_Op_get_type_info, this, &__arg);
|
||||
return *__arg._M_typeinfo;
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename _Tp>
|
||||
static constexpr bool __is_valid_cast()
|
||||
{ return __or_<is_reference<_Tp>, is_copy_constructible<_Tp>>::value; }
|
||||
|
||||
private:
|
||||
enum _Op { _Op_access, _Op_get_type_info, _Op_clone, _Op_destroy };
|
||||
|
||||
union _Arg
|
||||
{
|
||||
void* _M_obj;
|
||||
const std::type_info* _M_typeinfo;
|
||||
any* _M_any;
|
||||
};
|
||||
|
||||
void (*_M_manager)(_Op, const any*, _Arg*);
|
||||
_Storage _M_storage;
|
||||
|
||||
template<typename _Tp>
|
||||
friend void* __any_caster(const any* __any)
|
||||
{
|
||||
if (__any->_M_manager != &_Manager<decay_t<_Tp>>::_S_manage)
|
||||
return nullptr;
|
||||
_Arg __arg;
|
||||
__any->_M_manager(_Op_access, __any, &__arg);
|
||||
return __arg._M_obj;
|
||||
}
|
||||
|
||||
// Manage in-place contained object.
|
||||
template<typename _Tp>
|
||||
struct _Manager_internal
|
||||
{
|
||||
static void
|
||||
_S_manage(_Op __which, const any* __anyp, _Arg* __arg);
|
||||
|
||||
template<typename _Up>
|
||||
static _Storage
|
||||
_S_create(_Up&& __value)
|
||||
{
|
||||
_Storage __storage;
|
||||
void* __addr = &__storage._M_buffer;
|
||||
::new (__addr) _Tp(std::forward<_Up>(__value));
|
||||
return __storage;
|
||||
}
|
||||
|
||||
template<typename _Alloc, typename _Up>
|
||||
static _Storage
|
||||
_S_alloc(const _Alloc&, _Up&& __value)
|
||||
{
|
||||
return _S_create(std::forward<_Up>(__value));
|
||||
}
|
||||
};
|
||||
|
||||
// Manage external contained object.
|
||||
template<typename _Tp>
|
||||
struct _Manager_external
|
||||
{
|
||||
static void
|
||||
_S_manage(_Op __which, const any* __anyp, _Arg* __arg);
|
||||
|
||||
template<typename _Up>
|
||||
static _Storage
|
||||
_S_create(_Up&& __value)
|
||||
{
|
||||
_Storage __storage;
|
||||
__storage._M_ptr = new _Tp(std::forward<_Up>(__value));
|
||||
return __storage;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// Exchange the states of two @c any objects.
|
||||
inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); }
|
||||
|
||||
/**
|
||||
* @brief Access the contained object.
|
||||
*
|
||||
* @tparam _ValueType A const-reference or CopyConstructible type.
|
||||
* @param __any The object to access.
|
||||
* @return The contained object.
|
||||
* @throw bad_any_cast If <code>
|
||||
* __any.type() != typeid(remove_reference_t<_ValueType>)
|
||||
* </code>
|
||||
*/
|
||||
template<typename _ValueType>
|
||||
inline _ValueType any_cast(const any& __any)
|
||||
{
|
||||
static_assert(any::__is_valid_cast<_ValueType>(),
|
||||
"Template argument must be a reference or CopyConstructible type");
|
||||
auto __p = any_cast<add_const_t<remove_reference_t<_ValueType>>>(&__any);
|
||||
if (__p)
|
||||
return *__p;
|
||||
__throw_bad_any_cast();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Access the contained object.
|
||||
*
|
||||
* @tparam _ValueType A reference or CopyConstructible type.
|
||||
* @param __any The object to access.
|
||||
* @return The contained object.
|
||||
* @throw bad_any_cast If <code>
|
||||
* __any.type() != typeid(remove_reference_t<_ValueType>)
|
||||
* </code>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
template<typename _ValueType>
|
||||
inline _ValueType any_cast(any& __any)
|
||||
{
|
||||
static_assert(any::__is_valid_cast<_ValueType>(),
|
||||
"Template argument must be a reference or CopyConstructible type");
|
||||
auto __p = any_cast<remove_reference_t<_ValueType>>(&__any);
|
||||
if (__p)
|
||||
return *__p;
|
||||
__throw_bad_any_cast();
|
||||
}
|
||||
|
||||
template<typename _ValueType>
|
||||
inline _ValueType any_cast(any&& __any)
|
||||
{
|
||||
static_assert(any::__is_valid_cast<_ValueType>(),
|
||||
"Template argument must be a reference or CopyConstructible type");
|
||||
auto __p = any_cast<remove_reference_t<_ValueType>>(&__any);
|
||||
if (__p)
|
||||
return *__p;
|
||||
__throw_bad_any_cast();
|
||||
}
|
||||
// @}
|
||||
|
||||
/**
|
||||
* @brief Access the contained object.
|
||||
*
|
||||
* @tparam _ValueType The type of the contained object.
|
||||
* @param __any A pointer to the object to access.
|
||||
* @return The address of the contained object if <code>
|
||||
* __any != nullptr && __any.type() == typeid(_ValueType)
|
||||
* </code>, otherwise a null pointer.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
template<typename _ValueType>
|
||||
inline const _ValueType* any_cast(const any* __any) noexcept
|
||||
{
|
||||
if (__any)
|
||||
return static_cast<_ValueType*>(__any_caster<_ValueType>(__any));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template<typename _ValueType>
|
||||
inline _ValueType* any_cast(any* __any) noexcept
|
||||
{
|
||||
if (__any)
|
||||
return static_cast<_ValueType*>(__any_caster<_ValueType>(__any));
|
||||
return nullptr;
|
||||
}
|
||||
// @}
|
||||
|
||||
template<typename _Tp>
|
||||
void
|
||||
any::_Manager_internal<_Tp>::
|
||||
_S_manage(_Op __which, const any* __any, _Arg* __arg)
|
||||
{
|
||||
// The contained object is in _M_storage._M_buffer
|
||||
auto __ptr = reinterpret_cast<const _Tp*>(&__any->_M_storage._M_buffer);
|
||||
switch (__which)
|
||||
{
|
||||
case _Op_access:
|
||||
__arg->_M_obj = const_cast<_Tp*>(__ptr);
|
||||
break;
|
||||
case _Op_get_type_info:
|
||||
#if __cpp_rtti
|
||||
__arg->_M_typeinfo = &typeid(_Tp);
|
||||
#endif
|
||||
break;
|
||||
case _Op_clone:
|
||||
::new(&__arg->_M_any->_M_storage._M_buffer) _Tp(*__ptr);
|
||||
break;
|
||||
case _Op_destroy:
|
||||
__ptr->~_Tp();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
void
|
||||
any::_Manager_external<_Tp>::
|
||||
_S_manage(_Op __which, const any* __any, _Arg* __arg)
|
||||
{
|
||||
// The contained object is *_M_storage._M_ptr
|
||||
auto __ptr = static_cast<const _Tp*>(__any->_M_storage._M_ptr);
|
||||
switch (__which)
|
||||
{
|
||||
case _Op_access:
|
||||
__arg->_M_obj = const_cast<_Tp*>(__ptr);
|
||||
break;
|
||||
case _Op_get_type_info:
|
||||
#if __cpp_rtti
|
||||
__arg->_M_typeinfo = &typeid(_Tp);
|
||||
#endif
|
||||
break;
|
||||
case _Op_clone:
|
||||
__arg->_M_any->_M_storage._M_ptr = new _Tp(*__ptr);
|
||||
break;
|
||||
case _Op_destroy:
|
||||
delete __ptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// @} group any
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#endif // C++14
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_ANY
|
||||
65
openflow/usr/include/c++/5/experimental/chrono
Normal file
65
openflow/usr/include/c++/5/experimental/chrono
Normal file
@@ -0,0 +1,65 @@
|
||||
// Variable Templates For chrono -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/chrono
|
||||
* This is a TS C++ Library header.
|
||||
*/
|
||||
|
||||
//
|
||||
// N3932 Variable Templates For Type Traits (Revision 1)
|
||||
//
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_CHRONO
|
||||
#define _GLIBCXX_EXPERIMENTAL_CHRONO 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus <= 201103L
|
||||
# include <bits/c++14_warning.h>
|
||||
#else
|
||||
|
||||
#include <chrono>
|
||||
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace chrono {
|
||||
namespace experimental
|
||||
{
|
||||
inline namespace fundamentals_v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
// See C++14 §20.12.4, customization traits
|
||||
template <typename _Rep>
|
||||
constexpr bool treat_as_floating_point_v =
|
||||
treat_as_floating_point<_Rep>::value;
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace chrono
|
||||
} // namespace std
|
||||
|
||||
#endif // __cplusplus <= 201103L
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_CHRONO
|
||||
77
openflow/usr/include/c++/5/experimental/filesystem
Normal file
77
openflow/usr/include/c++/5/experimental/filesystem
Normal file
@@ -0,0 +1,77 @@
|
||||
// <experimental/filesystem> -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/filesystem
|
||||
* This is a TS C++ Library header.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_FILESYSTEM
|
||||
#define _GLIBCXX_EXPERIMENTAL_FILESYSTEM 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
# include <bits/c++0x_warning.h>
|
||||
#else
|
||||
|
||||
#include <experimental/fs_fwd.h>
|
||||
#include <experimental/fs_path.h>
|
||||
#include <experimental/fs_dir.h>
|
||||
#include <experimental/fs_ops.h>
|
||||
|
||||
#define __cpp_lib_experimental_filesystem 201406
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
namespace filesystem
|
||||
{
|
||||
inline namespace v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/**
|
||||
* @ingroup filesystem
|
||||
*/
|
||||
inline std::string filesystem_error::_M_gen_what()
|
||||
{
|
||||
std::string __what = "filesystem error: ";
|
||||
__what += system_error::what();
|
||||
if (!_M_path1.empty())
|
||||
__what += " [" + _M_path1.string() + ']';
|
||||
if (!_M_path2.empty())
|
||||
__what += " [" + _M_path2.string() + ']';
|
||||
return __what;
|
||||
}
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace v1
|
||||
} // namespace filesystem
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#endif // C++11
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_FILESYSTEM
|
||||
338
openflow/usr/include/c++/5/experimental/fs_dir.h
Normal file
338
openflow/usr/include/c++/5/experimental/fs_dir.h
Normal file
@@ -0,0 +1,338 @@
|
||||
// Filesystem directory utilities -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/fs_dir.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{experimental/filesystem}
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_FS_DIR_H
|
||||
#define _GLIBCXX_EXPERIMENTAL_FS_DIR_H 1
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
# include <bits/c++0x_warning.h>
|
||||
#else
|
||||
# include <typeinfo>
|
||||
# include <ext/concurrence.h>
|
||||
# include <bits/unique_ptr.h>
|
||||
# include <bits/shared_ptr.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
namespace filesystem
|
||||
{
|
||||
inline namespace v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/**
|
||||
* @ingroup filesystem
|
||||
* @{
|
||||
*/
|
||||
|
||||
class file_status
|
||||
{
|
||||
public:
|
||||
// constructors
|
||||
explicit
|
||||
file_status(file_type __ft = file_type::none,
|
||||
perms __prms = perms::unknown) noexcept
|
||||
: _M_type(__ft), _M_perms(__prms) { }
|
||||
|
||||
file_status(const file_status&) noexcept = default;
|
||||
file_status(file_status&&) noexcept = default;
|
||||
~file_status() = default;
|
||||
|
||||
file_status& operator=(const file_status&) noexcept = default;
|
||||
file_status& operator=(file_status&&) noexcept = default;
|
||||
|
||||
// observers
|
||||
file_type type() const noexcept { return _M_type; }
|
||||
perms permissions() const noexcept { return _M_perms; }
|
||||
|
||||
// modifiers
|
||||
void type(file_type __ft) noexcept { _M_type = __ft; }
|
||||
void permissions(perms __prms) noexcept { _M_perms = __prms; }
|
||||
|
||||
private:
|
||||
file_type _M_type;
|
||||
perms _M_perms;
|
||||
};
|
||||
|
||||
_GLIBCXX_BEGIN_NAMESPACE_CXX11
|
||||
|
||||
class directory_entry
|
||||
{
|
||||
public:
|
||||
// constructors and destructor
|
||||
directory_entry() noexcept = default;
|
||||
directory_entry(const directory_entry&) = default;
|
||||
directory_entry(directory_entry&&) noexcept = default;
|
||||
explicit directory_entry(const filesystem::path& __p) : _M_path(__p) { }
|
||||
~directory_entry() = default;
|
||||
|
||||
// modifiers
|
||||
directory_entry& operator=(const directory_entry&) = default;
|
||||
directory_entry& operator=(directory_entry&&) noexcept = default;
|
||||
|
||||
void assign(const filesystem::path& __p) { _M_path = __p; }
|
||||
|
||||
void
|
||||
replace_filename(const filesystem::path& __p)
|
||||
{ _M_path = _M_path.parent_path() / __p; }
|
||||
|
||||
// observers
|
||||
const filesystem::path& path() const noexcept { return _M_path; }
|
||||
operator const filesystem::path&() const noexcept { return _M_path; }
|
||||
|
||||
file_status
|
||||
status() const
|
||||
{ return filesystem::status(_M_path); }
|
||||
|
||||
file_status
|
||||
status(error_code& __ec) const noexcept
|
||||
{ return filesystem::status(_M_path, __ec); }
|
||||
|
||||
file_status
|
||||
symlink_status() const
|
||||
{ return filesystem::symlink_status(_M_path); }
|
||||
|
||||
file_status
|
||||
symlink_status(error_code& __ec) const noexcept
|
||||
{ return filesystem::symlink_status(_M_path, __ec); }
|
||||
|
||||
bool
|
||||
operator< (const directory_entry& __rhs) const noexcept
|
||||
{ return _M_path < __rhs._M_path; }
|
||||
|
||||
bool
|
||||
operator==(const directory_entry& __rhs) const noexcept
|
||||
{ return _M_path == __rhs._M_path; }
|
||||
|
||||
bool
|
||||
operator!=(const directory_entry& __rhs) const noexcept
|
||||
{ return _M_path != __rhs._M_path; }
|
||||
|
||||
bool
|
||||
operator<=(const directory_entry& __rhs) const noexcept
|
||||
{ return _M_path <= __rhs._M_path; }
|
||||
|
||||
bool
|
||||
operator> (const directory_entry& __rhs) const noexcept
|
||||
{ return _M_path > __rhs._M_path; }
|
||||
|
||||
bool
|
||||
operator>=(const directory_entry& __rhs) const noexcept
|
||||
{ return _M_path >= __rhs._M_path; }
|
||||
|
||||
private:
|
||||
filesystem::path _M_path;
|
||||
};
|
||||
|
||||
struct _Dir;
|
||||
class recursive_directory_iterator;
|
||||
|
||||
class directory_iterator
|
||||
{
|
||||
public:
|
||||
typedef directory_entry value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef const directory_entry* pointer;
|
||||
typedef const directory_entry& reference;
|
||||
typedef input_iterator_tag iterator_category;
|
||||
|
||||
directory_iterator() noexcept = default;
|
||||
|
||||
explicit
|
||||
directory_iterator(const path& __p)
|
||||
: directory_iterator(__p, directory_options::none, nullptr) { }
|
||||
|
||||
directory_iterator(const path& __p, directory_options __options)
|
||||
: directory_iterator(__p, __options, nullptr) { }
|
||||
|
||||
directory_iterator(const path& __p, error_code& __ec) noexcept
|
||||
: directory_iterator(__p, directory_options::none, __ec) { }
|
||||
|
||||
directory_iterator(const path& __p,
|
||||
directory_options __options, error_code& __ec) noexcept
|
||||
: directory_iterator(__p, __options, &__ec) { }
|
||||
|
||||
directory_iterator(const directory_iterator& __rhs) = default;
|
||||
|
||||
directory_iterator(directory_iterator&& __rhs) noexcept = default;
|
||||
|
||||
~directory_iterator() = default;
|
||||
|
||||
directory_iterator& operator=(const directory_iterator& __rhs) = default;
|
||||
directory_iterator& operator=(directory_iterator&& __rhs) noexcept = default;
|
||||
|
||||
const directory_entry& operator*() const;
|
||||
const directory_entry* operator->() const { return &**this; }
|
||||
directory_iterator& operator++();
|
||||
directory_iterator& increment(error_code& __ec) noexcept;
|
||||
|
||||
directory_iterator operator++(int)
|
||||
{
|
||||
auto __tmp = *this;
|
||||
++*this;
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
private:
|
||||
directory_iterator(const path&, directory_options, error_code*);
|
||||
|
||||
friend bool
|
||||
operator==(const directory_iterator& __lhs,
|
||||
const directory_iterator& __rhs);
|
||||
|
||||
friend class recursive_directory_iterator;
|
||||
|
||||
std::shared_ptr<_Dir> _M_dir;
|
||||
};
|
||||
|
||||
inline directory_iterator
|
||||
begin(directory_iterator __iter) { return __iter; }
|
||||
|
||||
inline directory_iterator
|
||||
end(directory_iterator) { return directory_iterator(); }
|
||||
|
||||
inline bool
|
||||
operator==(const directory_iterator& __lhs, const directory_iterator& __rhs)
|
||||
{
|
||||
return !__rhs._M_dir.owner_before(__lhs._M_dir)
|
||||
&& !__lhs._M_dir.owner_before(__rhs._M_dir);
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs)
|
||||
{ return !(__lhs == __rhs); }
|
||||
|
||||
class recursive_directory_iterator
|
||||
{
|
||||
public:
|
||||
typedef directory_entry value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef const directory_entry* pointer;
|
||||
typedef const directory_entry& reference;
|
||||
typedef input_iterator_tag iterator_category;
|
||||
|
||||
recursive_directory_iterator() noexcept = default;
|
||||
|
||||
explicit
|
||||
recursive_directory_iterator(const path& __p)
|
||||
: recursive_directory_iterator(__p, directory_options::none, nullptr) { }
|
||||
|
||||
recursive_directory_iterator(const path& __p, directory_options __options)
|
||||
: recursive_directory_iterator(__p, __options, nullptr) { }
|
||||
|
||||
recursive_directory_iterator(const path& __p,
|
||||
directory_options __options,
|
||||
error_code& __ec) noexcept
|
||||
: recursive_directory_iterator(__p, __options, &__ec) { }
|
||||
|
||||
recursive_directory_iterator(const path& __p, error_code& __ec) noexcept
|
||||
: recursive_directory_iterator(__p, directory_options::none, &__ec) { }
|
||||
|
||||
recursive_directory_iterator(
|
||||
const recursive_directory_iterator&) = default;
|
||||
|
||||
recursive_directory_iterator(
|
||||
recursive_directory_iterator&&) noexcept = default;
|
||||
|
||||
~recursive_directory_iterator();
|
||||
|
||||
// observers
|
||||
directory_options options() const { return _M_options; }
|
||||
int depth() const;
|
||||
bool recursion_pending() const { return _M_pending; }
|
||||
|
||||
const directory_entry& operator*() const;
|
||||
const directory_entry* operator->() const { return &**this; }
|
||||
|
||||
// modifiers
|
||||
recursive_directory_iterator&
|
||||
operator=(const recursive_directory_iterator& __rhs) noexcept;
|
||||
recursive_directory_iterator&
|
||||
operator=(recursive_directory_iterator&& __rhs) noexcept;
|
||||
|
||||
recursive_directory_iterator& operator++();
|
||||
recursive_directory_iterator& increment(error_code& __ec) noexcept;
|
||||
|
||||
recursive_directory_iterator operator++(int)
|
||||
{
|
||||
auto __tmp = *this;
|
||||
++*this;
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
void pop();
|
||||
|
||||
void disable_recursion_pending() { _M_pending = false; }
|
||||
|
||||
private:
|
||||
recursive_directory_iterator(const path&, directory_options, error_code*);
|
||||
|
||||
friend bool
|
||||
operator==(const recursive_directory_iterator& __lhs,
|
||||
const recursive_directory_iterator& __rhs);
|
||||
|
||||
struct _Dir_stack;
|
||||
std::shared_ptr<_Dir_stack> _M_dirs;
|
||||
directory_options _M_options;
|
||||
bool _M_pending;
|
||||
};
|
||||
|
||||
inline recursive_directory_iterator
|
||||
begin(recursive_directory_iterator __iter) { return __iter; }
|
||||
|
||||
inline recursive_directory_iterator
|
||||
end(recursive_directory_iterator) { return recursive_directory_iterator(); }
|
||||
|
||||
inline bool
|
||||
operator==(const recursive_directory_iterator& __lhs,
|
||||
const recursive_directory_iterator& __rhs)
|
||||
{
|
||||
return !__rhs._M_dirs.owner_before(__lhs._M_dirs)
|
||||
&& !__lhs._M_dirs.owner_before(__rhs._M_dirs);
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator!=(const recursive_directory_iterator& __lhs,
|
||||
const recursive_directory_iterator& __rhs)
|
||||
{ return !(__lhs == __rhs); }
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_CXX11
|
||||
|
||||
// @} group filesystem
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace v1
|
||||
} // namespace filesystem
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#endif // C++11
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_FS_DIR_H
|
||||
290
openflow/usr/include/c++/5/experimental/fs_fwd.h
Normal file
290
openflow/usr/include/c++/5/experimental/fs_fwd.h
Normal file
@@ -0,0 +1,290 @@
|
||||
// Filesystem declarations -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/fs_fwd.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{experimental/filesystem}
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_FS_FWD_H
|
||||
#define _GLIBCXX_EXPERIMENTAL_FS_FWD_H 1
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
# include <bits/c++0x_warning.h>
|
||||
#else
|
||||
|
||||
#include <system_error>
|
||||
#include <cstdint>
|
||||
#include <chrono>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
namespace filesystem
|
||||
{
|
||||
inline namespace v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
#if _GLIBCXX_USE_CXX11_ABI
|
||||
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup filesystem Filesystem
|
||||
* @ingroup experimental
|
||||
*
|
||||
* Utilities for performing operations on file systems and their components,
|
||||
* such as paths, regular files, and directories.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
class file_status;
|
||||
_GLIBCXX_BEGIN_NAMESPACE_CXX11
|
||||
class path;
|
||||
class filesystem_error;
|
||||
class directory_entry;
|
||||
class directory_iterator;
|
||||
class recursive_directory_iterator;
|
||||
_GLIBCXX_END_NAMESPACE_CXX11
|
||||
|
||||
struct space_info
|
||||
{
|
||||
uintmax_t capacity;
|
||||
uintmax_t free;
|
||||
uintmax_t available;
|
||||
};
|
||||
|
||||
enum class file_type : signed char {
|
||||
none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3,
|
||||
block = 4, character = 5, fifo = 6, socket = 7, unknown = 8
|
||||
};
|
||||
|
||||
/// Bitmask type
|
||||
enum class copy_options : unsigned short {
|
||||
none = 0,
|
||||
skip_existing = 1, overwrite_existing = 2, update_existing = 4,
|
||||
recursive = 8,
|
||||
copy_symlinks = 16, skip_symlinks = 32,
|
||||
directories_only = 64, create_symlinks = 128, create_hard_links = 256
|
||||
};
|
||||
|
||||
constexpr copy_options
|
||||
operator&(copy_options __x, copy_options __y)
|
||||
{
|
||||
using __utype = typename std::underlying_type<copy_options>::type;
|
||||
return static_cast<copy_options>(
|
||||
static_cast<__utype>(__x) & static_cast<__utype>(__y));
|
||||
}
|
||||
|
||||
constexpr copy_options
|
||||
operator|(copy_options __x, copy_options __y)
|
||||
{
|
||||
using __utype = typename std::underlying_type<copy_options>::type;
|
||||
return static_cast<copy_options>(
|
||||
static_cast<__utype>(__x) | static_cast<__utype>(__y));
|
||||
}
|
||||
|
||||
constexpr copy_options
|
||||
operator^(copy_options __x, copy_options __y)
|
||||
{
|
||||
using __utype = typename std::underlying_type<copy_options>::type;
|
||||
return static_cast<copy_options>(
|
||||
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
|
||||
}
|
||||
|
||||
constexpr copy_options
|
||||
operator~(copy_options __x)
|
||||
{
|
||||
using __utype = typename std::underlying_type<copy_options>::type;
|
||||
return static_cast<copy_options>(~static_cast<__utype>(__x));
|
||||
}
|
||||
|
||||
inline copy_options&
|
||||
operator&=(copy_options& __x, copy_options __y)
|
||||
{ return __x = __x & __y; }
|
||||
|
||||
inline copy_options&
|
||||
operator|=(copy_options& __x, copy_options __y)
|
||||
{ return __x = __x | __y; }
|
||||
|
||||
inline copy_options&
|
||||
operator^=(copy_options& __x, copy_options __y)
|
||||
{ return __x = __x ^ __y; }
|
||||
|
||||
|
||||
/// Bitmask type
|
||||
enum class perms : unsigned {
|
||||
none = 0,
|
||||
owner_read = 0400,
|
||||
owner_write = 0200,
|
||||
owner_exec = 0100,
|
||||
owner_all = 0700,
|
||||
group_read = 040,
|
||||
group_write = 020,
|
||||
group_exec = 010,
|
||||
group_all = 070,
|
||||
others_read = 04,
|
||||
others_write = 02,
|
||||
others_exec = 01,
|
||||
others_all = 07,
|
||||
all = 0777,
|
||||
set_uid = 04000,
|
||||
set_gid = 02000,
|
||||
sticky_bit = 01000,
|
||||
mask = 07777,
|
||||
unknown = 0xFFFF,
|
||||
add_perms = 0x10000,
|
||||
remove_perms = 0x20000,
|
||||
resolve_symlinks = 0x40000
|
||||
};
|
||||
|
||||
constexpr perms
|
||||
operator&(perms __x, perms __y)
|
||||
{
|
||||
using __utype = typename std::underlying_type<perms>::type;
|
||||
return static_cast<perms>(
|
||||
static_cast<__utype>(__x) & static_cast<__utype>(__y));
|
||||
}
|
||||
|
||||
constexpr perms
|
||||
operator|(perms __x, perms __y)
|
||||
{
|
||||
using __utype = typename std::underlying_type<perms>::type;
|
||||
return static_cast<perms>(
|
||||
static_cast<__utype>(__x) | static_cast<__utype>(__y));
|
||||
}
|
||||
|
||||
constexpr perms
|
||||
operator^(perms __x, perms __y)
|
||||
{
|
||||
using __utype = typename std::underlying_type<perms>::type;
|
||||
return static_cast<perms>(
|
||||
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
|
||||
}
|
||||
|
||||
constexpr perms
|
||||
operator~(perms __x)
|
||||
{
|
||||
using __utype = typename std::underlying_type<perms>::type;
|
||||
return static_cast<perms>(~static_cast<__utype>(__x));
|
||||
}
|
||||
|
||||
inline perms&
|
||||
operator&=(perms& __x, perms __y)
|
||||
{ return __x = __x & __y; }
|
||||
|
||||
inline perms&
|
||||
operator|=(perms& __x, perms __y)
|
||||
{ return __x = __x | __y; }
|
||||
|
||||
inline perms&
|
||||
operator^=(perms& __x, perms __y)
|
||||
{ return __x = __x ^ __y; }
|
||||
|
||||
// Bitmask type
|
||||
enum class directory_options : unsigned char {
|
||||
none = 0, follow_directory_symlink = 1, skip_permission_denied = 2
|
||||
};
|
||||
|
||||
constexpr directory_options
|
||||
operator&(directory_options __x, directory_options __y)
|
||||
{
|
||||
using __utype = typename std::underlying_type<directory_options>::type;
|
||||
return static_cast<directory_options>(
|
||||
static_cast<__utype>(__x) & static_cast<__utype>(__y));
|
||||
}
|
||||
|
||||
constexpr directory_options
|
||||
operator|(directory_options __x, directory_options __y)
|
||||
{
|
||||
using __utype = typename std::underlying_type<directory_options>::type;
|
||||
return static_cast<directory_options>(
|
||||
static_cast<__utype>(__x) | static_cast<__utype>(__y));
|
||||
}
|
||||
|
||||
constexpr directory_options
|
||||
operator^(directory_options __x, directory_options __y)
|
||||
{
|
||||
using __utype = typename std::underlying_type<directory_options>::type;
|
||||
return static_cast<directory_options>(
|
||||
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
|
||||
}
|
||||
|
||||
constexpr directory_options
|
||||
operator~(directory_options __x)
|
||||
{
|
||||
using __utype = typename std::underlying_type<directory_options>::type;
|
||||
return static_cast<directory_options>(~static_cast<__utype>(__x));
|
||||
}
|
||||
|
||||
inline directory_options&
|
||||
operator&=(directory_options& __x, directory_options __y)
|
||||
{ return __x = __x & __y; }
|
||||
|
||||
inline directory_options&
|
||||
operator|=(directory_options& __x, directory_options __y)
|
||||
{ return __x = __x | __y; }
|
||||
|
||||
inline directory_options&
|
||||
operator^=(directory_options& __x, directory_options __y)
|
||||
{ return __x = __x ^ __y; }
|
||||
|
||||
typedef chrono::time_point<chrono::system_clock> file_time_type;
|
||||
|
||||
// operational functions
|
||||
|
||||
void copy(const path& __from, const path& __to, copy_options __options);
|
||||
void copy(const path& __from, const path& __to, copy_options __options,
|
||||
error_code&) noexcept;
|
||||
|
||||
bool copy_file(const path& __from, const path& __to, copy_options __option);
|
||||
bool copy_file(const path& __from, const path& __to, copy_options __option,
|
||||
error_code&) noexcept;
|
||||
|
||||
path current_path();
|
||||
|
||||
file_status status(const path&);
|
||||
file_status status(const path&, error_code&) noexcept;
|
||||
|
||||
bool status_known(file_status) noexcept;
|
||||
|
||||
file_status symlink_status(const path&);
|
||||
file_status symlink_status(const path&, error_code&) noexcept;
|
||||
|
||||
bool is_regular_file(file_status) noexcept;
|
||||
bool is_symlink(file_status) noexcept;
|
||||
|
||||
// @} group filesystem
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace v1
|
||||
} // namespace filesystem
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#endif // C++11
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_FS_FWD_H
|
||||
292
openflow/usr/include/c++/5/experimental/fs_ops.h
Normal file
292
openflow/usr/include/c++/5/experimental/fs_ops.h
Normal file
@@ -0,0 +1,292 @@
|
||||
// Filesystem operational functions -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your __option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/fs_fwd.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{experimental/filesystem}
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_FS_OPS_H
|
||||
#define _GLIBCXX_EXPERIMENTAL_FS_OPS_H 1
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
# include <bits/c++0x_warning.h>
|
||||
#else
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
namespace filesystem
|
||||
{
|
||||
inline namespace v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/**
|
||||
* @ingroup filesystem
|
||||
* @{
|
||||
*/
|
||||
|
||||
path absolute(const path& __p, const path& __base = current_path());
|
||||
|
||||
path canonical(const path& __p, const path& __base = current_path());
|
||||
path canonical(const path& __p, error_code& __ec);
|
||||
path canonical(const path& __p, const path& __base, error_code& __ec);
|
||||
|
||||
inline void
|
||||
copy(const path& __from, const path& __to)
|
||||
{ copy(__from, __to, copy_options::none); }
|
||||
|
||||
inline void
|
||||
copy(const path& __from, const path& __to, error_code& __ec) noexcept
|
||||
{ copy(__from, __to, copy_options::none, __ec); }
|
||||
|
||||
void copy(const path& __from, const path& __to, copy_options __options);
|
||||
void copy(const path& __from, const path& __to, copy_options __options,
|
||||
error_code& __ec) noexcept;
|
||||
|
||||
inline bool
|
||||
copy_file(const path& __from, const path& __to)
|
||||
{ return copy_file(__from, __to, copy_options::none); }
|
||||
|
||||
inline bool
|
||||
copy_file(const path& __from, const path& __to, error_code& __ec) noexcept
|
||||
{ return copy_file(__from, __to, copy_options::none, __ec); }
|
||||
|
||||
bool copy_file(const path& __from, const path& __to, copy_options __option);
|
||||
bool copy_file(const path& __from, const path& __to, copy_options __option,
|
||||
error_code& __ec) noexcept;
|
||||
|
||||
void copy_symlink(const path& __existing_symlink, const path& __new_symlink);
|
||||
void copy_symlink(const path& __existing_symlink, const path& __new_symlink,
|
||||
error_code& __ec) noexcept;
|
||||
|
||||
bool create_directories(const path& __p);
|
||||
bool create_directories(const path& __p, error_code& __ec) noexcept;
|
||||
|
||||
bool create_directory(const path& __p);
|
||||
bool create_directory(const path& __p, error_code& __ec) noexcept;
|
||||
|
||||
bool create_directory(const path& __p, const path& attributes);
|
||||
bool create_directory(const path& __p, const path& attributes,
|
||||
error_code& __ec) noexcept;
|
||||
|
||||
void create_directory_symlink(const path& __to, const path& __new_symlink);
|
||||
void create_directory_symlink(const path& __to, const path& __new_symlink,
|
||||
error_code& __ec) noexcept;
|
||||
|
||||
void create_hard_link(const path& __to, const path& __new_hard_link);
|
||||
void create_hard_link(const path& __to, const path& __new_hard_link,
|
||||
error_code& __ec) noexcept;
|
||||
|
||||
void create_symlink(const path& __to, const path& __new_symlink);
|
||||
void create_symlink(const path& __to, const path& __new_symlink,
|
||||
error_code& __ec) noexcept;
|
||||
|
||||
path current_path();
|
||||
path current_path(error_code& __ec);
|
||||
void current_path(const path& __p);
|
||||
void current_path(const path& __p, error_code& __ec) noexcept;
|
||||
|
||||
inline bool
|
||||
exists(file_status __s) noexcept
|
||||
{ return status_known(__s) && __s.type() != file_type::not_found; }
|
||||
|
||||
inline bool
|
||||
exists(const path& __p)
|
||||
{ return exists(status(__p)); }
|
||||
|
||||
inline bool
|
||||
exists(const path& __p, error_code& __ec) noexcept
|
||||
{ return exists(status(__p, __ec)); }
|
||||
|
||||
bool
|
||||
equivalent(const path& __p1, const path& __p2);
|
||||
|
||||
bool
|
||||
equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept;
|
||||
|
||||
uintmax_t file_size(const path& __p);
|
||||
uintmax_t file_size(const path& __p, error_code& __ec) noexcept;
|
||||
|
||||
uintmax_t hard_link_count(const path& __p);
|
||||
uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept;
|
||||
|
||||
inline bool
|
||||
is_block_file(file_status __s) noexcept
|
||||
{ return __s.type() == file_type::block; }
|
||||
|
||||
inline bool
|
||||
is_block_file(const path& __p)
|
||||
{ return is_block_file(status(__p)); }
|
||||
|
||||
inline bool
|
||||
is_block_file(const path& __p, error_code& __ec) noexcept
|
||||
{ return is_block_file(status(__p, __ec)); }
|
||||
|
||||
inline bool
|
||||
is_character_file(file_status __s) noexcept
|
||||
{ return __s.type() == file_type::character; }
|
||||
|
||||
inline bool
|
||||
is_character_file(const path& __p)
|
||||
{ return is_character_file(status(__p)); }
|
||||
|
||||
inline bool
|
||||
is_character_file(const path& __p, error_code& __ec) noexcept
|
||||
{ return is_character_file(status(__p, __ec)); }
|
||||
|
||||
inline bool
|
||||
is_directory(file_status __s) noexcept
|
||||
{ return __s.type() == file_type::directory; }
|
||||
|
||||
inline bool
|
||||
is_directory(const path& __p)
|
||||
{ return is_directory(status(__p)); }
|
||||
|
||||
inline bool
|
||||
is_directory(const path& __p, error_code& __ec) noexcept
|
||||
{ return is_directory(status(__p, __ec)); }
|
||||
|
||||
bool is_empty(const path& __p);
|
||||
bool is_empty(const path& __p, error_code& __ec) noexcept;
|
||||
|
||||
inline bool
|
||||
is_fifo(file_status __s) noexcept
|
||||
{ return __s.type() == file_type::fifo; }
|
||||
|
||||
inline bool
|
||||
is_fifo(const path& __p)
|
||||
{ return is_fifo(status(__p)); }
|
||||
|
||||
inline bool
|
||||
is_fifo(const path& __p, error_code& __ec) noexcept
|
||||
{ return is_fifo(status(__p, __ec)); }
|
||||
|
||||
inline bool
|
||||
is_other(file_status __s) noexcept
|
||||
{
|
||||
return exists(__s) && !is_regular_file(__s) && !is_directory(__s)
|
||||
&& !is_symlink(__s);
|
||||
}
|
||||
|
||||
inline bool
|
||||
is_other(const path& __p)
|
||||
{ return is_other(status(__p)); }
|
||||
|
||||
inline bool
|
||||
is_other(const path& __p, error_code& __ec) noexcept
|
||||
{ return is_other(status(__p, __ec)); }
|
||||
|
||||
inline bool
|
||||
is_regular_file(file_status __s) noexcept
|
||||
{ return __s.type() == file_type::regular; }
|
||||
|
||||
inline bool
|
||||
is_regular_file(const path& __p)
|
||||
{ return is_regular_file(status(__p)); }
|
||||
|
||||
inline bool
|
||||
is_regular_file(const path& __p, error_code& __ec) noexcept
|
||||
{ return is_regular_file(status(__p, __ec)); }
|
||||
|
||||
inline bool
|
||||
is_socket(file_status __s) noexcept
|
||||
{ return __s.type() == file_type::socket; }
|
||||
|
||||
inline bool
|
||||
is_socket(const path& __p)
|
||||
{ return is_socket(status(__p)); }
|
||||
|
||||
inline bool
|
||||
is_socket(const path& __p, error_code& __ec) noexcept
|
||||
{ return is_socket(status(__p, __ec)); }
|
||||
|
||||
inline bool
|
||||
is_symlink(file_status __s) noexcept
|
||||
{ return __s.type() == file_type::symlink; }
|
||||
|
||||
inline bool
|
||||
is_symlink(const path& __p)
|
||||
{ return is_symlink(symlink_status(__p)); }
|
||||
|
||||
inline bool
|
||||
is_symlink(const path& __p, error_code& __ec) noexcept
|
||||
{ return is_symlink(symlink_status(__p, __ec)); }
|
||||
|
||||
file_time_type last_write_time(const path& __p);
|
||||
file_time_type last_write_time(const path& __p, error_code& __ec) noexcept;
|
||||
void last_write_time(const path& __p, file_time_type __new_time);
|
||||
void last_write_time(const path& __p, file_time_type __new_time,
|
||||
error_code& __ec) noexcept;
|
||||
|
||||
void permissions(const path& __p, perms __prms);
|
||||
void permissions(const path& __p, perms __prms, error_code& __ec) noexcept;
|
||||
|
||||
path read_symlink(const path& __p);
|
||||
path read_symlink(const path& __p, error_code& __ec);
|
||||
|
||||
bool remove(const path& __p);
|
||||
bool remove(const path& __p, error_code& __ec) noexcept;
|
||||
|
||||
uintmax_t remove_all(const path& __p);
|
||||
uintmax_t remove_all(const path& __p, error_code& __ec) noexcept;
|
||||
|
||||
void rename(const path& __from, const path& __to);
|
||||
void rename(const path& __from, const path& __to, error_code& __ec) noexcept;
|
||||
|
||||
void resize_file(const path& __p, uintmax_t __size);
|
||||
void resize_file(const path& __p, uintmax_t __size, error_code& __ec) noexcept;
|
||||
|
||||
space_info space(const path& __p);
|
||||
space_info space(const path& __p, error_code& __ec) noexcept;
|
||||
|
||||
file_status status(const path& __p);
|
||||
file_status status(const path& __p, error_code& __ec) noexcept;
|
||||
|
||||
inline bool status_known(file_status __s) noexcept
|
||||
{ return __s.type() != file_type::none; }
|
||||
|
||||
file_status symlink_status(const path& __p);
|
||||
file_status symlink_status(const path& __p, error_code& __ec) noexcept;
|
||||
|
||||
path system_complete(const path& __p);
|
||||
path system_complete(const path& __p, error_code& __ec);
|
||||
|
||||
path temp_directory_path();
|
||||
path temp_directory_path(error_code& __ec);
|
||||
|
||||
// @} group filesystem
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace v1
|
||||
} // namespace filesystem
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#endif // C++11
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_FS_OPS_H
|
||||
1024
openflow/usr/include/c++/5/experimental/fs_path.h
Normal file
1024
openflow/usr/include/c++/5/experimental/fs_path.h
Normal file
File diff suppressed because it is too large
Load Diff
440
openflow/usr/include/c++/5/experimental/functional
Normal file
440
openflow/usr/include/c++/5/experimental/functional
Normal file
@@ -0,0 +1,440 @@
|
||||
// <experimental/functional> -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/functional
|
||||
* This is a TS C++ Library header.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_FUNCTIONAL
|
||||
#define _GLIBCXX_EXPERIMENTAL_FUNCTIONAL 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus <= 201103L
|
||||
# include <bits/c++14_warning.h>
|
||||
#else
|
||||
|
||||
#include <functional>
|
||||
#include <tuple>
|
||||
#include <iterator>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <bits/stl_algo.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
inline namespace fundamentals_v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
// See C++14 §20.9.9, Function object binders
|
||||
|
||||
/// Variable template for std::is_bind_expression
|
||||
template<typename _Tp>
|
||||
constexpr bool is_bind_expression_v = std::is_bind_expression<_Tp>::value;
|
||||
|
||||
/// Variable template for std::is_placeholder
|
||||
template<typename _Tp>
|
||||
constexpr int is_placeholder_v = std::is_placeholder<_Tp>::value;
|
||||
|
||||
#define __cpp_lib_experimental_boyer_moore_searching 201411
|
||||
|
||||
// Searchers
|
||||
|
||||
template<typename _ForwardIterator1, typename _BinaryPredicate = equal_to<>>
|
||||
class default_searcher
|
||||
{
|
||||
public:
|
||||
default_searcher(_ForwardIterator1 __pat_first,
|
||||
_ForwardIterator1 __pat_last,
|
||||
_BinaryPredicate __pred = _BinaryPredicate())
|
||||
: _M_m(__pat_first, __pat_last, std::move(__pred))
|
||||
{ }
|
||||
|
||||
template<typename _ForwardIterator2>
|
||||
_ForwardIterator2
|
||||
operator()(_ForwardIterator2 __first, _ForwardIterator2 __last) const
|
||||
{
|
||||
return std::search(__first, __last,
|
||||
std::get<0>(_M_m), std::get<1>(_M_m),
|
||||
std::get<2>(_M_m));
|
||||
}
|
||||
|
||||
private:
|
||||
std::tuple<_ForwardIterator1, _ForwardIterator1, _BinaryPredicate> _M_m;
|
||||
};
|
||||
|
||||
template<typename _Key, typename _Tp, typename _Hash, typename _Pred>
|
||||
struct __boyer_moore_map_base
|
||||
{
|
||||
template<typename _RAIter>
|
||||
__boyer_moore_map_base(_RAIter __pat, size_t __patlen,
|
||||
_Hash&& __hf, _Pred&& __pred)
|
||||
: _M_bad_char{ __patlen, std::move(__hf), std::move(__pred) }
|
||||
{
|
||||
if (__patlen > 0)
|
||||
for (__diff_type __i = 0; __i < __patlen - 1; ++__i)
|
||||
_M_bad_char[__pat[__i]] = __patlen - 1 - __i;
|
||||
}
|
||||
|
||||
using __diff_type = _Tp;
|
||||
|
||||
__diff_type
|
||||
_M_lookup(_Key __key, __diff_type __not_found) const
|
||||
{
|
||||
auto __iter = _M_bad_char.find(__key);
|
||||
if (__iter == _M_bad_char.end())
|
||||
return __not_found;
|
||||
return __iter->second;
|
||||
}
|
||||
|
||||
_Pred
|
||||
_M_pred() const { return _M_bad_char.key_eq(); }
|
||||
|
||||
std::unordered_map<_Key, _Tp, _Hash, _Pred> _M_bad_char;
|
||||
};
|
||||
|
||||
template<typename _Tp, size_t _Len, typename _Pred>
|
||||
struct __boyer_moore_array_base
|
||||
{
|
||||
template<typename _RAIter, typename _Unused>
|
||||
__boyer_moore_array_base(_RAIter __pat, size_t __patlen,
|
||||
_Unused&&, _Pred&& __pred)
|
||||
: _M_bad_char{ {}, std::move(__pred) }
|
||||
{
|
||||
std::get<0>(_M_bad_char).fill(__patlen);
|
||||
if (__patlen > 0)
|
||||
for (__diff_type __i = 0; __i < __patlen - 1; ++__i)
|
||||
{
|
||||
auto __ch = __pat[__i];
|
||||
using _UCh = std::make_unsigned_t<decltype(__ch)>;
|
||||
auto __uch = static_cast<_UCh>(__ch);
|
||||
std::get<0>(_M_bad_char)[__uch] = __patlen - 1 - __i;
|
||||
}
|
||||
}
|
||||
|
||||
using __diff_type = _Tp;
|
||||
|
||||
template<typename _Key>
|
||||
__diff_type
|
||||
_M_lookup(_Key __key, __diff_type __not_found) const
|
||||
{
|
||||
auto __ukey = static_cast<std::make_unsigned_t<_Key>>(__key);
|
||||
if (__ukey >= _Len)
|
||||
return __not_found;
|
||||
return std::get<0>(_M_bad_char)[__ukey];
|
||||
}
|
||||
|
||||
const _Pred&
|
||||
_M_pred() const { return std::get<1>(_M_bad_char); }
|
||||
|
||||
std::tuple<std::array<_Tp, _Len>, _Pred> _M_bad_char;
|
||||
};
|
||||
|
||||
template<typename _Pred>
|
||||
struct __is_std_equal_to : std::false_type { };
|
||||
|
||||
template<>
|
||||
struct __is_std_equal_to<std::equal_to<void>> : std::true_type { };
|
||||
|
||||
// Use __boyer_moore_array_base when pattern consists of narrow characters
|
||||
// and uses std::equal_to as the predicate.
|
||||
template<typename _RAIter, typename _Hash, typename _Pred,
|
||||
typename _Val = typename iterator_traits<_RAIter>::value_type,
|
||||
typename _Diff = typename iterator_traits<_RAIter>::difference_type>
|
||||
using __boyer_moore_base_t
|
||||
= std::conditional_t<sizeof(_Val) == 1 && is_integral<_Val>::value
|
||||
&& __is_std_equal_to<_Pred>::value,
|
||||
__boyer_moore_array_base<_Diff, 256, _Pred>,
|
||||
__boyer_moore_map_base<_Val, _Diff, _Hash, _Pred>>;
|
||||
|
||||
template<typename _RAIter, typename _Hash
|
||||
= std::hash<typename std::iterator_traits<_RAIter>::value_type>,
|
||||
typename _BinaryPredicate = std::equal_to<>>
|
||||
class boyer_moore_searcher
|
||||
: __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>
|
||||
{
|
||||
using _Base = __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>;
|
||||
using typename _Base::__diff_type;
|
||||
|
||||
public:
|
||||
boyer_moore_searcher(_RAIter __pat_first, _RAIter __pat_last,
|
||||
_Hash __hf = _Hash(),
|
||||
_BinaryPredicate __pred = _BinaryPredicate());
|
||||
|
||||
template<typename _RandomAccessIterator2>
|
||||
_RandomAccessIterator2
|
||||
operator()(_RandomAccessIterator2 __first,
|
||||
_RandomAccessIterator2 __last) const;
|
||||
|
||||
private:
|
||||
bool
|
||||
_M_is_prefix(_RAIter __word, __diff_type __len,
|
||||
__diff_type __pos)
|
||||
{
|
||||
const auto& __pred = this->_M_pred();
|
||||
__diff_type __suffixlen = __len - __pos;
|
||||
for (__diff_type __i = 0; __i < __suffixlen; ++__i)
|
||||
if (!__pred(__word[__i], __word[__pos + __i]))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
__diff_type
|
||||
_M_suffix_length(_RAIter __word, __diff_type __len,
|
||||
__diff_type __pos)
|
||||
{
|
||||
const auto& __pred = this->_M_pred();
|
||||
__diff_type __i = 0;
|
||||
while (__pred(__word[__pos - __i], __word[__len - 1 - __i])
|
||||
&& __i < __pos)
|
||||
{
|
||||
++__i;
|
||||
}
|
||||
return __i;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
__diff_type
|
||||
_M_bad_char_shift(_Tp __c) const
|
||||
{ return this->_M_lookup(__c, _M_pat_end - _M_pat); }
|
||||
|
||||
_RAIter _M_pat;
|
||||
_RAIter _M_pat_end;
|
||||
std::vector<__diff_type> _M_good_suffix;
|
||||
};
|
||||
|
||||
template<typename _RAIter, typename _Hash
|
||||
= std::hash<typename std::iterator_traits<_RAIter>::value_type>,
|
||||
typename _BinaryPredicate = std::equal_to<>>
|
||||
class boyer_moore_horspool_searcher
|
||||
: __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>
|
||||
{
|
||||
using _Base = __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>;
|
||||
using typename _Base::__diff_type;
|
||||
|
||||
public:
|
||||
boyer_moore_horspool_searcher(_RAIter __pat,
|
||||
_RAIter __pat_end,
|
||||
_Hash __hf = _Hash(),
|
||||
_BinaryPredicate __pred
|
||||
= _BinaryPredicate())
|
||||
: _Base(__pat, __pat_end - __pat, std::move(__hf), std::move(__pred)),
|
||||
_M_pat(__pat), _M_pat_end(__pat_end)
|
||||
{ }
|
||||
|
||||
template<typename _RandomAccessIterator2>
|
||||
_RandomAccessIterator2
|
||||
operator()(_RandomAccessIterator2 __first,
|
||||
_RandomAccessIterator2 __last) const
|
||||
{
|
||||
const auto& __pred = this->_M_pred();
|
||||
auto __patlen = _M_pat_end - _M_pat;
|
||||
if (__patlen == 0)
|
||||
return __first;
|
||||
auto __len = __last - __first;
|
||||
while (__len >= __patlen)
|
||||
{
|
||||
for (auto __scan = __patlen - 1;
|
||||
__pred(__first[__scan], _M_pat[__scan]); --__scan)
|
||||
if (__scan == 0)
|
||||
return __first;
|
||||
auto __shift = _M_bad_char_shift(__first[__patlen - 1]);
|
||||
__len -= __shift;
|
||||
__first += __shift;
|
||||
}
|
||||
return __last;
|
||||
}
|
||||
|
||||
private:
|
||||
template<typename _Tp>
|
||||
__diff_type
|
||||
_M_bad_char_shift(_Tp __c) const
|
||||
{ return this->_M_lookup(__c, _M_pat_end - _M_pat); }
|
||||
|
||||
_RAIter _M_pat;
|
||||
_RAIter _M_pat_end;
|
||||
};
|
||||
|
||||
/// Generator function for default_searcher
|
||||
template<typename _ForwardIterator,
|
||||
typename _BinaryPredicate = std::equal_to<>>
|
||||
inline default_searcher<_ForwardIterator, _BinaryPredicate>
|
||||
make_default_searcher(_ForwardIterator __pat_first,
|
||||
_ForwardIterator __pat_last,
|
||||
_BinaryPredicate __pred = _BinaryPredicate())
|
||||
{ return { __pat_first, __pat_last, __pred }; }
|
||||
|
||||
/// Generator function for boyer_moore_searcher
|
||||
template<typename _RAIter, typename _Hash
|
||||
= std::hash<typename std::iterator_traits<_RAIter>::value_type>,
|
||||
typename _BinaryPredicate = equal_to<>>
|
||||
inline boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate>
|
||||
make_boyer_moore_searcher(_RAIter __pat_first, _RAIter __pat_last,
|
||||
_Hash __hf = _Hash(),
|
||||
_BinaryPredicate __pred = _BinaryPredicate())
|
||||
{ return { __pat_first, __pat_last, std::move(__hf), std::move(__pred) }; }
|
||||
|
||||
/// Generator function for boyer_moore_horspool_searcher
|
||||
template<typename _RAIter, typename _Hash
|
||||
= std::hash<typename std::iterator_traits<_RAIter>::value_type>,
|
||||
typename _BinaryPredicate = equal_to<>>
|
||||
inline boyer_moore_horspool_searcher<_RAIter, _Hash, _BinaryPredicate>
|
||||
make_boyer_moore_horspool_searcher(_RAIter __pat_first, _RAIter __pat_last,
|
||||
_Hash __hf = _Hash(),
|
||||
_BinaryPredicate __pred
|
||||
= _BinaryPredicate())
|
||||
{ return { __pat_first, __pat_last, std::move(__hf), std::move(__pred) }; }
|
||||
|
||||
template<typename _RAIter, typename _Hash, typename _BinaryPredicate>
|
||||
boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate>::
|
||||
boyer_moore_searcher(_RAIter __pat, _RAIter __pat_end,
|
||||
_Hash __hf, _BinaryPredicate __pred)
|
||||
: _Base(__pat, __pat_end - __pat, std::move(__hf), std::move(__pred)),
|
||||
_M_pat(__pat), _M_pat_end(__pat_end), _M_good_suffix(__pat_end - __pat)
|
||||
{
|
||||
auto __patlen = __pat_end - __pat;
|
||||
if (__patlen == 0)
|
||||
return;
|
||||
__diff_type __last_prefix = __patlen - 1;
|
||||
for (__diff_type __p = __patlen - 1; __p >= 0; --__p)
|
||||
{
|
||||
if (_M_is_prefix(__pat, __patlen, __p + 1))
|
||||
__last_prefix = __p + 1;
|
||||
_M_good_suffix[__p] = __last_prefix + (__patlen - 1 - __p);
|
||||
}
|
||||
for (__diff_type __p = 0; __p < __patlen - 1; ++__p)
|
||||
{
|
||||
auto __slen = _M_suffix_length(__pat, __patlen, __p);
|
||||
auto __pos = __patlen - 1 - __slen;
|
||||
if (!__pred(__pat[__p - __slen], __pat[__pos]))
|
||||
_M_good_suffix[__pos] = __patlen - 1 - __p + __slen;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename _RAIter, typename _Hash, typename _BinaryPredicate>
|
||||
template<typename _RandomAccessIterator2>
|
||||
_RandomAccessIterator2
|
||||
boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate>::
|
||||
operator()(_RandomAccessIterator2 __first,
|
||||
_RandomAccessIterator2 __last) const
|
||||
{
|
||||
auto __patlen = _M_pat_end - _M_pat;
|
||||
if (__patlen == 0)
|
||||
return __first;
|
||||
const auto& __pred = this->_M_pred();
|
||||
__diff_type __i = __patlen - 1;
|
||||
auto __stringlen = __last - __first;
|
||||
while (__i < __stringlen)
|
||||
{
|
||||
__diff_type __j = __patlen - 1;
|
||||
while (__j >= 0 && __pred(__first[__i], _M_pat[__j]))
|
||||
{
|
||||
--__i;
|
||||
--__j;
|
||||
}
|
||||
if (__j < 0)
|
||||
return __first + __i + 1;
|
||||
__i += std::max(_M_bad_char_shift(__first[__i]),
|
||||
_M_good_suffix[__j]);
|
||||
}
|
||||
return __last;
|
||||
}
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace fundamentals_v1
|
||||
|
||||
inline namespace fundamentals_v2
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
#define __cpp_lib_experimental_not_fn 201406
|
||||
|
||||
/// Generalized negator.
|
||||
template<typename _Fn>
|
||||
class _Not_fn
|
||||
{
|
||||
_Fn _M_fn;
|
||||
|
||||
public:
|
||||
template<typename _Fn2>
|
||||
explicit
|
||||
_Not_fn(_Fn2&& __fn) : _M_fn(std::forward<_Fn2>(__fn)) { }
|
||||
|
||||
_Not_fn(const _Not_fn& __fn) = default;
|
||||
_Not_fn(_Not_fn&& __fn) = default;
|
||||
_Not_fn& operator=(const _Not_fn& __fn) = default;
|
||||
_Not_fn& operator=(_Not_fn&& __fn) = default;
|
||||
~_Not_fn() = default;
|
||||
|
||||
template<typename... _Args>
|
||||
auto
|
||||
operator()(_Args&&... __args)
|
||||
noexcept(noexcept(!_M_fn(std::forward<_Args>(__args)...)))
|
||||
-> decltype(!_M_fn(std::forward<_Args>(__args)...))
|
||||
{ return !_M_fn(std::forward<_Args>(__args)...); }
|
||||
|
||||
template<typename... _Args>
|
||||
auto
|
||||
operator()(_Args&&... __args) const
|
||||
noexcept(noexcept(!_M_fn(std::forward<_Args>(__args)...)))
|
||||
-> decltype(!_M_fn(std::forward<_Args>(__args)...))
|
||||
{ return !_M_fn(std::forward<_Args>(__args)...); }
|
||||
|
||||
template<typename... _Args>
|
||||
auto
|
||||
operator()(_Args&&... __args) volatile
|
||||
noexcept(noexcept(!_M_fn(std::forward<_Args>(__args)...)))
|
||||
-> decltype(!_M_fn(std::forward<_Args>(__args)...))
|
||||
{ return !_M_fn(std::forward<_Args>(__args)...); }
|
||||
|
||||
template<typename... _Args>
|
||||
auto
|
||||
operator()(_Args&&... __args) const volatile
|
||||
noexcept(noexcept(!_M_fn(std::forward<_Args>(__args)...)))
|
||||
-> decltype(!_M_fn(std::forward<_Args>(__args)...))
|
||||
{ return !_M_fn(std::forward<_Args>(__args)...); }
|
||||
};
|
||||
|
||||
/// [func.not_fn] Function template not_fn
|
||||
template<typename _Fn>
|
||||
inline auto
|
||||
not_fn(_Fn&& __fn)
|
||||
noexcept(std::is_nothrow_constructible<std::decay_t<_Fn>, _Fn&&>::value)
|
||||
{
|
||||
using __maybe_type = _Maybe_wrap_member_pointer<std::decay_t<_Fn>>;
|
||||
return _Not_fn<typename __maybe_type::type>{std::forward<_Fn>(__fn)};
|
||||
}
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace fundamentals_v2
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#endif // C++14
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_FUNCTIONAL
|
||||
864
openflow/usr/include/c++/5/experimental/optional
Normal file
864
openflow/usr/include/c++/5/experimental/optional
Normal file
@@ -0,0 +1,864 @@
|
||||
// <optional> -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/optional
|
||||
* This is a TS C++ Library header.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_OPTIONAL
|
||||
#define _GLIBCXX_EXPERIMENTAL_OPTIONAL 1
|
||||
|
||||
/**
|
||||
* @defgroup experimental Experimental
|
||||
*
|
||||
* Components specified by various Technical Specifications.
|
||||
*
|
||||
* As indicated by the std::experimental namespace and the header paths,
|
||||
* the contents of these Technical Specifications are experimental and not
|
||||
* part of the C++ standard. As such the interfaces and implementations may
|
||||
* change in the future, and there is <STRONG> no guarantee of compatibility
|
||||
* between different GCC releases </STRONG> for these features.
|
||||
*/
|
||||
|
||||
#if __cplusplus <= 201103L
|
||||
# include <bits/c++14_warning.h>
|
||||
#else
|
||||
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
#include <stdexcept>
|
||||
#include <new>
|
||||
#include <initializer_list>
|
||||
#include <bits/functexcept.h>
|
||||
#include <bits/functional_hash.h>
|
||||
#include <bits/enable_special_members.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
inline namespace fundamentals_v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/**
|
||||
* @defgroup optional Optional values
|
||||
* @ingroup experimental
|
||||
*
|
||||
* Class template for optional values and surrounding facilities, as
|
||||
* described in n3793 "A proposal to add a utility class to represent
|
||||
* optional objects (Revision 5)".
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define __cpp_lib_experimental_optional 201411
|
||||
|
||||
// All subsequent [X.Y.n] references are against n3793.
|
||||
|
||||
// [X.Y.4]
|
||||
template<typename _Tp>
|
||||
class optional;
|
||||
|
||||
// [X.Y.5]
|
||||
/// Tag type for in-place construction.
|
||||
struct in_place_t { };
|
||||
|
||||
/// Tag for in-place construction.
|
||||
constexpr in_place_t in_place { };
|
||||
|
||||
// [X.Y.6]
|
||||
/// Tag type to disengage optional objects.
|
||||
struct nullopt_t
|
||||
{
|
||||
// Do not user-declare default constructor at all for
|
||||
// optional_value = {} syntax to work.
|
||||
// nullopt_t() = delete;
|
||||
|
||||
// Used for constructing nullopt.
|
||||
enum class _Construct { _Token };
|
||||
|
||||
// Must be constexpr for nullopt_t to be literal.
|
||||
explicit constexpr nullopt_t(_Construct) { }
|
||||
};
|
||||
|
||||
// [X.Y.6]
|
||||
/// Tag to disengage optional objects.
|
||||
constexpr nullopt_t nullopt { nullopt_t::_Construct::_Token };
|
||||
|
||||
// [X.Y.7]
|
||||
/**
|
||||
* @brief Exception class thrown when a disengaged optional object is
|
||||
* dereferenced.
|
||||
* @ingroup exceptions
|
||||
*/
|
||||
class bad_optional_access : public logic_error
|
||||
{
|
||||
public:
|
||||
bad_optional_access() : logic_error("bad optional access") { }
|
||||
|
||||
// XXX This constructor is non-standard. Should not be inline
|
||||
explicit bad_optional_access(const char* __arg) : logic_error(__arg) { }
|
||||
|
||||
virtual ~bad_optional_access() noexcept = default;
|
||||
};
|
||||
|
||||
void
|
||||
__throw_bad_optional_access(const char*)
|
||||
__attribute__((__noreturn__));
|
||||
|
||||
// XXX Does not belong here.
|
||||
inline void
|
||||
__throw_bad_optional_access(const char* __s)
|
||||
{ _GLIBCXX_THROW_OR_ABORT(bad_optional_access(__s)); }
|
||||
|
||||
template<typename _Tp, typename = void>
|
||||
struct _Has_addressof_mem : std::false_type { };
|
||||
|
||||
template<typename _Tp>
|
||||
struct _Has_addressof_mem<_Tp,
|
||||
__void_t<decltype( std::declval<const _Tp&>().operator&() )>
|
||||
>
|
||||
: std::true_type { };
|
||||
|
||||
template<typename _Tp, typename = void>
|
||||
struct _Has_addressof_free : std::false_type { };
|
||||
|
||||
template<typename _Tp>
|
||||
struct _Has_addressof_free<_Tp,
|
||||
__void_t<decltype( operator&(std::declval<const _Tp&>()) )>
|
||||
>
|
||||
: std::true_type { };
|
||||
|
||||
/**
|
||||
* @brief Trait that detects the presence of an overloaded unary operator&.
|
||||
*
|
||||
* Practically speaking this detects the presence of such an operator when
|
||||
* called on a const-qualified lvalue (i.e.
|
||||
* declval<_Tp * const&>().operator&()).
|
||||
*/
|
||||
template<typename _Tp>
|
||||
struct _Has_addressof
|
||||
: std::__or_<_Has_addressof_mem<_Tp>, _Has_addressof_free<_Tp>>::type
|
||||
{ };
|
||||
|
||||
/**
|
||||
* @brief An overload that attempts to take the address of an lvalue as a
|
||||
* constant expression. Falls back to __addressof in the presence of an
|
||||
* overloaded addressof operator (unary operator&), in which case the call
|
||||
* will not be a constant expression.
|
||||
*/
|
||||
template<typename _Tp, enable_if_t<!_Has_addressof<_Tp>::value, int>...>
|
||||
constexpr _Tp* __constexpr_addressof(_Tp& __t)
|
||||
{ return &__t; }
|
||||
|
||||
/**
|
||||
* @brief Fallback overload that defers to __addressof.
|
||||
*/
|
||||
template<typename _Tp, enable_if_t<_Has_addressof<_Tp>::value, int>...>
|
||||
inline _Tp* __constexpr_addressof(_Tp& __t)
|
||||
{ return std::__addressof(__t); }
|
||||
|
||||
/**
|
||||
* @brief Class template that holds the necessary state for @ref optional
|
||||
* and that has the responsibility for construction and the special members.
|
||||
*
|
||||
* Such a separate base class template is necessary in order to
|
||||
* conditionally enable the special members (e.g. copy/move constructors).
|
||||
* Note that this means that @ref _Optional_base implements the
|
||||
* functionality for copy and move assignment, but not for converting
|
||||
* assignment.
|
||||
*
|
||||
* @see optional, _Enable_special_members
|
||||
*/
|
||||
template<typename _Tp, bool _ShouldProvideDestructor =
|
||||
!is_trivially_destructible<_Tp>::value>
|
||||
class _Optional_base
|
||||
{
|
||||
private:
|
||||
// Remove const to avoid prohibition of reusing object storage for
|
||||
// const-qualified types in [3.8/9]. This is strictly internal
|
||||
// and even optional itself is oblivious to it.
|
||||
using _Stored_type = remove_const_t<_Tp>;
|
||||
|
||||
public:
|
||||
// [X.Y.4.1] Constructors.
|
||||
|
||||
// Constructors for disengaged optionals.
|
||||
constexpr _Optional_base() noexcept
|
||||
: _M_empty{} { }
|
||||
|
||||
constexpr _Optional_base(nullopt_t) noexcept
|
||||
: _Optional_base{} { }
|
||||
|
||||
// Constructors for engaged optionals.
|
||||
constexpr _Optional_base(const _Tp& __t)
|
||||
: _M_payload(__t), _M_engaged(true) { }
|
||||
|
||||
constexpr _Optional_base(_Tp&& __t)
|
||||
: _M_payload(std::move(__t)), _M_engaged(true) { }
|
||||
|
||||
template<typename... _Args>
|
||||
constexpr explicit _Optional_base(in_place_t, _Args&&... __args)
|
||||
: _M_payload(std::forward<_Args>(__args)...), _M_engaged(true) { }
|
||||
|
||||
template<typename _Up, typename... _Args,
|
||||
enable_if_t<is_constructible<_Tp,
|
||||
initializer_list<_Up>&,
|
||||
_Args&&...>::value,
|
||||
int>...>
|
||||
constexpr explicit _Optional_base(in_place_t,
|
||||
initializer_list<_Up> __il,
|
||||
_Args&&... __args)
|
||||
: _M_payload(__il, std::forward<_Args>(__args)...),
|
||||
_M_engaged(true) { }
|
||||
|
||||
// Copy and move constructors.
|
||||
_Optional_base(const _Optional_base& __other)
|
||||
{
|
||||
if (__other._M_engaged)
|
||||
this->_M_construct(__other._M_get());
|
||||
}
|
||||
|
||||
_Optional_base(_Optional_base&& __other)
|
||||
noexcept(is_nothrow_move_constructible<_Tp>())
|
||||
{
|
||||
if (__other._M_engaged)
|
||||
this->_M_construct(std::move(__other._M_get()));
|
||||
}
|
||||
|
||||
// [X.Y.4.3] (partly) Assignment.
|
||||
_Optional_base&
|
||||
operator=(const _Optional_base& __other)
|
||||
{
|
||||
if (this->_M_engaged && __other._M_engaged)
|
||||
this->_M_get() = __other._M_get();
|
||||
else
|
||||
{
|
||||
if (__other._M_engaged)
|
||||
this->_M_construct(__other._M_get());
|
||||
else
|
||||
this->_M_reset();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
_Optional_base&
|
||||
operator=(_Optional_base&& __other)
|
||||
noexcept(__and_<is_nothrow_move_constructible<_Tp>,
|
||||
is_nothrow_move_assignable<_Tp>>())
|
||||
{
|
||||
if (this->_M_engaged && __other._M_engaged)
|
||||
this->_M_get() = std::move(__other._M_get());
|
||||
else
|
||||
{
|
||||
if (__other._M_engaged)
|
||||
this->_M_construct(std::move(__other._M_get()));
|
||||
else
|
||||
this->_M_reset();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// [X.Y.4.2] Destructor.
|
||||
~_Optional_base()
|
||||
{
|
||||
if (this->_M_engaged)
|
||||
this->_M_payload.~_Stored_type();
|
||||
}
|
||||
|
||||
// The following functionality is also needed by optional, hence the
|
||||
// protected accessibility.
|
||||
protected:
|
||||
constexpr bool _M_is_engaged() const noexcept
|
||||
{ return this->_M_engaged; }
|
||||
|
||||
// The _M_get operations have _M_engaged as a precondition.
|
||||
constexpr _Tp&
|
||||
_M_get() noexcept
|
||||
{ return _M_payload; }
|
||||
|
||||
constexpr const _Tp&
|
||||
_M_get() const noexcept
|
||||
{ return _M_payload; }
|
||||
|
||||
// The _M_construct operation has !_M_engaged as a precondition
|
||||
// while _M_destruct has _M_engaged as a precondition.
|
||||
template<typename... _Args>
|
||||
void
|
||||
_M_construct(_Args&&... __args)
|
||||
noexcept(is_nothrow_constructible<_Stored_type, _Args...>())
|
||||
{
|
||||
::new (std::__addressof(this->_M_payload))
|
||||
_Stored_type(std::forward<_Args>(__args)...);
|
||||
this->_M_engaged = true;
|
||||
}
|
||||
|
||||
void
|
||||
_M_destruct()
|
||||
{
|
||||
this->_M_engaged = false;
|
||||
this->_M_payload.~_Stored_type();
|
||||
}
|
||||
|
||||
// _M_reset is a 'safe' operation with no precondition.
|
||||
void
|
||||
_M_reset()
|
||||
{
|
||||
if (this->_M_engaged)
|
||||
this->_M_destruct();
|
||||
}
|
||||
|
||||
private:
|
||||
struct _Empty_byte { };
|
||||
union {
|
||||
_Empty_byte _M_empty;
|
||||
_Stored_type _M_payload;
|
||||
};
|
||||
bool _M_engaged = false;
|
||||
};
|
||||
|
||||
/// Partial specialization that is exactly identical to the primary template
|
||||
/// save for not providing a destructor, to fulfill triviality requirements.
|
||||
template<typename _Tp>
|
||||
class _Optional_base<_Tp, false>
|
||||
{
|
||||
private:
|
||||
using _Stored_type = remove_const_t<_Tp>;
|
||||
|
||||
public:
|
||||
constexpr _Optional_base() noexcept
|
||||
: _M_empty{} { }
|
||||
|
||||
constexpr _Optional_base(nullopt_t) noexcept
|
||||
: _Optional_base{} { }
|
||||
|
||||
constexpr _Optional_base(const _Tp& __t)
|
||||
: _M_payload(__t), _M_engaged(true) { }
|
||||
|
||||
constexpr _Optional_base(_Tp&& __t)
|
||||
: _M_payload(std::move(__t)), _M_engaged(true) { }
|
||||
|
||||
template<typename... _Args>
|
||||
constexpr explicit _Optional_base(in_place_t, _Args&&... __args)
|
||||
: _M_payload(std::forward<_Args>(__args)...), _M_engaged(true) { }
|
||||
|
||||
template<typename _Up, typename... _Args,
|
||||
enable_if_t<is_constructible<_Tp,
|
||||
initializer_list<_Up>&,
|
||||
_Args&&...>::value,
|
||||
int>...>
|
||||
constexpr explicit _Optional_base(in_place_t,
|
||||
initializer_list<_Up> __il,
|
||||
_Args&&... __args)
|
||||
: _M_payload(__il, std::forward<_Args>(__args)...),
|
||||
_M_engaged(true) { }
|
||||
|
||||
_Optional_base(const _Optional_base& __other)
|
||||
{
|
||||
if (__other._M_engaged)
|
||||
this->_M_construct(__other._M_get());
|
||||
}
|
||||
|
||||
_Optional_base(_Optional_base&& __other)
|
||||
noexcept(is_nothrow_move_constructible<_Tp>())
|
||||
{
|
||||
if (__other._M_engaged)
|
||||
this->_M_construct(std::move(__other._M_get()));
|
||||
}
|
||||
|
||||
_Optional_base&
|
||||
operator=(const _Optional_base& __other)
|
||||
{
|
||||
if (this->_M_engaged && __other._M_engaged)
|
||||
this->_M_get() = __other._M_get();
|
||||
else
|
||||
{
|
||||
if (__other._M_engaged)
|
||||
this->_M_construct(__other._M_get());
|
||||
else
|
||||
this->_M_reset();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
_Optional_base&
|
||||
operator=(_Optional_base&& __other)
|
||||
noexcept(__and_<is_nothrow_move_constructible<_Tp>,
|
||||
is_nothrow_move_assignable<_Tp>>())
|
||||
{
|
||||
if (this->_M_engaged && __other._M_engaged)
|
||||
this->_M_get() = std::move(__other._M_get());
|
||||
else
|
||||
{
|
||||
if (__other._M_engaged)
|
||||
this->_M_construct(std::move(__other._M_get()));
|
||||
else
|
||||
this->_M_reset();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Sole difference
|
||||
// ~_Optional_base() noexcept = default;
|
||||
|
||||
protected:
|
||||
constexpr bool _M_is_engaged() const noexcept
|
||||
{ return this->_M_engaged; }
|
||||
|
||||
_Tp&
|
||||
_M_get() noexcept
|
||||
{ return _M_payload; }
|
||||
|
||||
constexpr const _Tp&
|
||||
_M_get() const noexcept
|
||||
{ return _M_payload; }
|
||||
|
||||
template<typename... _Args>
|
||||
void
|
||||
_M_construct(_Args&&... __args)
|
||||
noexcept(is_nothrow_constructible<_Stored_type, _Args...>())
|
||||
{
|
||||
::new (std::__addressof(this->_M_payload))
|
||||
_Stored_type(std::forward<_Args>(__args)...);
|
||||
this->_M_engaged = true;
|
||||
}
|
||||
|
||||
void
|
||||
_M_destruct()
|
||||
{
|
||||
this->_M_engaged = false;
|
||||
this->_M_payload.~_Stored_type();
|
||||
}
|
||||
|
||||
void
|
||||
_M_reset()
|
||||
{
|
||||
if (this->_M_engaged)
|
||||
this->_M_destruct();
|
||||
}
|
||||
|
||||
private:
|
||||
struct _Empty_byte { };
|
||||
union
|
||||
{
|
||||
_Empty_byte _M_empty;
|
||||
_Stored_type _M_payload;
|
||||
};
|
||||
bool _M_engaged = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class template for optional values.
|
||||
*/
|
||||
template<typename _Tp>
|
||||
class optional
|
||||
: private _Optional_base<_Tp>,
|
||||
private _Enable_copy_move<
|
||||
// Copy constructor.
|
||||
is_copy_constructible<_Tp>::value,
|
||||
// Copy assignment.
|
||||
__and_<is_copy_constructible<_Tp>, is_copy_assignable<_Tp>>::value,
|
||||
// Move constructor.
|
||||
is_move_constructible<_Tp>::value,
|
||||
// Move assignment.
|
||||
__and_<is_move_constructible<_Tp>, is_move_assignable<_Tp>>::value,
|
||||
// Unique tag type.
|
||||
optional<_Tp>>
|
||||
{
|
||||
static_assert(__and_<__not_<is_same<remove_cv_t<_Tp>, nullopt_t>>,
|
||||
__not_<is_same<remove_cv_t<_Tp>, in_place_t>>,
|
||||
__not_<is_reference<_Tp>>>(),
|
||||
"Invalid instantiation of optional<T>");
|
||||
|
||||
private:
|
||||
using _Base = _Optional_base<_Tp>;
|
||||
|
||||
public:
|
||||
using value_type = _Tp;
|
||||
|
||||
// _Optional_base has the responsibility for construction.
|
||||
using _Base::_Base;
|
||||
|
||||
// [X.Y.4.3] (partly) Assignment.
|
||||
optional&
|
||||
operator=(nullopt_t) noexcept
|
||||
{
|
||||
this->_M_reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename _Up>
|
||||
enable_if_t<is_same<_Tp, decay_t<_Up>>::value, optional&>
|
||||
operator=(_Up&& __u)
|
||||
{
|
||||
static_assert(__and_<is_constructible<_Tp, _Up>,
|
||||
is_assignable<_Tp&, _Up>>(),
|
||||
"Cannot assign to value type from argument");
|
||||
|
||||
if (this->_M_is_engaged())
|
||||
this->_M_get() = std::forward<_Up>(__u);
|
||||
else
|
||||
this->_M_construct(std::forward<_Up>(__u));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
void
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
static_assert(is_constructible<_Tp, _Args&&...>(),
|
||||
"Cannot emplace value type from arguments");
|
||||
|
||||
this->_M_reset();
|
||||
this->_M_construct(std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template<typename _Up, typename... _Args>
|
||||
enable_if_t<is_constructible<_Tp, initializer_list<_Up>&,
|
||||
_Args&&...>::value>
|
||||
emplace(initializer_list<_Up> __il, _Args&&... __args)
|
||||
{
|
||||
this->_M_reset();
|
||||
this->_M_construct(__il, std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
// [X.Y.4.2] Destructor is implicit, implemented in _Optional_base.
|
||||
|
||||
// [X.Y.4.4] Swap.
|
||||
void
|
||||
swap(optional& __other)
|
||||
noexcept(is_nothrow_move_constructible<_Tp>()
|
||||
&& noexcept(swap(declval<_Tp&>(), declval<_Tp&>())))
|
||||
{
|
||||
using std::swap;
|
||||
|
||||
if (this->_M_is_engaged() && __other._M_is_engaged())
|
||||
swap(this->_M_get(), __other._M_get());
|
||||
else if (this->_M_is_engaged())
|
||||
{
|
||||
__other._M_construct(std::move(this->_M_get()));
|
||||
this->_M_destruct();
|
||||
}
|
||||
else if (__other._M_is_engaged())
|
||||
{
|
||||
this->_M_construct(std::move(__other._M_get()));
|
||||
__other._M_destruct();
|
||||
}
|
||||
}
|
||||
|
||||
// [X.Y.4.5] Observers.
|
||||
constexpr const _Tp*
|
||||
operator->() const
|
||||
{ return __constexpr_addressof(this->_M_get()); }
|
||||
|
||||
_Tp*
|
||||
operator->()
|
||||
{ return std::__addressof(this->_M_get()); }
|
||||
|
||||
constexpr const _Tp&
|
||||
operator*() const&
|
||||
{ return this->_M_get(); }
|
||||
|
||||
constexpr _Tp&
|
||||
operator*()&
|
||||
{ return this->_M_get(); }
|
||||
|
||||
constexpr _Tp&&
|
||||
operator*()&&
|
||||
{ return std::move(this->_M_get()); }
|
||||
|
||||
constexpr const _Tp&&
|
||||
operator*() const&&
|
||||
{ return std::move(this->_M_get()); }
|
||||
|
||||
constexpr explicit operator bool() const noexcept
|
||||
{ return this->_M_is_engaged(); }
|
||||
|
||||
constexpr const _Tp&
|
||||
value() const&
|
||||
{
|
||||
return this->_M_is_engaged()
|
||||
? this->_M_get()
|
||||
: (__throw_bad_optional_access("Attempt to access value of a "
|
||||
"disengaged optional object"),
|
||||
this->_M_get());
|
||||
}
|
||||
|
||||
constexpr _Tp&
|
||||
value()&
|
||||
{
|
||||
return this->_M_is_engaged()
|
||||
? this->_M_get()
|
||||
: (__throw_bad_optional_access("Attempt to access value of a "
|
||||
"disengaged optional object"),
|
||||
this->_M_get());
|
||||
}
|
||||
|
||||
constexpr _Tp&&
|
||||
value()&&
|
||||
{
|
||||
return this->_M_is_engaged()
|
||||
? std::move(this->_M_get())
|
||||
: (__throw_bad_optional_access("Attempt to access value of a "
|
||||
"disengaged optional object"),
|
||||
std::move(this->_M_get()));
|
||||
}
|
||||
|
||||
constexpr const _Tp&&
|
||||
value() const&&
|
||||
{
|
||||
return this->_M_is_engaged()
|
||||
? std::move(this->_M_get())
|
||||
: (__throw_bad_optional_access("Attempt to access value of a "
|
||||
"disengaged optional object"),
|
||||
std::move(this->_M_get()));
|
||||
}
|
||||
|
||||
template<typename _Up>
|
||||
constexpr _Tp
|
||||
value_or(_Up&& __u) const&
|
||||
{
|
||||
static_assert(__and_<is_copy_constructible<_Tp>,
|
||||
is_convertible<_Up&&, _Tp>>(),
|
||||
"Cannot return value");
|
||||
|
||||
return this->_M_is_engaged()
|
||||
? this->_M_get()
|
||||
: static_cast<_Tp>(std::forward<_Up>(__u));
|
||||
}
|
||||
|
||||
template<typename _Up>
|
||||
_Tp
|
||||
value_or(_Up&& __u) &&
|
||||
{
|
||||
static_assert(__and_<is_move_constructible<_Tp>,
|
||||
is_convertible<_Up&&, _Tp>>(),
|
||||
"Cannot return value" );
|
||||
|
||||
return this->_M_is_engaged()
|
||||
? std::move(this->_M_get())
|
||||
: static_cast<_Tp>(std::forward<_Up>(__u));
|
||||
}
|
||||
};
|
||||
|
||||
// [X.Y.8] Comparisons between optional values.
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator==(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
|
||||
{
|
||||
return static_cast<bool>(__lhs) == static_cast<bool>(__rhs)
|
||||
&& (!__lhs || *__lhs == *__rhs);
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator!=(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
|
||||
{ return !(__lhs == __rhs); }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator<(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
|
||||
{
|
||||
return static_cast<bool>(__rhs) && (!__lhs || *__lhs < *__rhs);
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator>(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
|
||||
{ return __rhs < __lhs; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator<=(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
|
||||
{ return !(__rhs < __lhs); }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator>=(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
|
||||
{ return !(__lhs < __rhs); }
|
||||
|
||||
// [X.Y.9] Comparisons with nullopt.
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator==(const optional<_Tp>& __lhs, nullopt_t) noexcept
|
||||
{ return !__lhs; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator==(nullopt_t, const optional<_Tp>& __rhs) noexcept
|
||||
{ return !__rhs; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator!=(const optional<_Tp>& __lhs, nullopt_t) noexcept
|
||||
{ return static_cast<bool>(__lhs); }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator!=(nullopt_t, const optional<_Tp>& __rhs) noexcept
|
||||
{ return static_cast<bool>(__rhs); }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator<(const optional<_Tp>& /* __lhs */, nullopt_t) noexcept
|
||||
{ return false; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator<(nullopt_t, const optional<_Tp>& __rhs) noexcept
|
||||
{ return static_cast<bool>(__rhs); }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator>(const optional<_Tp>& __lhs, nullopt_t) noexcept
|
||||
{ return static_cast<bool>(__lhs); }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator>(nullopt_t, const optional<_Tp>& /* __rhs */) noexcept
|
||||
{ return false; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator<=(const optional<_Tp>& __lhs, nullopt_t) noexcept
|
||||
{ return !__lhs; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator<=(nullopt_t, const optional<_Tp>& /* __rhs */) noexcept
|
||||
{ return true; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator>=(const optional<_Tp>& /* __lhs */, nullopt_t) noexcept
|
||||
{ return true; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator>=(nullopt_t, const optional<_Tp>& __rhs) noexcept
|
||||
{ return !__rhs; }
|
||||
|
||||
// [X.Y.10] Comparisons with value type.
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator==(const optional<_Tp>& __lhs, const _Tp& __rhs)
|
||||
{ return __lhs && *__lhs == __rhs; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator==(const _Tp& __lhs, const optional<_Tp>& __rhs)
|
||||
{ return __rhs && __lhs == *__rhs; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator!=(const optional<_Tp>& __lhs, _Tp const& __rhs)
|
||||
{ return !__lhs || !(*__lhs == __rhs); }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator!=(const _Tp& __lhs, const optional<_Tp>& __rhs)
|
||||
{ return !__rhs || !(__lhs == *__rhs); }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator<(const optional<_Tp>& __lhs, const _Tp& __rhs)
|
||||
{ return !__lhs || *__lhs < __rhs; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator<(const _Tp& __lhs, const optional<_Tp>& __rhs)
|
||||
{ return __rhs && __lhs < *__rhs; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator>(const optional<_Tp>& __lhs, const _Tp& __rhs)
|
||||
{ return __lhs && __rhs < *__lhs; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator>(const _Tp& __lhs, const optional<_Tp>& __rhs)
|
||||
{ return !__rhs || *__rhs < __lhs; }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator<=(const optional<_Tp>& __lhs, const _Tp& __rhs)
|
||||
{ return !__lhs || !(__rhs < *__lhs); }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator<=(const _Tp& __lhs, const optional<_Tp>& __rhs)
|
||||
{ return __rhs && !(*__rhs < __lhs); }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator>=(const optional<_Tp>& __lhs, const _Tp& __rhs)
|
||||
{ return __lhs && !(*__lhs < __rhs); }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr bool
|
||||
operator>=(const _Tp& __lhs, const optional<_Tp>& __rhs)
|
||||
{ return !__rhs || !(__lhs < *__rhs); }
|
||||
|
||||
// [X.Y.11]
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
swap(optional<_Tp>& __lhs, optional<_Tp>& __rhs)
|
||||
noexcept(noexcept(__lhs.swap(__rhs)))
|
||||
{ __lhs.swap(__rhs); }
|
||||
|
||||
template<typename _Tp>
|
||||
constexpr optional<decay_t<_Tp>>
|
||||
make_optional(_Tp&& __t)
|
||||
{ return optional<decay_t<_Tp>> { std::forward<_Tp>(__t) }; }
|
||||
|
||||
// @} group optional
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace fundamentals_v1
|
||||
}
|
||||
|
||||
// [X.Y.12]
|
||||
template<typename _Tp>
|
||||
struct hash<experimental::optional<_Tp>>
|
||||
{
|
||||
using result_type = size_t;
|
||||
using argument_type = experimental::optional<_Tp>;
|
||||
|
||||
size_t
|
||||
operator()(const experimental::optional<_Tp>& __t) const
|
||||
noexcept(noexcept(hash<_Tp> {}(*__t)))
|
||||
{
|
||||
// We pick an arbitrary hash for disengaged optionals which hopefully
|
||||
// usual values of _Tp won't typically hash to.
|
||||
constexpr size_t __magic_disengaged_hash = static_cast<size_t>(-3333);
|
||||
return __t ? hash<_Tp> {}(*__t) : __magic_disengaged_hash;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // C++14
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_OPTIONAL
|
||||
73
openflow/usr/include/c++/5/experimental/ratio
Normal file
73
openflow/usr/include/c++/5/experimental/ratio
Normal file
@@ -0,0 +1,73 @@
|
||||
// Variable Templates For ratio -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/ratio
|
||||
* This is a TS C++ Library header.
|
||||
*/
|
||||
|
||||
//
|
||||
// N3932 Variable Templates For Type Traits (Revision 1)
|
||||
//
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_RATIO
|
||||
#define _GLIBCXX_EXPERIMENTAL_RATIO 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus <= 201103L
|
||||
# include <bits/c++14_warning.h>
|
||||
#else
|
||||
|
||||
#include <ratio>
|
||||
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
inline namespace fundamentals_v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
// See C++14 §20.11.5, ratio comparison
|
||||
template <typename _R1, typename _R2>
|
||||
constexpr bool ratio_equal_v = ratio_equal<_R1, _R2>::value;
|
||||
template <typename _R1, typename _R2>
|
||||
constexpr bool ratio_not_equal_v = ratio_not_equal<_R1, _R2>::value;
|
||||
template <typename _R1, typename _R2>
|
||||
constexpr bool ratio_less_v = ratio_less<_R1, _R2>::value;
|
||||
template <typename _R1, typename _R2>
|
||||
constexpr bool ratio_less_equal_v = ratio_less_equal<_R1, _R2>::value;
|
||||
template <typename _R1, typename _R2>
|
||||
constexpr bool ratio_greater_v = ratio_greater<_R1, _R2>::value;
|
||||
template <typename _R1, typename _R2>
|
||||
constexpr bool ratio_greater_equal_v = ratio_greater_equal<_R1, _R2>::value;
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#endif // __cplusplus <= 201103L
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_RATIO
|
||||
693
openflow/usr/include/c++/5/experimental/string_view
Normal file
693
openflow/usr/include/c++/5/experimental/string_view
Normal file
@@ -0,0 +1,693 @@
|
||||
// Components for manipulating non-owning sequences of characters -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/string_view
|
||||
* This is a TS C++ Library header.
|
||||
*/
|
||||
|
||||
//
|
||||
// N3762 basic_string_view library
|
||||
//
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW
|
||||
#define _GLIBCXX_EXPERIMENTAL_STRING_VIEW 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus <= 201103L
|
||||
# include <bits/c++14_warning.h>
|
||||
#else
|
||||
|
||||
#include <string>
|
||||
#include <limits>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
inline namespace fundamentals_v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
#define __cpp_lib_experimental_string_view 201411
|
||||
|
||||
/**
|
||||
* @class basic_string_view <experimental/string_view>
|
||||
* @brief A non-owning reference to a string.
|
||||
*
|
||||
* @ingroup strings
|
||||
* @ingroup sequences
|
||||
* @ingroup experimental
|
||||
*
|
||||
* @tparam _CharT Type of character
|
||||
* @tparam _Traits Traits for character type, defaults to
|
||||
* char_traits<_CharT>.
|
||||
*
|
||||
* A basic_string_view looks like this:
|
||||
*
|
||||
* @code
|
||||
* _CharT* _M_str
|
||||
* size_t _M_len
|
||||
* @endcode
|
||||
*/
|
||||
template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
|
||||
class basic_string_view
|
||||
{
|
||||
public:
|
||||
|
||||
// types
|
||||
using traits_type = _Traits;
|
||||
using value_type = _CharT;
|
||||
using pointer = const _CharT*;
|
||||
using const_pointer = const _CharT*;
|
||||
using reference = const _CharT&;
|
||||
using const_reference = const _CharT&;
|
||||
using const_iterator = const _CharT*;
|
||||
using iterator = const_iterator;
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
using reverse_iterator = const_reverse_iterator;
|
||||
using size_type = size_t;
|
||||
using difference_type = ptrdiff_t;
|
||||
static constexpr size_type npos = size_type(-1);
|
||||
|
||||
// [string.view.cons], construct/copy
|
||||
|
||||
constexpr
|
||||
basic_string_view() noexcept
|
||||
: _M_len{0}, _M_str{nullptr}
|
||||
{ }
|
||||
|
||||
constexpr basic_string_view(const basic_string_view&) noexcept = default;
|
||||
|
||||
template<typename _Allocator>
|
||||
basic_string_view(const basic_string<_CharT, _Traits,
|
||||
_Allocator>& __str) noexcept
|
||||
: _M_len{__str.length()}, _M_str{__str.data()}
|
||||
{ }
|
||||
|
||||
constexpr basic_string_view(const _CharT* __str)
|
||||
: _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
|
||||
_M_str{__str}
|
||||
{ }
|
||||
|
||||
constexpr basic_string_view(const _CharT* __str, size_type __len)
|
||||
: _M_len{__len},
|
||||
_M_str{__str}
|
||||
{ }
|
||||
|
||||
basic_string_view&
|
||||
operator=(const basic_string_view&) noexcept = default;
|
||||
|
||||
// [string.view.iterators], iterators
|
||||
|
||||
constexpr const_iterator
|
||||
begin() const noexcept
|
||||
{ return this->_M_str; }
|
||||
|
||||
constexpr const_iterator
|
||||
end() const noexcept
|
||||
{ return this->_M_str + this->_M_len; }
|
||||
|
||||
constexpr const_iterator
|
||||
cbegin() const noexcept
|
||||
{ return this->_M_str; }
|
||||
|
||||
constexpr const_iterator
|
||||
cend() const noexcept
|
||||
{ return this->_M_str + this->_M_len; }
|
||||
|
||||
const_reverse_iterator
|
||||
rbegin() const noexcept
|
||||
{ return const_reverse_iterator(this->end()); }
|
||||
|
||||
const_reverse_iterator
|
||||
rend() const noexcept
|
||||
{ return const_reverse_iterator(this->begin()); }
|
||||
|
||||
const_reverse_iterator
|
||||
crbegin() const noexcept
|
||||
{ return const_reverse_iterator(this->end()); }
|
||||
|
||||
const_reverse_iterator
|
||||
crend() const noexcept
|
||||
{ return const_reverse_iterator(this->begin()); }
|
||||
|
||||
// [string.view.capacity], capacity
|
||||
|
||||
constexpr size_type
|
||||
size() const noexcept
|
||||
{ return this->_M_len; }
|
||||
|
||||
constexpr size_type
|
||||
length() const noexcept
|
||||
{ return _M_len; }
|
||||
|
||||
constexpr size_type
|
||||
max_size() const noexcept
|
||||
{
|
||||
return (npos - sizeof(size_type) - sizeof(void*))
|
||||
/ sizeof(value_type) / 4;
|
||||
}
|
||||
|
||||
constexpr bool
|
||||
empty() const noexcept
|
||||
{ return this->_M_len == 0; }
|
||||
|
||||
// [string.view.access], element access
|
||||
|
||||
constexpr const _CharT&
|
||||
operator[](size_type __pos) const
|
||||
{
|
||||
// TODO: Assert to restore in a way compatible with the constexpr.
|
||||
// _GLIBCXX_DEBUG_ASSERT(__pos < this->_M_len);
|
||||
return *(this->_M_str + __pos);
|
||||
}
|
||||
|
||||
constexpr const _CharT&
|
||||
at(size_type __pos) const
|
||||
{
|
||||
return __pos < this->_M_len
|
||||
? *(this->_M_str + __pos)
|
||||
: (__throw_out_of_range_fmt(__N("basic_string_view::at: __pos "
|
||||
"(which is %zu) >= this->size() "
|
||||
"(which is %zu)"),
|
||||
__pos, this->size()),
|
||||
*this->_M_str);
|
||||
}
|
||||
|
||||
constexpr const _CharT&
|
||||
front() const
|
||||
{
|
||||
// TODO: Assert to restore in a way compatible with the constexpr.
|
||||
// _GLIBCXX_DEBUG_ASSERT(this->_M_len > 0);
|
||||
return *this->_M_str;
|
||||
}
|
||||
|
||||
constexpr const _CharT&
|
||||
back() const
|
||||
{
|
||||
// TODO: Assert to restore in a way compatible with the constexpr.
|
||||
// _GLIBCXX_DEBUG_ASSERT(this->_M_len > 0);
|
||||
return *(this->_M_str + this->_M_len - 1);
|
||||
}
|
||||
|
||||
constexpr const _CharT*
|
||||
data() const noexcept
|
||||
{ return this->_M_str; }
|
||||
|
||||
// [string.view.modifiers], modifiers:
|
||||
|
||||
void
|
||||
remove_prefix(size_type __n)
|
||||
{
|
||||
_GLIBCXX_DEBUG_ASSERT(this->_M_len >= __n);
|
||||
this->_M_str += __n;
|
||||
this->_M_len -= __n;
|
||||
}
|
||||
|
||||
void
|
||||
remove_suffix(size_type __n)
|
||||
{ this->_M_len -= __n; }
|
||||
|
||||
void
|
||||
swap(basic_string_view& __sv) noexcept
|
||||
{
|
||||
std::swap(this->_M_len, __sv._M_len);
|
||||
std::swap(this->_M_str, __sv._M_str);
|
||||
}
|
||||
|
||||
|
||||
// [string.view.ops], string operations:
|
||||
|
||||
template<typename _Allocator>
|
||||
explicit operator basic_string<_CharT, _Traits, _Allocator>() const
|
||||
{
|
||||
return { this->_M_str, this->_M_len };
|
||||
}
|
||||
|
||||
template<typename _Allocator = std::allocator<_CharT>>
|
||||
basic_string<_CharT, _Traits, _Allocator>
|
||||
to_string(const _Allocator& __alloc = _Allocator()) const
|
||||
{
|
||||
return { this->_M_str, this->_M_len, __alloc };
|
||||
}
|
||||
|
||||
size_type
|
||||
copy(_CharT* __str, size_type __n, size_type __pos = 0) const
|
||||
{
|
||||
__glibcxx_requires_string_len(__str, __n);
|
||||
if (__pos > this->_M_len)
|
||||
__throw_out_of_range_fmt(__N("basic_string_view::copy: __pos "
|
||||
"(which is %zu) > this->size() "
|
||||
"(which is %zu)"),
|
||||
__pos, this->size());
|
||||
size_type __rlen{std::min(__n, size_type{this->_M_len - __pos})};
|
||||
for (auto __begin = this->_M_str + __pos,
|
||||
__end = __begin + __rlen; __begin != __end;)
|
||||
*__str++ = *__begin++;
|
||||
return __rlen;
|
||||
}
|
||||
|
||||
|
||||
// [string.view.ops], string operations:
|
||||
|
||||
constexpr basic_string_view
|
||||
substr(size_type __pos, size_type __n=npos) const
|
||||
{
|
||||
return __pos <= this->_M_len
|
||||
? basic_string_view{this->_M_str + __pos,
|
||||
std::min(__n, size_type{this->_M_len - __pos})}
|
||||
: (__throw_out_of_range_fmt(__N("basic_string_view::substr: __pos "
|
||||
"(which is %zu) > this->size() "
|
||||
"(which is %zu)"),
|
||||
__pos, this->size()), basic_string_view{});
|
||||
}
|
||||
|
||||
int
|
||||
compare(basic_string_view __str) const noexcept
|
||||
{
|
||||
int __ret = traits_type::compare(this->_M_str, __str._M_str,
|
||||
std::min(this->_M_len, __str._M_len));
|
||||
if (__ret == 0)
|
||||
__ret = _S_compare(this->_M_len, __str._M_len);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int
|
||||
compare(size_type __pos1, size_type __n1, basic_string_view __str) const
|
||||
{ return this->substr(__pos1, __n1).compare(__str); }
|
||||
|
||||
int
|
||||
compare(size_type __pos1, size_type __n1,
|
||||
basic_string_view __str, size_type __pos2, size_type __n2) const
|
||||
{ return this->substr(__pos1, __n1).compare(__str.substr(__pos2, __n2)); }
|
||||
|
||||
int
|
||||
compare(const _CharT* __str) const noexcept
|
||||
{ return this->compare(basic_string_view{__str}); }
|
||||
|
||||
int
|
||||
compare(size_type __pos1, size_type __n1, const _CharT* __str) const
|
||||
{ return this->substr(__pos1, __n1).compare(basic_string_view{__str}); }
|
||||
|
||||
int
|
||||
compare(size_type __pos1, size_type __n1,
|
||||
const _CharT* __str, size_type __n2) const
|
||||
{
|
||||
return this->substr(__pos1, __n1)
|
||||
.compare(basic_string_view(__str, __n2));
|
||||
}
|
||||
|
||||
size_type
|
||||
find(basic_string_view __str, size_type __pos = 0) const noexcept
|
||||
{ return this->find(__str._M_str, __pos, __str._M_len); }
|
||||
|
||||
size_type
|
||||
find(_CharT __c, size_type __pos=0) const noexcept;
|
||||
|
||||
size_type
|
||||
find(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
|
||||
|
||||
size_type
|
||||
find(const _CharT* __str, size_type __pos=0) const noexcept
|
||||
{ return this->find(__str, __pos, traits_type::length(__str)); }
|
||||
|
||||
size_type
|
||||
rfind(basic_string_view __str, size_type __pos = npos) const noexcept
|
||||
{ return this->rfind(__str._M_str, __pos, __str._M_len); }
|
||||
|
||||
size_type
|
||||
rfind(_CharT __c, size_type __pos = npos) const noexcept;
|
||||
|
||||
size_type
|
||||
rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
|
||||
|
||||
size_type
|
||||
rfind(const _CharT* __str, size_type __pos = npos) const noexcept
|
||||
{ return this->rfind(__str, __pos, traits_type::length(__str)); }
|
||||
|
||||
size_type
|
||||
find_first_of(basic_string_view __str, size_type __pos = 0) const noexcept
|
||||
{ return this->find_first_of(__str._M_str, __pos, __str._M_len); }
|
||||
|
||||
size_type
|
||||
find_first_of(_CharT __c, size_type __pos = 0) const noexcept
|
||||
{ return this->find(__c, __pos); }
|
||||
|
||||
size_type
|
||||
find_first_of(const _CharT* __str, size_type __pos, size_type __n) const;
|
||||
|
||||
size_type
|
||||
find_first_of(const _CharT* __str, size_type __pos = 0) const noexcept
|
||||
{ return this->find_first_of(__str, __pos, traits_type::length(__str)); }
|
||||
|
||||
size_type
|
||||
find_last_of(basic_string_view __str,
|
||||
size_type __pos = npos) const noexcept
|
||||
{ return this->find_last_of(__str._M_str, __pos, __str._M_len); }
|
||||
|
||||
size_type
|
||||
find_last_of(_CharT __c, size_type __pos=npos) const noexcept
|
||||
{ return this->rfind(__c, __pos); }
|
||||
|
||||
size_type
|
||||
find_last_of(const _CharT* __str, size_type __pos, size_type __n) const;
|
||||
|
||||
size_type
|
||||
find_last_of(const _CharT* __str, size_type __pos = npos) const noexcept
|
||||
{ return this->find_last_of(__str, __pos, traits_type::length(__str)); }
|
||||
|
||||
size_type
|
||||
find_first_not_of(basic_string_view __str,
|
||||
size_type __pos = 0) const noexcept
|
||||
{ return this->find_first_not_of(__str._M_str, __pos, __str._M_len); }
|
||||
|
||||
size_type
|
||||
find_first_not_of(_CharT __c, size_type __pos = 0) const noexcept;
|
||||
|
||||
size_type
|
||||
find_first_not_of(const _CharT* __str,
|
||||
size_type __pos, size_type __n) const;
|
||||
|
||||
size_type
|
||||
find_first_not_of(const _CharT* __str, size_type __pos = 0) const noexcept
|
||||
{
|
||||
return this->find_first_not_of(__str, __pos,
|
||||
traits_type::length(__str));
|
||||
}
|
||||
|
||||
size_type
|
||||
find_last_not_of(basic_string_view __str,
|
||||
size_type __pos = npos) const noexcept
|
||||
{ return this->find_last_not_of(__str._M_str, __pos, __str._M_len); }
|
||||
|
||||
size_type
|
||||
find_last_not_of(_CharT __c, size_type __pos = npos) const noexcept;
|
||||
|
||||
size_type
|
||||
find_last_not_of(const _CharT* __str,
|
||||
size_type __pos, size_type __n) const;
|
||||
|
||||
size_type
|
||||
find_last_not_of(const _CharT* __str,
|
||||
size_type __pos = npos) const noexcept
|
||||
{
|
||||
return this->find_last_not_of(__str, __pos,
|
||||
traits_type::length(__str));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static constexpr const int
|
||||
_S_compare(size_type __n1, size_type __n2) noexcept
|
||||
{
|
||||
return difference_type{__n1 - __n2} > std::numeric_limits<int>::max()
|
||||
? std::numeric_limits<int>::max()
|
||||
: difference_type{__n1 - __n2} < std::numeric_limits<int>::min()
|
||||
? std::numeric_limits<int>::min()
|
||||
: static_cast<int>(difference_type{__n1 - __n2});
|
||||
}
|
||||
|
||||
size_t _M_len;
|
||||
const _CharT* _M_str;
|
||||
};
|
||||
|
||||
|
||||
// [string.view.comparison], non-member basic_string_view comparison functions
|
||||
|
||||
namespace __detail
|
||||
{
|
||||
// Identity transform to make ADL work with just one argument.
|
||||
// See n3766.html.
|
||||
template<typename _Tp = void>
|
||||
struct __identity
|
||||
{ typedef _Tp type; };
|
||||
|
||||
template<>
|
||||
struct __identity<void>;
|
||||
|
||||
template<typename _Tp>
|
||||
using __idt = typename __identity<_Tp>::type;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator==(basic_string_view<_CharT, _Traits> __x,
|
||||
basic_string_view<_CharT, _Traits> __y) noexcept
|
||||
{ return __x.compare(__y) == 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator==(basic_string_view<_CharT, _Traits> __x,
|
||||
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
|
||||
{ return __x.compare(__y) == 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
|
||||
basic_string_view<_CharT, _Traits> __y) noexcept
|
||||
{ return __x.compare(__y) == 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator!=(basic_string_view<_CharT, _Traits> __x,
|
||||
basic_string_view<_CharT, _Traits> __y) noexcept
|
||||
{ return !(__x == __y); }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator!=(basic_string_view<_CharT, _Traits> __x,
|
||||
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
|
||||
{ return !(__x == __y); }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
|
||||
basic_string_view<_CharT, _Traits> __y) noexcept
|
||||
{ return !(__x == __y); }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator< (basic_string_view<_CharT, _Traits> __x,
|
||||
basic_string_view<_CharT, _Traits> __y) noexcept
|
||||
{ return __x.compare(__y) < 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator< (basic_string_view<_CharT, _Traits> __x,
|
||||
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
|
||||
{ return __x.compare(__y) < 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
|
||||
basic_string_view<_CharT, _Traits> __y) noexcept
|
||||
{ return __x.compare(__y) < 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator> (basic_string_view<_CharT, _Traits> __x,
|
||||
basic_string_view<_CharT, _Traits> __y) noexcept
|
||||
{ return __x.compare(__y) > 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator> (basic_string_view<_CharT, _Traits> __x,
|
||||
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
|
||||
{ return __x.compare(__y) > 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
|
||||
basic_string_view<_CharT, _Traits> __y) noexcept
|
||||
{ return __x.compare(__y) > 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator<=(basic_string_view<_CharT, _Traits> __x,
|
||||
basic_string_view<_CharT, _Traits> __y) noexcept
|
||||
{ return __x.compare(__y) <= 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator<=(basic_string_view<_CharT, _Traits> __x,
|
||||
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
|
||||
{ return __x.compare(__y) <= 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
|
||||
basic_string_view<_CharT, _Traits> __y) noexcept
|
||||
{ return __x.compare(__y) <= 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator>=(basic_string_view<_CharT, _Traits> __x,
|
||||
basic_string_view<_CharT, _Traits> __y) noexcept
|
||||
{ return __x.compare(__y) >= 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator>=(basic_string_view<_CharT, _Traits> __x,
|
||||
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
|
||||
{ return __x.compare(__y) >= 0; }
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline bool
|
||||
operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
|
||||
basic_string_view<_CharT, _Traits> __y) noexcept
|
||||
{ return __x.compare(__y) >= 0; }
|
||||
|
||||
// [string.view.io], Inserters and extractors
|
||||
template<typename _CharT, typename _Traits>
|
||||
inline basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
basic_string_view<_CharT,_Traits> __str)
|
||||
{ return __ostream_insert(__os, __str.data(), __str.size()); }
|
||||
|
||||
|
||||
// basic_string_view typedef names
|
||||
|
||||
using string_view = basic_string_view<char>;
|
||||
#ifdef _GLIBCXX_USE_WCHAR_T
|
||||
using wstring_view = basic_string_view<wchar_t>;
|
||||
#endif
|
||||
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
|
||||
using u16string_view = basic_string_view<char16_t>;
|
||||
using u32string_view = basic_string_view<char32_t>;
|
||||
#endif
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
|
||||
|
||||
// [string.view.hash], hash support:
|
||||
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
template<typename _Tp>
|
||||
struct hash;
|
||||
|
||||
template<>
|
||||
struct hash<experimental::string_view>
|
||||
: public __hash_base<size_t, experimental::string_view>
|
||||
{
|
||||
size_t
|
||||
operator()(const experimental::string_view& __str) const noexcept
|
||||
{ return std::_Hash_impl::hash(__str.data(), __str.length()); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_fast_hash<hash<experimental::string_view>> : std::false_type
|
||||
{ };
|
||||
|
||||
#ifdef _GLIBCXX_USE_WCHAR_T
|
||||
template<>
|
||||
struct hash<experimental::wstring_view>
|
||||
: public __hash_base<size_t, wstring>
|
||||
{
|
||||
size_t
|
||||
operator()(const experimental::wstring_view& __s) const noexcept
|
||||
{ return std::_Hash_impl::hash(__s.data(),
|
||||
__s.length() * sizeof(wchar_t)); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_fast_hash<hash<experimental::wstring_view>> : std::false_type
|
||||
{ };
|
||||
#endif
|
||||
|
||||
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
|
||||
template<>
|
||||
struct hash<experimental::u16string_view>
|
||||
: public __hash_base<size_t, experimental::u16string_view>
|
||||
{
|
||||
size_t
|
||||
operator()(const experimental::u16string_view& __s) const noexcept
|
||||
{ return std::_Hash_impl::hash(__s.data(),
|
||||
__s.length() * sizeof(char16_t)); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_fast_hash<hash<experimental::u16string_view>> : std::false_type
|
||||
{ };
|
||||
|
||||
template<>
|
||||
struct hash<experimental::u32string_view>
|
||||
: public __hash_base<size_t, experimental::u32string_view>
|
||||
{
|
||||
size_t
|
||||
operator()(const experimental::u32string_view& __s) const noexcept
|
||||
{ return std::_Hash_impl::hash(__s.data(),
|
||||
__s.length() * sizeof(char32_t)); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct __is_fast_hash<hash<experimental::u32string_view>> : std::false_type
|
||||
{ };
|
||||
#endif
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
|
||||
namespace experimental
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
// I added these EMSR.
|
||||
inline namespace literals
|
||||
{
|
||||
inline namespace string_view_literals
|
||||
{
|
||||
|
||||
inline constexpr basic_string_view<char>
|
||||
operator""sv(const char* __str, size_t __len)
|
||||
{ return basic_string_view<char>{__str, __len}; }
|
||||
|
||||
#ifdef _GLIBCXX_USE_WCHAR_T
|
||||
inline constexpr basic_string_view<wchar_t>
|
||||
operator""sv(const wchar_t* __str, size_t __len)
|
||||
{ return basic_string_view<wchar_t>{__str, __len}; }
|
||||
#endif
|
||||
|
||||
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
|
||||
inline constexpr basic_string_view<char16_t>
|
||||
operator""sv(const char16_t* __str, size_t __len)
|
||||
{ return basic_string_view<char16_t>{__str, __len}; }
|
||||
|
||||
inline constexpr basic_string_view<char32_t>
|
||||
operator""sv(const char32_t* __str, size_t __len)
|
||||
{ return basic_string_view<char32_t>{__str, __len}; }
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#include <experimental/string_view.tcc>
|
||||
|
||||
#endif // __cplusplus <= 201103L
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_STRING_VIEW
|
||||
230
openflow/usr/include/c++/5/experimental/string_view.tcc
Normal file
230
openflow/usr/include/c++/5/experimental/string_view.tcc
Normal file
@@ -0,0 +1,230 @@
|
||||
// Components for manipulating non-owning sequences of characters -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/string_view.tcc
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{experimental/string_view}
|
||||
*/
|
||||
|
||||
//
|
||||
// N3762 basic_string_view library
|
||||
//
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC
|
||||
#define _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus <= 201103L
|
||||
# include <bits/c++14_warning.h>
|
||||
#else
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_string_view<_CharT, _Traits>::size_type
|
||||
basic_string_view<_CharT, _Traits>::
|
||||
find(const _CharT* __str, size_type __pos, size_type __n) const noexcept
|
||||
{
|
||||
__glibcxx_requires_string_len(__str, __n);
|
||||
|
||||
if (__n == 0)
|
||||
return __pos <= this->_M_len ? __pos : npos;
|
||||
|
||||
if (__n <= this->_M_len)
|
||||
{
|
||||
for (; __pos <= this->_M_len - __n; ++__pos)
|
||||
if (traits_type::eq(this->_M_str[__pos], __str[0])
|
||||
&& traits_type::compare(this->_M_str + __pos + 1,
|
||||
__str + 1, __n - 1) == 0)
|
||||
return __pos;
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_string_view<_CharT, _Traits>::size_type
|
||||
basic_string_view<_CharT, _Traits>::
|
||||
find(_CharT __c, size_type __pos) const noexcept
|
||||
{
|
||||
size_type __ret = npos;
|
||||
if (__pos < this->_M_len)
|
||||
{
|
||||
const size_type __n = this->_M_len - __pos;
|
||||
const _CharT* __p = traits_type::find(this->_M_str + __pos, __n, __c);
|
||||
if (__p)
|
||||
__ret = __p - this->_M_str;
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_string_view<_CharT, _Traits>::size_type
|
||||
basic_string_view<_CharT, _Traits>::
|
||||
rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept
|
||||
{
|
||||
__glibcxx_requires_string_len(__str, __n);
|
||||
|
||||
if (__n <= this->_M_len)
|
||||
{
|
||||
__pos = std::min(size_type(this->_M_len - __n), __pos);
|
||||
do
|
||||
{
|
||||
if (traits_type::compare(this->_M_str + __pos, __str, __n) == 0)
|
||||
return __pos;
|
||||
}
|
||||
while (__pos-- > 0);
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_string_view<_CharT, _Traits>::size_type
|
||||
basic_string_view<_CharT, _Traits>::
|
||||
rfind(_CharT __c, size_type __pos) const noexcept
|
||||
{
|
||||
size_type __size = this->_M_len;
|
||||
if (__size > 0)
|
||||
{
|
||||
if (--__size > __pos)
|
||||
__size = __pos;
|
||||
for (++__size; __size-- > 0; )
|
||||
if (traits_type::eq(this->_M_str[__size], __c))
|
||||
return __size;
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_string_view<_CharT, _Traits>::size_type
|
||||
basic_string_view<_CharT, _Traits>::
|
||||
find_first_of(const _CharT* __str, size_type __pos, size_type __n) const
|
||||
{
|
||||
__glibcxx_requires_string_len(__str, __n);
|
||||
for (; __n && __pos < this->_M_len; ++__pos)
|
||||
{
|
||||
const _CharT* __p = traits_type::find(__str, __n,
|
||||
this->_M_str[__pos]);
|
||||
if (__p)
|
||||
return __pos;
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_string_view<_CharT, _Traits>::size_type
|
||||
basic_string_view<_CharT, _Traits>::
|
||||
find_last_of(const _CharT* __str, size_type __pos, size_type __n) const
|
||||
{
|
||||
__glibcxx_requires_string_len(__str, __n);
|
||||
size_type __size = this->size();
|
||||
if (__size && __n)
|
||||
{
|
||||
if (--__size > __pos)
|
||||
__size = __pos;
|
||||
do
|
||||
{
|
||||
if (traits_type::find(__str, __n, this->_M_str[__size]))
|
||||
return __size;
|
||||
}
|
||||
while (__size-- != 0);
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_string_view<_CharT, _Traits>::size_type
|
||||
basic_string_view<_CharT, _Traits>::
|
||||
find_first_not_of(const _CharT* __str, size_type __pos, size_type __n) const
|
||||
{
|
||||
__glibcxx_requires_string_len(__str, __n);
|
||||
for (; __pos < this->_M_len; ++__pos)
|
||||
if (!traits_type::find(__str, __n, this->_M_str[__pos]))
|
||||
return __pos;
|
||||
return npos;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_string_view<_CharT, _Traits>::size_type
|
||||
basic_string_view<_CharT, _Traits>::
|
||||
find_first_not_of(_CharT __c, size_type __pos) const noexcept
|
||||
{
|
||||
for (; __pos < this->_M_len; ++__pos)
|
||||
if (!traits_type::eq(this->_M_str[__pos], __c))
|
||||
return __pos;
|
||||
return npos;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_string_view<_CharT, _Traits>::size_type
|
||||
basic_string_view<_CharT, _Traits>::
|
||||
find_last_not_of(const _CharT* __str, size_type __pos, size_type __n) const
|
||||
{
|
||||
__glibcxx_requires_string_len(__str, __n);
|
||||
size_type __size = this->_M_len;
|
||||
if (__size)
|
||||
{
|
||||
if (--__size > __pos)
|
||||
__size = __pos;
|
||||
do
|
||||
{
|
||||
if (!traits_type::find(__str, __n, this->_M_str[__size]))
|
||||
return __size;
|
||||
}
|
||||
while (__size--);
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_string_view<_CharT, _Traits>::size_type
|
||||
basic_string_view<_CharT, _Traits>::
|
||||
find_last_not_of(_CharT __c, size_type __pos) const noexcept
|
||||
{
|
||||
size_type __size = this->_M_len;
|
||||
if (__size)
|
||||
{
|
||||
if (--__size > __pos)
|
||||
__size = __pos;
|
||||
do
|
||||
{
|
||||
if (!traits_type::eq(this->_M_str[__size], __c))
|
||||
return __size;
|
||||
}
|
||||
while (__size--);
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#endif // __cplusplus <= 201103L
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC
|
||||
65
openflow/usr/include/c++/5/experimental/system_error
Normal file
65
openflow/usr/include/c++/5/experimental/system_error
Normal file
@@ -0,0 +1,65 @@
|
||||
// Variable Templates For system_error -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/system_error
|
||||
* This is a TS C++ Library header.
|
||||
*/
|
||||
|
||||
//
|
||||
// N3932 Variable Templates For Type Traits (Revision 1)
|
||||
//
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_SYSTEM_ERROR
|
||||
#define _GLIBCXX_EXPERIMENTAL_SYSTEM_ERROR 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus <= 201103L
|
||||
# include <bits/c++14_warning.h>
|
||||
#else
|
||||
|
||||
#include <system_error>
|
||||
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
inline namespace fundamentals_v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
// See C++14 §19.5, System error support
|
||||
template <typename _Tp>
|
||||
constexpr bool is_error_code_enum_v = is_error_code_enum<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_error_condition_enum_v =
|
||||
is_error_condition_enum<_Tp>::value;
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#endif // __cplusplus <= 201103L
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_SYSTEM_ERROR
|
||||
78
openflow/usr/include/c++/5/experimental/tuple
Normal file
78
openflow/usr/include/c++/5/experimental/tuple
Normal file
@@ -0,0 +1,78 @@
|
||||
// <experimental/tuple> -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/tuple
|
||||
* This is a TS C++ Library header.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_TUPLE
|
||||
#define _GLIBCXX_EXPERIMENTAL_TUPLE 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus <= 201103L
|
||||
# include <bits/c++14_warning.h>
|
||||
#else
|
||||
|
||||
#include <tuple>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
inline namespace fundamentals_v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
// See C++14 §20.4.2.5, tuple helper classes
|
||||
template <typename _Tp>
|
||||
constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
|
||||
|
||||
#define __cpp_lib_experimental_tuple 201402
|
||||
|
||||
template <typename _Fn, typename _Tuple, std::size_t... _Idx>
|
||||
constexpr decltype(auto)
|
||||
__apply_impl(_Fn&& f, _Tuple&& t, std::index_sequence<_Idx...>)
|
||||
{
|
||||
return std::forward<_Fn>(f)(std::get<_Idx>(std::forward<_Tuple>(t))...);
|
||||
}
|
||||
|
||||
template <typename _Fn, typename _Tuple>
|
||||
constexpr decltype(auto)
|
||||
apply(_Fn&& f, _Tuple&& t)
|
||||
{
|
||||
using _Indices =
|
||||
std::make_index_sequence<std::tuple_size<std::decay_t<_Tuple>>::value>;
|
||||
return __apply_impl(std::forward<_Fn>(f), std::forward<_Tuple>(t),
|
||||
_Indices{});
|
||||
}
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#endif // C++14
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_TUPLE
|
||||
228
openflow/usr/include/c++/5/experimental/type_traits
Normal file
228
openflow/usr/include/c++/5/experimental/type_traits
Normal file
@@ -0,0 +1,228 @@
|
||||
// Variable Templates For Type Traits -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file experimental/type_traits
|
||||
* This is a TS C++ Library header.
|
||||
*/
|
||||
|
||||
//
|
||||
// N3932 Variable Templates For Type Traits (Revision 1)
|
||||
//
|
||||
|
||||
#ifndef _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS
|
||||
#define _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#if __cplusplus <= 201103L
|
||||
# include <bits/c++14_warning.h>
|
||||
#else
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace experimental
|
||||
{
|
||||
inline namespace fundamentals_v1
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
#define __cpp_lib_experimental_type_trait_variable_templates 201402
|
||||
|
||||
// See C++14 §20.10.4.1, primary type categories
|
||||
template <typename _Tp>
|
||||
constexpr bool is_void_v = is_void<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_integral_v = is_integral<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_array_v = is_array<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_pointer_v = is_pointer<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_member_object_pointer_v =
|
||||
is_member_object_pointer<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_member_function_pointer_v =
|
||||
is_member_function_pointer<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_enum_v = is_enum<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_union_v = is_union<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_class_v = is_class<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_function_v = is_function<_Tp>::value;
|
||||
|
||||
// See C++14 §20.10.4.2, composite type categories
|
||||
template <typename _Tp>
|
||||
constexpr bool is_reference_v = is_reference<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_object_v = is_object<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_scalar_v = is_scalar<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_compound_v = is_compound<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
|
||||
|
||||
// See C++14 §20.10.4.3, type properties
|
||||
template <typename _Tp>
|
||||
constexpr bool is_const_v = is_const<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_volatile_v = is_volatile<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_trivial_v = is_trivial<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_pod_v = is_pod<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_empty_v = is_empty<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_abstract_v = is_abstract<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_final_v = is_final<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_signed_v = is_signed<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;
|
||||
template <typename _Tp, typename... _Args>
|
||||
constexpr bool is_constructible_v = is_constructible<_Tp, _Args...>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_default_constructible_v =
|
||||
is_default_constructible<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value;
|
||||
template <typename _Tp, typename _Up>
|
||||
constexpr bool is_assignable_v = is_assignable<_Tp, _Up>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_destructible_v = is_destructible<_Tp>::value;
|
||||
template <typename _Tp, typename... _Args>
|
||||
constexpr bool is_trivially_constructible_v =
|
||||
is_trivially_constructible<_Tp, _Args...>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_trivially_default_constructible_v =
|
||||
is_trivially_default_constructible<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_trivially_copy_constructible_v =
|
||||
is_trivially_copy_constructible<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_trivially_move_constructible_v =
|
||||
is_trivially_move_constructible<_Tp>::value;
|
||||
template <typename _Tp, typename _Up>
|
||||
constexpr bool is_trivially_assignable_v =
|
||||
is_trivially_assignable<_Tp, _Up>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_trivially_copy_assignable_v =
|
||||
is_trivially_copy_assignable<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_trivially_move_assignable_v =
|
||||
is_trivially_move_assignable<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_trivially_destructible_v =
|
||||
is_trivially_destructible<_Tp>::value;
|
||||
template <typename _Tp, typename... _Args>
|
||||
constexpr bool is_nothrow_constructible_v =
|
||||
is_nothrow_constructible<_Tp, _Args...>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_nothrow_default_constructible_v =
|
||||
is_nothrow_default_constructible<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_nothrow_copy_constructible_v =
|
||||
is_nothrow_copy_constructible<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_nothrow_move_constructible_v =
|
||||
is_nothrow_move_constructible<_Tp>::value;
|
||||
template <typename _Tp, typename _Up>
|
||||
constexpr bool is_nothrow_assignable_v =
|
||||
is_nothrow_assignable<_Tp, _Up>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_nothrow_copy_assignable_v =
|
||||
is_nothrow_copy_assignable<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_nothrow_move_assignable_v =
|
||||
is_nothrow_move_assignable<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool is_nothrow_destructible_v =
|
||||
is_nothrow_destructible<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr bool has_virtual_destructor_v =
|
||||
has_virtual_destructor<_Tp>::value;
|
||||
|
||||
// See C++14 §20.10.5, type property queries
|
||||
template <typename _Tp>
|
||||
constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
constexpr size_t rank_v = rank<_Tp>::value;
|
||||
template <typename _Tp, unsigned _Idx = 0>
|
||||
constexpr size_t extent_v = extent<_Tp, _Idx>::value;
|
||||
|
||||
// See C++14 §20.10.6, type relations
|
||||
template <typename _Tp, typename _Up>
|
||||
constexpr bool is_same_v = is_same<_Tp, _Up>::value;
|
||||
template <typename _Base, typename _Derived>
|
||||
constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value;
|
||||
template <typename _From, typename _To>
|
||||
constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
|
||||
|
||||
|
||||
// 3.3.2, Other type transformations
|
||||
// invocation_type (still unimplemented)
|
||||
// raw_invocation_type (still unimplemented)
|
||||
// invocation_type_t (still unimplemented)
|
||||
// raw_invocation_type_t (still unimplemented)
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
#endif // __cplusplus <= 201103L
|
||||
|
||||
#endif // _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS
|
||||
Reference in New Issue
Block a user