aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbugaevskiy <bugaevskiy@yandex-team.com>2022-07-25 10:20:04 +0300
committerbugaevskiy <bugaevskiy@yandex-team.com>2022-07-25 10:20:04 +0300
commit81cb05cecc7fbf7612c331cda57c4a1ce9175372 (patch)
tree37e36c692130b0bf9390604fdf9839059b838aea
parent5be2cb45c6c00449b1e679e430c78d0662e25830 (diff)
downloadydb-81cb05cecc7fbf7612c331cda57c4a1ce9175372.tar.gz
Reimport boost/utility as a separate project
-rw-r--r--CMakeLists.darwin.txt1
-rw-r--r--CMakeLists.linux.txt1
-rw-r--r--contrib/restricted/boost/CMakeLists.txt1
-rw-r--r--contrib/restricted/boost/boost/detail/ob_compressed_pair.hpp499
-rw-r--r--contrib/restricted/boost/boost/utility/detail/minstd_rand.hpp55
-rw-r--r--contrib/restricted/boost/boost/utility/string_ref.hpp553
-rw-r--r--contrib/restricted/boost/boost/utility/string_view.hpp690
-rw-r--r--contrib/restricted/boost/boost/utility/typed_in_place_factory.hpp77
-rw-r--r--contrib/restricted/boost/utility/CMakeLists.txt23
-rw-r--r--contrib/restricted/boost/utility/include/boost/call_traits.hpp (renamed from contrib/restricted/boost/boost/call_traits.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/compressed_pair.hpp (renamed from contrib/restricted/boost/boost/compressed_pair.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/detail/call_traits.hpp (renamed from contrib/restricted/boost/boost/detail/call_traits.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/detail/compressed_pair.hpp (renamed from contrib/restricted/boost/boost/detail/compressed_pair.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/operators.hpp (renamed from contrib/restricted/boost/boost/operators.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/operators_v1.hpp (renamed from contrib/restricted/boost/boost/operators_v1.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility.hpp (renamed from contrib/restricted/boost/boost/utility.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility/base_from_member.hpp (renamed from contrib/restricted/boost/boost/utility/base_from_member.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility/binary.hpp (renamed from contrib/restricted/boost/boost/utility/binary.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility/compare_pointees.hpp (renamed from contrib/restricted/boost/boost/utility/compare_pointees.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility/detail/in_place_factory_prefix.hpp (renamed from contrib/restricted/boost/boost/utility/detail/in_place_factory_prefix.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility/detail/in_place_factory_suffix.hpp (renamed from contrib/restricted/boost/boost/utility/detail/in_place_factory_suffix.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility/detail/result_of_iterate.hpp (renamed from contrib/restricted/boost/boost/utility/detail/result_of_iterate.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility/identity_type.hpp (renamed from contrib/restricted/boost/boost/utility/identity_type.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility/in_place_factory.hpp (renamed from contrib/restricted/boost/boost/utility/in_place_factory.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility/result_of.hpp (renamed from contrib/restricted/boost/boost/utility/result_of.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility/string_ref_fwd.hpp (renamed from contrib/restricted/boost/boost/utility/string_ref_fwd.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility/string_view_fwd.hpp (renamed from contrib/restricted/boost/boost/utility/string_view_fwd.hpp)0
-rw-r--r--contrib/restricted/boost/utility/include/boost/utility/value_init.hpp (renamed from contrib/restricted/boost/boost/utility/value_init.hpp)0
28 files changed, 26 insertions, 1874 deletions
diff --git a/CMakeLists.darwin.txt b/CMakeLists.darwin.txt
index cce2ec0e5c..8663209280 100644
--- a/CMakeLists.darwin.txt
+++ b/CMakeLists.darwin.txt
@@ -148,6 +148,7 @@ add_subdirectory(contrib/restricted/boost/mp11)
add_subdirectory(contrib/restricted/boost/predef)
add_subdirectory(contrib/restricted/boost/preprocessor)
add_subdirectory(contrib/restricted/boost/type_traits)
+add_subdirectory(contrib/restricted/boost/utility)
add_subdirectory(contrib/restricted/boost/vmd)
add_subdirectory(contrib/restricted/boost/winapi)
add_subdirectory(contrib/restricted/fast_float)
diff --git a/CMakeLists.linux.txt b/CMakeLists.linux.txt
index c3f8622c4b..7e8ce0f4ea 100644
--- a/CMakeLists.linux.txt
+++ b/CMakeLists.linux.txt
@@ -226,6 +226,7 @@ add_subdirectory(contrib/restricted/boost/mp11)
add_subdirectory(contrib/restricted/boost/predef)
add_subdirectory(contrib/restricted/boost/preprocessor)
add_subdirectory(contrib/restricted/boost/type_traits)
+add_subdirectory(contrib/restricted/boost/utility)
add_subdirectory(contrib/restricted/boost/vmd)
add_subdirectory(contrib/restricted/boost/winapi)
add_subdirectory(contrib/restricted/fast_float)
diff --git a/contrib/restricted/boost/CMakeLists.txt b/contrib/restricted/boost/CMakeLists.txt
index 14d5f969fa..e9d502974b 100644
--- a/contrib/restricted/boost/CMakeLists.txt
+++ b/contrib/restricted/boost/CMakeLists.txt
@@ -28,6 +28,7 @@ target_link_libraries(contrib-restricted-boost INTERFACE
restricted-boost-static_assert
restricted-boost-throw_exception
restricted-boost-type_traits
+ restricted-boost-utility
restricted-boost-vmd
restricted-boost-winapi
)
diff --git a/contrib/restricted/boost/boost/detail/ob_compressed_pair.hpp b/contrib/restricted/boost/boost/detail/ob_compressed_pair.hpp
deleted file mode 100644
index 326e454980..0000000000
--- a/contrib/restricted/boost/boost/detail/ob_compressed_pair.hpp
+++ /dev/null
@@ -1,499 +0,0 @@
-// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
-// Use, modification and distribution are subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt).
-//
-// See http://www.boost.org/libs/utility for most recent version including documentation.
-// see libs/utility/compressed_pair.hpp
-//
-/* Release notes:
- 20 Jan 2001:
- Fixed obvious bugs (David Abrahams)
- 07 Oct 2000:
- Added better single argument constructor support.
- 03 Oct 2000:
- Added VC6 support (JM).
- 23rd July 2000:
- Additional comments added. (JM)
- Jan 2000:
- Original version: this version crippled for use with crippled compilers
- - John Maddock Jan 2000.
-*/
-
-
-#ifndef BOOST_OB_COMPRESSED_PAIR_HPP
-#define BOOST_OB_COMPRESSED_PAIR_HPP
-
-#include <algorithm>
-#ifndef BOOST_OBJECT_TYPE_TRAITS_HPP
-#include <boost/type_traits/object_traits.hpp>
-#endif
-#ifndef BOOST_SAME_TRAITS_HPP
-#include <boost/type_traits/same_traits.hpp>
-#endif
-#ifndef BOOST_CALL_TRAITS_HPP
-#include <boost/call_traits.hpp>
-#endif
-
-namespace boost
-{
-#ifdef BOOST_MSVC6_MEMBER_TEMPLATES
-//
-// use member templates to emulate
-// partial specialisation. Note that due to
-// problems with overload resolution with VC6
-// each of the compressed_pair versions that follow
-// have one template single-argument constructor
-// in place of two specific constructors:
-//
-
-template <class T1, class T2>
-class compressed_pair;
-
-namespace detail{
-
-template <class A, class T1, class T2>
-struct best_conversion_traits
-{
- typedef char one;
- typedef char (&two)[2];
- static A a;
- static one test(T1);
- static two test(T2);
-
- enum { value = sizeof(test(a)) };
-};
-
-template <int>
-struct init_one;
-
-template <>
-struct init_one<1>
-{
- template <class A, class T1, class T2>
- static void init(const A& a, T1* p1, T2*)
- {
- *p1 = a;
- }
-};
-
-template <>
-struct init_one<2>
-{
- template <class A, class T1, class T2>
- static void init(const A& a, T1*, T2* p2)
- {
- *p2 = a;
- }
-};
-
-
-// T1 != T2, both non-empty
-template <class T1, class T2>
-class compressed_pair_0
-{
-private:
- T1 _first;
- T2 _second;
-public:
- typedef T1 first_type;
- typedef T2 second_type;
- typedef typename call_traits<first_type>::param_type first_param_type;
- typedef typename call_traits<second_type>::param_type second_param_type;
- typedef typename call_traits<first_type>::reference first_reference;
- typedef typename call_traits<second_type>::reference second_reference;
- typedef typename call_traits<first_type>::const_reference first_const_reference;
- typedef typename call_traits<second_type>::const_reference second_const_reference;
-
- compressed_pair_0() : _first(), _second() {}
- compressed_pair_0(first_param_type x, second_param_type y) : _first(x), _second(y) {}
- template <class A>
- explicit compressed_pair_0(const A& val)
- {
- init_one<best_conversion_traits<A, T1, T2>::value>::init(val, &_first, &_second);
- }
- compressed_pair_0(const ::boost::compressed_pair<T1,T2>& x)
- : _first(x.first()), _second(x.second()) {}
-
-#if 0
- compressed_pair_0& operator=(const compressed_pair_0& x) {
- cout << "assigning compressed pair 0" << endl;
- _first = x._first;
- _second = x._second;
- cout << "finished assigning compressed pair 0" << endl;
- return *this;
- }
-#endif
-
- first_reference first() { return _first; }
- first_const_reference first() const { return _first; }
-
- second_reference second() { return _second; }
- second_const_reference second() const { return _second; }
-
- void swap(compressed_pair_0& y)
- {
- using std::swap;
- swap(_first, y._first);
- swap(_second, y._second);
- }
-};
-
-// T1 != T2, T2 empty
-template <class T1, class T2>
-class compressed_pair_1 : T2
-{
-private:
- T1 _first;
-public:
- typedef T1 first_type;
- typedef T2 second_type;
- typedef typename call_traits<first_type>::param_type first_param_type;
- typedef typename call_traits<second_type>::param_type second_param_type;
- typedef typename call_traits<first_type>::reference first_reference;
- typedef typename call_traits<second_type>::reference second_reference;
- typedef typename call_traits<first_type>::const_reference first_const_reference;
- typedef typename call_traits<second_type>::const_reference second_const_reference;
-
- compressed_pair_1() : T2(), _first() {}
- compressed_pair_1(first_param_type x, second_param_type y) : T2(y), _first(x) {}
-
- template <class A>
- explicit compressed_pair_1(const A& val)
- {
- init_one<best_conversion_traits<A, T1, T2>::value>::init(val, &_first, static_cast<T2*>(this));
- }
-
- compressed_pair_1(const ::boost::compressed_pair<T1,T2>& x)
- : T2(x.second()), _first(x.first()) {}
-
- first_reference first() { return _first; }
- first_const_reference first() const { return _first; }
-
- second_reference second() { return *this; }
- second_const_reference second() const { return *this; }
-
- void swap(compressed_pair_1& y)
- {
- // no need to swap empty base class:
- using std::swap;
- swap(_first, y._first);
- }
-};
-
-// T1 != T2, T1 empty
-template <class T1, class T2>
-class compressed_pair_2 : T1
-{
-private:
- T2 _second;
-public:
- typedef T1 first_type;
- typedef T2 second_type;
- typedef typename call_traits<first_type>::param_type first_param_type;
- typedef typename call_traits<second_type>::param_type second_param_type;
- typedef typename call_traits<first_type>::reference first_reference;
- typedef typename call_traits<second_type>::reference second_reference;
- typedef typename call_traits<first_type>::const_reference first_const_reference;
- typedef typename call_traits<second_type>::const_reference second_const_reference;
-
- compressed_pair_2() : T1(), _second() {}
- compressed_pair_2(first_param_type x, second_param_type y) : T1(x), _second(y) {}
- template <class A>
- explicit compressed_pair_2(const A& val)
- {
- init_one<best_conversion_traits<A, T1, T2>::value>::init(val, static_cast<T1*>(this), &_second);
- }
- compressed_pair_2(const ::boost::compressed_pair<T1,T2>& x)
- : T1(x.first()), _second(x.second()) {}
-
-#if 0
- compressed_pair_2& operator=(const compressed_pair_2& x) {
- cout << "assigning compressed pair 2" << endl;
- T1::operator=(x);
- _second = x._second;
- cout << "finished assigning compressed pair 2" << endl;
- return *this;
- }
-#endif
- first_reference first() { return *this; }
- first_const_reference first() const { return *this; }
-
- second_reference second() { return _second; }
- second_const_reference second() const { return _second; }
-
- void swap(compressed_pair_2& y)
- {
- // no need to swap empty base class:
- using std::swap;
- swap(_second, y._second);
- }
-};
-
-// T1 != T2, both empty
-template <class T1, class T2>
-class compressed_pair_3 : T1, T2
-{
-public:
- typedef T1 first_type;
- typedef T2 second_type;
- typedef typename call_traits<first_type>::param_type first_param_type;
- typedef typename call_traits<second_type>::param_type second_param_type;
- typedef typename call_traits<first_type>::reference first_reference;
- typedef typename call_traits<second_type>::reference second_reference;
- typedef typename call_traits<first_type>::const_reference first_const_reference;
- typedef typename call_traits<second_type>::const_reference second_const_reference;
-
- compressed_pair_3() : T1(), T2() {}
- compressed_pair_3(first_param_type x, second_param_type y) : T1(x), T2(y) {}
- template <class A>
- explicit compressed_pair_3(const A& val)
- {
- init_one<best_conversion_traits<A, T1, T2>::value>::init(val, static_cast<T1*>(this), static_cast<T2*>(this));
- }
- compressed_pair_3(const ::boost::compressed_pair<T1,T2>& x)
- : T1(x.first()), T2(x.second()) {}
-
- first_reference first() { return *this; }
- first_const_reference first() const { return *this; }
-
- second_reference second() { return *this; }
- second_const_reference second() const { return *this; }
-
- void swap(compressed_pair_3& y)
- {
- // no need to swap empty base classes:
- }
-};
-
-// T1 == T2, and empty
-template <class T1, class T2>
-class compressed_pair_4 : T1
-{
-public:
- typedef T1 first_type;
- typedef T2 second_type;
- typedef typename call_traits<first_type>::param_type first_param_type;
- typedef typename call_traits<second_type>::param_type second_param_type;
- typedef typename call_traits<first_type>::reference first_reference;
- typedef typename call_traits<second_type>::reference second_reference;
- typedef typename call_traits<first_type>::const_reference first_const_reference;
- typedef typename call_traits<second_type>::const_reference second_const_reference;
-
- compressed_pair_4() : T1() {}
- compressed_pair_4(first_param_type x, second_param_type y) : T1(x), m_second(y) {}
- // only one single argument constructor since T1 == T2
- explicit compressed_pair_4(first_param_type x) : T1(x), m_second(x) {}
- compressed_pair_4(const ::boost::compressed_pair<T1,T2>& x)
- : T1(x.first()), m_second(x.second()) {}
-
- first_reference first() { return *this; }
- first_const_reference first() const { return *this; }
-
- second_reference second() { return m_second; }
- second_const_reference second() const { return m_second; }
-
- void swap(compressed_pair_4& y)
- {
- // no need to swap empty base classes:
- }
-private:
- T2 m_second;
-};
-
-// T1 == T2, not empty
-template <class T1, class T2>
-class compressed_pair_5
-{
-private:
- T1 _first;
- T2 _second;
-public:
- typedef T1 first_type;
- typedef T2 second_type;
- typedef typename call_traits<first_type>::param_type first_param_type;
- typedef typename call_traits<second_type>::param_type second_param_type;
- typedef typename call_traits<first_type>::reference first_reference;
- typedef typename call_traits<second_type>::reference second_reference;
- typedef typename call_traits<first_type>::const_reference first_const_reference;
- typedef typename call_traits<second_type>::const_reference second_const_reference;
-
- compressed_pair_5() : _first(), _second() {}
- compressed_pair_5(first_param_type x, second_param_type y) : _first(x), _second(y) {}
- // only one single argument constructor since T1 == T2
- explicit compressed_pair_5(first_param_type x) : _first(x), _second(x) {}
- compressed_pair_5(const ::boost::compressed_pair<T1,T2>& c)
- : _first(c.first()), _second(c.second()) {}
-
- first_reference first() { return _first; }
- first_const_reference first() const { return _first; }
-
- second_reference second() { return _second; }
- second_const_reference second() const { return _second; }
-
- void swap(compressed_pair_5& y)
- {
- using std::swap;
- swap(_first, y._first);
- swap(_second, y._second);
- }
-};
-
-template <bool e1, bool e2, bool same>
-struct compressed_pair_chooser
-{
- template <class T1, class T2>
- struct rebind
- {
- typedef compressed_pair_0<T1, T2> type;
- };
-};
-
-template <>
-struct compressed_pair_chooser<false, true, false>
-{
- template <class T1, class T2>
- struct rebind
- {
- typedef compressed_pair_1<T1, T2> type;
- };
-};
-
-template <>
-struct compressed_pair_chooser<true, false, false>
-{
- template <class T1, class T2>
- struct rebind
- {
- typedef compressed_pair_2<T1, T2> type;
- };
-};
-
-template <>
-struct compressed_pair_chooser<true, true, false>
-{
- template <class T1, class T2>
- struct rebind
- {
- typedef compressed_pair_3<T1, T2> type;
- };
-};
-
-template <>
-struct compressed_pair_chooser<true, true, true>
-{
- template <class T1, class T2>
- struct rebind
- {
- typedef compressed_pair_4<T1, T2> type;
- };
-};
-
-template <>
-struct compressed_pair_chooser<false, false, true>
-{
- template <class T1, class T2>
- struct rebind
- {
- typedef compressed_pair_5<T1, T2> type;
- };
-};
-
-template <class T1, class T2>
-struct compressed_pair_traits
-{
-private:
- typedef compressed_pair_chooser<is_empty<T1>::value, is_empty<T2>::value, is_same<T1,T2>::value> chooser;
- typedef typename chooser::template rebind<T1, T2> bound_type;
-public:
- typedef typename bound_type::type type;
-};
-
-} // namespace detail
-
-template <class T1, class T2>
-class compressed_pair : public detail::compressed_pair_traits<T1, T2>::type
-{
-private:
- typedef typename detail::compressed_pair_traits<T1, T2>::type base_type;
-public:
- typedef T1 first_type;
- typedef T2 second_type;
- typedef typename call_traits<first_type>::param_type first_param_type;
- typedef typename call_traits<second_type>::param_type second_param_type;
- typedef typename call_traits<first_type>::reference first_reference;
- typedef typename call_traits<second_type>::reference second_reference;
- typedef typename call_traits<first_type>::const_reference first_const_reference;
- typedef typename call_traits<second_type>::const_reference second_const_reference;
-
- compressed_pair() : base_type() {}
- compressed_pair(first_param_type x, second_param_type y) : base_type(x, y) {}
- template <class A>
- explicit compressed_pair(const A& x) : base_type(x){}
-
- first_reference first() { return base_type::first(); }
- first_const_reference first() const { return base_type::first(); }
-
- second_reference second() { return base_type::second(); }
- second_const_reference second() const { return base_type::second(); }
-};
-
-template <class T1, class T2>
-inline void swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y)
-{
- x.swap(y);
-}
-
-#else
-// no partial specialisation, no member templates:
-
-template <class T1, class T2>
-class compressed_pair
-{
-private:
- T1 _first;
- T2 _second;
-public:
- typedef T1 first_type;
- typedef T2 second_type;
- typedef typename call_traits<first_type>::param_type first_param_type;
- typedef typename call_traits<second_type>::param_type second_param_type;
- typedef typename call_traits<first_type>::reference first_reference;
- typedef typename call_traits<second_type>::reference second_reference;
- typedef typename call_traits<first_type>::const_reference first_const_reference;
- typedef typename call_traits<second_type>::const_reference second_const_reference;
-
- compressed_pair() : _first(), _second() {}
- compressed_pair(first_param_type x, second_param_type y) : _first(x), _second(y) {}
- explicit compressed_pair(first_param_type x) : _first(x), _second() {}
- // can't define this in case T1 == T2:
- // explicit compressed_pair(second_param_type y) : _first(), _second(y) {}
-
- first_reference first() { return _first; }
- first_const_reference first() const { return _first; }
-
- second_reference second() { return _second; }
- second_const_reference second() const { return _second; }
-
- void swap(compressed_pair& y)
- {
- using std::swap;
- swap(_first, y._first);
- swap(_second, y._second);
- }
-};
-
-template <class T1, class T2>
-inline void swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y)
-{
- x.swap(y);
-}
-
-#endif
-
-} // boost
-
-#endif // BOOST_OB_COMPRESSED_PAIR_HPP
-
-
-
diff --git a/contrib/restricted/boost/boost/utility/detail/minstd_rand.hpp b/contrib/restricted/boost/boost/utility/detail/minstd_rand.hpp
deleted file mode 100644
index 6c858f6bf3..0000000000
--- a/contrib/restricted/boost/boost/utility/detail/minstd_rand.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef BOOST_UTILITY_DETAIL_MINSTD_RAND_HPP_INCLUDED
-#define BOOST_UTILITY_DETAIL_MINSTD_RAND_HPP_INCLUDED
-
-// Copyright 2017 Peter Dimov
-//
-// Distributed under the Boost Software License, Version 1.0.
-//
-// An implementation of minstd_rand that does not require
-// the Random library
-
-#include <boost/cstdint.hpp>
-
-namespace boost
-{
-namespace detail
-{
-
-class minstd_rand
-{
-private:
-
- boost::uint_least32_t x_;
-
- enum { a = 48271, m = 2147483647 };
-
-public:
-
- minstd_rand(): x_( 1 )
- {
- }
-
- explicit minstd_rand( boost::uint_least32_t x ): x_( x % m )
- {
- if( x_ == 0 )
- {
- x_ = 1;
- }
- }
-
- boost::uint_least32_t operator()()
- {
- boost::uint_least64_t y = x_;
-
- y = ( a * y ) % m;
-
- x_ = static_cast<boost::uint_least32_t>( y );
-
- return x_;
- }
-};
-
-} // namespace detail
-} // namespace boost
-
-#endif // #ifndef BOOST_UTILITY_DETAIL_MINSTD_RAND_HPP_INCLUDED
diff --git a/contrib/restricted/boost/boost/utility/string_ref.hpp b/contrib/restricted/boost/boost/utility/string_ref.hpp
deleted file mode 100644
index d234e5444a..0000000000
--- a/contrib/restricted/boost/boost/utility/string_ref.hpp
+++ /dev/null
@@ -1,553 +0,0 @@
-/*
- Copyright (c) Marshall Clow 2012-2015.
-
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
- For more information, see http://www.boost.org
-
- Based on the StringRef implementation in LLVM (http://llvm.org) and
- N3422 by Jeffrey Yasskin
- http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3442.html
-
-*/
-
-#ifndef BOOST_STRING_REF_HPP
-#define BOOST_STRING_REF_HPP
-
-#include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
-#include <boost/utility/string_ref_fwd.hpp>
-#include <boost/throw_exception.hpp>
-
-#include <cstddef>
-#include <stdexcept>
-#include <algorithm>
-#include <iterator>
-#include <string>
-#include <iosfwd>
-
-#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || (defined(BOOST_GCC) && ((BOOST_GCC+0) / 100) <= 406)
-// GCC 4.6 cannot handle a defaulted function with noexcept specifier
-#define BOOST_STRING_REF_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS
-#endif
-
-namespace boost {
-
- namespace detail {
- // A helper functor because sometimes we don't have lambdas
- template <typename charT, typename traits>
- class string_ref_traits_eq {
- public:
- string_ref_traits_eq ( charT ch ) : ch_(ch) {}
- bool operator () ( charT val ) const { return traits::eq ( ch_, val ); }
- charT ch_;
- };
- }
-
- template<typename charT, typename traits>
- class basic_string_ref {
- public:
- // types
- typedef charT value_type;
- typedef const charT* pointer;
- typedef const charT& reference;
- typedef const charT& const_reference;
- typedef pointer const_iterator; // impl-defined
- typedef const_iterator iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef const_reverse_iterator reverse_iterator;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
- static BOOST_CONSTEXPR_OR_CONST size_type npos = size_type(-1);
-
- // construct/copy
- BOOST_CONSTEXPR basic_string_ref () BOOST_NOEXCEPT
- : ptr_(NULL), len_(0) {}
-
- // by defaulting these functions, basic_string_ref becomes
- // trivially copy/move constructible.
- BOOST_CONSTEXPR basic_string_ref (const basic_string_ref &rhs) BOOST_NOEXCEPT
-#ifndef BOOST_STRING_REF_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS
- = default;
-#else
- : ptr_(rhs.ptr_), len_(rhs.len_) {}
-#endif
-
- basic_string_ref& operator=(const basic_string_ref &rhs) BOOST_NOEXCEPT
-#ifndef BOOST_STRING_REF_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS
- = default;
-#else
- {
- ptr_ = rhs.ptr_;
- len_ = rhs.len_;
- return *this;
- }
-#endif
-
- basic_string_ref(const charT* str) BOOST_NOEXCEPT
- : ptr_(str), len_(traits::length(str)) {}
-
- template<typename Allocator>
- basic_string_ref(const std::basic_string<charT, traits, Allocator>& str)
- : ptr_(str.data()), len_(str.length()) {}
-
-// #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
-// // Constructing a string_ref from a temporary string is a bad idea
-// template<typename Allocator>
-// basic_string_ref( std::basic_string<charT, traits, Allocator>&&)
-// = delete;
-// #endif
-
- BOOST_CONSTEXPR basic_string_ref(const charT* str, size_type len) BOOST_NOEXCEPT
- : ptr_(str), len_(len) {}
-
-#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
- template<typename Allocator>
- explicit operator std::basic_string<charT, traits, Allocator>() const {
- return std::basic_string<charT, traits, Allocator> ( begin(), end());
- }
-#endif
-
- std::basic_string<charT, traits> to_string () const {
- return std::basic_string<charT, traits> ( begin(), end());
- }
-
- // iterators
- BOOST_CONSTEXPR const_iterator begin() const { return ptr_; }
- BOOST_CONSTEXPR const_iterator cbegin() const { return ptr_; }
- BOOST_CONSTEXPR const_iterator end() const { return ptr_ + len_; }
- BOOST_CONSTEXPR const_iterator cend() const { return ptr_ + len_; }
- const_reverse_iterator rbegin() const { return const_reverse_iterator (end()); }
- const_reverse_iterator crbegin() const { return const_reverse_iterator (end()); }
- const_reverse_iterator rend() const { return const_reverse_iterator (begin()); }
- const_reverse_iterator crend() const { return const_reverse_iterator (begin()); }
-
- // capacity
- BOOST_CONSTEXPR size_type size() const { return len_; }
- BOOST_CONSTEXPR size_type length() const { return len_; }
- BOOST_CONSTEXPR size_type max_size() const { return len_; }
- BOOST_CONSTEXPR bool empty() const { return len_ == 0; }
-
- // element access
- BOOST_CONSTEXPR const charT& operator[](size_type pos) const { return ptr_[pos]; }
-
- const charT& at(size_t pos) const {
- if ( pos >= len_ )
- BOOST_THROW_EXCEPTION( std::out_of_range ( "boost::string_ref::at" ) );
- return ptr_[pos];
- }
-
- BOOST_CONSTEXPR const charT& front() const { return ptr_[0]; }
- BOOST_CONSTEXPR const charT& back() const { return ptr_[len_-1]; }
- BOOST_CONSTEXPR const charT* data() const { return ptr_; }
-
- // modifiers
- void clear() { len_ = 0; }
- void remove_prefix(size_type n) {
- if ( n > len_ )
- n = len_;
- ptr_ += n;
- len_ -= n;
- }
-
- void remove_suffix(size_type n) {
- if ( n > len_ )
- n = len_;
- len_ -= n;
- }
-
-
- // basic_string_ref string operations
- basic_string_ref substr(size_type pos, size_type n=npos) const {
- if ( pos > size())
- BOOST_THROW_EXCEPTION( std::out_of_range ( "string_ref::substr" ) );
- return basic_string_ref(data() + pos, (std::min)(size() - pos, n));
- }
-
- int compare(basic_string_ref x) const {
- const int cmp = traits::compare ( ptr_, x.ptr_, (std::min)(len_, x.len_));
- return cmp != 0 ? cmp : ( len_ == x.len_ ? 0 : len_ < x.len_ ? -1 : 1 );
- }
-
- bool starts_with(charT c) const { return !empty() && traits::eq ( c, front()); }
- bool starts_with(basic_string_ref x) const {
- return len_ >= x.len_ && traits::compare ( ptr_, x.ptr_, x.len_ ) == 0;
- }
-
- bool ends_with(charT c) const { return !empty() && traits::eq ( c, back()); }
- bool ends_with(basic_string_ref x) const {
- return len_ >= x.len_ && traits::compare ( ptr_ + len_ - x.len_, x.ptr_, x.len_ ) == 0;
- }
-
- size_type find(basic_string_ref s) const {
- const_iterator iter = std::search ( this->cbegin (), this->cend (),
- s.cbegin (), s.cend (), traits::eq );
- return iter == this->cend () ? npos : std::distance ( this->cbegin (), iter );
- }
-
- size_type find(charT c) const {
- const_iterator iter = std::find_if ( this->cbegin (), this->cend (),
- detail::string_ref_traits_eq<charT, traits> ( c ));
- return iter == this->cend () ? npos : std::distance ( this->cbegin (), iter );
- }
-
- size_type rfind(basic_string_ref s) const {
- const_reverse_iterator iter = std::search ( this->crbegin (), this->crend (),
- s.crbegin (), s.crend (), traits::eq );
- return iter == this->crend () ? npos : (std::distance(iter, this->crend()) - s.size());
- }
-
- size_type rfind(charT c) const {
- const_reverse_iterator iter = std::find_if ( this->crbegin (), this->crend (),
- detail::string_ref_traits_eq<charT, traits> ( c ));
- return iter == this->crend () ? npos : (this->size() - 1 - std::distance(this->crbegin(), iter));
- }
-
- size_type find_first_of(charT c) const { return find (c); }
- size_type find_last_of (charT c) const { return rfind (c); }
-
- size_type find_first_of(basic_string_ref s) const {
- const_iterator iter = std::find_first_of
- ( this->cbegin (), this->cend (), s.cbegin (), s.cend (), traits::eq );
- return iter == this->cend () ? npos : std::distance ( this->cbegin (), iter );
- }
-
- size_type find_last_of(basic_string_ref s) const {
- const_reverse_iterator iter = std::find_first_of
- ( this->crbegin (), this->crend (), s.cbegin (), s.cend (), traits::eq );
- return iter == this->crend () ? npos : (this->size() - 1 - std::distance(this->crbegin(), iter));
- }
-
- size_type find_first_not_of(basic_string_ref s) const {
- const_iterator iter = find_not_of ( this->cbegin (), this->cend (), s );
- return iter == this->cend () ? npos : std::distance ( this->cbegin (), iter );
- }
-
- size_type find_first_not_of(charT c) const {
- for ( const_iterator iter = this->cbegin (); iter != this->cend (); ++iter )
- if ( !traits::eq ( c, *iter ))
- return std::distance ( this->cbegin (), iter );
- return npos;
- }
-
- size_type find_last_not_of(basic_string_ref s) const {
- const_reverse_iterator iter = find_not_of ( this->crbegin (), this->crend (), s );
- return iter == this->crend () ? npos : (this->size() - 1 - std::distance(this->crbegin(), iter));
- }
-
- size_type find_last_not_of(charT c) const {
- for ( const_reverse_iterator iter = this->crbegin (); iter != this->crend (); ++iter )
- if ( !traits::eq ( c, *iter ))
- return this->size() - 1 - std::distance(this->crbegin(), iter);
- return npos;
- }
-
- private:
-
- template <typename Iterator>
- Iterator find_not_of ( Iterator first, Iterator last, basic_string_ref s ) const {
- for ( ; first != last ; ++first )
- if ( 0 == traits::find ( s.ptr_, s.len_, *first ))
- return first;
- return last;
- }
-
-
-
- const charT *ptr_;
- std::size_t len_;
- };
-
-
-// Comparison operators
-// Equality
- template<typename charT, typename traits>
- inline bool operator==(basic_string_ref<charT, traits> x, basic_string_ref<charT, traits> y) {
- if ( x.size () != y.size ()) return false;
- return x.compare(y) == 0;
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline bool operator==(basic_string_ref<charT, traits> x, const std::basic_string<charT, traits, Allocator> & y) {
- return x == basic_string_ref<charT, traits>(y);
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline bool operator==(const std::basic_string<charT, traits, Allocator> & x, basic_string_ref<charT, traits> y) {
- return basic_string_ref<charT, traits>(x) == y;
- }
-
- template<typename charT, typename traits>
- inline bool operator==(basic_string_ref<charT, traits> x, const charT * y) {
- return x == basic_string_ref<charT, traits>(y);
- }
-
- template<typename charT, typename traits>
- inline bool operator==(const charT * x, basic_string_ref<charT, traits> y) {
- return basic_string_ref<charT, traits>(x) == y;
- }
-
-// Inequality
- template<typename charT, typename traits>
- inline bool operator!=(basic_string_ref<charT, traits> x, basic_string_ref<charT, traits> y) {
- if ( x.size () != y.size ()) return true;
- return x.compare(y) != 0;
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline bool operator!=(basic_string_ref<charT, traits> x, const std::basic_string<charT, traits, Allocator> & y) {
- return x != basic_string_ref<charT, traits>(y);
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline bool operator!=(const std::basic_string<charT, traits, Allocator> & x, basic_string_ref<charT, traits> y) {
- return basic_string_ref<charT, traits>(x) != y;
- }
-
- template<typename charT, typename traits>
- inline bool operator!=(basic_string_ref<charT, traits> x, const charT * y) {
- return x != basic_string_ref<charT, traits>(y);
- }
-
- template<typename charT, typename traits>
- inline bool operator!=(const charT * x, basic_string_ref<charT, traits> y) {
- return basic_string_ref<charT, traits>(x) != y;
- }
-
-// Less than
- template<typename charT, typename traits>
- inline bool operator<(basic_string_ref<charT, traits> x, basic_string_ref<charT, traits> y) {
- return x.compare(y) < 0;
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline bool operator<(basic_string_ref<charT, traits> x, const std::basic_string<charT, traits, Allocator> & y) {
- return x < basic_string_ref<charT, traits>(y);
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline bool operator<(const std::basic_string<charT, traits, Allocator> & x, basic_string_ref<charT, traits> y) {
- return basic_string_ref<charT, traits>(x) < y;
- }
-
- template<typename charT, typename traits>
- inline bool operator<(basic_string_ref<charT, traits> x, const charT * y) {
- return x < basic_string_ref<charT, traits>(y);
- }
-
- template<typename charT, typename traits>
- inline bool operator<(const charT * x, basic_string_ref<charT, traits> y) {
- return basic_string_ref<charT, traits>(x) < y;
- }
-
-// Greater than
- template<typename charT, typename traits>
- inline bool operator>(basic_string_ref<charT, traits> x, basic_string_ref<charT, traits> y) {
- return x.compare(y) > 0;
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline bool operator>(basic_string_ref<charT, traits> x, const std::basic_string<charT, traits, Allocator> & y) {
- return x > basic_string_ref<charT, traits>(y);
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline bool operator>(const std::basic_string<charT, traits, Allocator> & x, basic_string_ref<charT, traits> y) {
- return basic_string_ref<charT, traits>(x) > y;
- }
-
- template<typename charT, typename traits>
- inline bool operator>(basic_string_ref<charT, traits> x, const charT * y) {
- return x > basic_string_ref<charT, traits>(y);
- }
-
- template<typename charT, typename traits>
- inline bool operator>(const charT * x, basic_string_ref<charT, traits> y) {
- return basic_string_ref<charT, traits>(x) > y;
- }
-
-// Less than or equal to
- template<typename charT, typename traits>
- inline bool operator<=(basic_string_ref<charT, traits> x, basic_string_ref<charT, traits> y) {
- return x.compare(y) <= 0;
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline bool operator<=(basic_string_ref<charT, traits> x, const std::basic_string<charT, traits, Allocator> & y) {
- return x <= basic_string_ref<charT, traits>(y);
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline bool operator<=(const std::basic_string<charT, traits, Allocator> & x, basic_string_ref<charT, traits> y) {
- return basic_string_ref<charT, traits>(x) <= y;
- }
-
- template<typename charT, typename traits>
- inline bool operator<=(basic_string_ref<charT, traits> x, const charT * y) {
- return x <= basic_string_ref<charT, traits>(y);
- }
-
- template<typename charT, typename traits>
- inline bool operator<=(const charT * x, basic_string_ref<charT, traits> y) {
- return basic_string_ref<charT, traits>(x) <= y;
- }
-
-// Greater than or equal to
- template<typename charT, typename traits>
- inline bool operator>=(basic_string_ref<charT, traits> x, basic_string_ref<charT, traits> y) {
- return x.compare(y) >= 0;
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline bool operator>=(basic_string_ref<charT, traits> x, const std::basic_string<charT, traits, Allocator> & y) {
- return x >= basic_string_ref<charT, traits>(y);
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline bool operator>=(const std::basic_string<charT, traits, Allocator> & x, basic_string_ref<charT, traits> y) {
- return basic_string_ref<charT, traits>(x) >= y;
- }
-
- template<typename charT, typename traits>
- inline bool operator>=(basic_string_ref<charT, traits> x, const charT * y) {
- return x >= basic_string_ref<charT, traits>(y);
- }
-
- template<typename charT, typename traits>
- inline bool operator>=(const charT * x, basic_string_ref<charT, traits> y) {
- return basic_string_ref<charT, traits>(x) >= y;
- }
-
- namespace detail {
-
- template<class charT, class traits>
- inline void sr_insert_fill_chars(std::basic_ostream<charT, traits>& os, std::size_t n) {
- enum { chunk_size = 8 };
- charT fill_chars[chunk_size];
- std::fill_n(fill_chars, static_cast< std::size_t >(chunk_size), os.fill());
- for (; n >= chunk_size && os.good(); n -= chunk_size)
- os.write(fill_chars, static_cast< std::size_t >(chunk_size));
- if (n > 0 && os.good())
- os.write(fill_chars, n);
- }
-
- template<class charT, class traits>
- void sr_insert_aligned(std::basic_ostream<charT, traits>& os, const basic_string_ref<charT,traits>& str) {
- const std::size_t size = str.size();
- const std::size_t alignment_size = static_cast< std::size_t >(os.width()) - size;
- const bool align_left = (os.flags() & std::basic_ostream<charT, traits>::adjustfield) == std::basic_ostream<charT, traits>::left;
- if (!align_left) {
- detail::sr_insert_fill_chars(os, alignment_size);
- if (os.good())
- os.write(str.data(), size);
- }
- else {
- os.write(str.data(), size);
- if (os.good())
- detail::sr_insert_fill_chars(os, alignment_size);
- }
- }
-
- } // namespace detail
-
- // Inserter
- template<class charT, class traits>
- inline std::basic_ostream<charT, traits>&
- operator<<(std::basic_ostream<charT, traits>& os, const basic_string_ref<charT,traits>& str) {
- if (os.good()) {
- const std::size_t size = str.size();
- const std::size_t w = static_cast< std::size_t >(os.width());
- if (w <= size)
- os.write(str.data(), size);
- else
- detail::sr_insert_aligned(os, str);
- os.width(0);
- }
- return os;
- }
-
-#if 0
- // numeric conversions
- //
- // These are short-term implementations.
- // In a production environment, I would rather avoid the copying.
- //
- inline int stoi (string_ref str, size_t* idx=0, int base=10) {
- return std::stoi ( std::string(str), idx, base );
- }
-
- inline long stol (string_ref str, size_t* idx=0, int base=10) {
- return std::stol ( std::string(str), idx, base );
- }
-
- inline unsigned long stoul (string_ref str, size_t* idx=0, int base=10) {
- return std::stoul ( std::string(str), idx, base );
- }
-
- inline long long stoll (string_ref str, size_t* idx=0, int base=10) {
- return std::stoll ( std::string(str), idx, base );
- }
-
- inline unsigned long long stoull (string_ref str, size_t* idx=0, int base=10) {
- return std::stoull ( std::string(str), idx, base );
- }
-
- inline float stof (string_ref str, size_t* idx=0) {
- return std::stof ( std::string(str), idx );
- }
-
- inline double stod (string_ref str, size_t* idx=0) {
- return std::stod ( std::string(str), idx );
- }
-
- inline long double stold (string_ref str, size_t* idx=0) {
- return std::stold ( std::string(str), idx );
- }
-
- inline int stoi (wstring_ref str, size_t* idx=0, int base=10) {
- return std::stoi ( std::wstring(str), idx, base );
- }
-
- inline long stol (wstring_ref str, size_t* idx=0, int base=10) {
- return std::stol ( std::wstring(str), idx, base );
- }
-
- inline unsigned long stoul (wstring_ref str, size_t* idx=0, int base=10) {
- return std::stoul ( std::wstring(str), idx, base );
- }
-
- inline long long stoll (wstring_ref str, size_t* idx=0, int base=10) {
- return std::stoll ( std::wstring(str), idx, base );
- }
-
- inline unsigned long long stoull (wstring_ref str, size_t* idx=0, int base=10) {
- return std::stoull ( std::wstring(str), idx, base );
- }
-
- inline float stof (wstring_ref str, size_t* idx=0) {
- return std::stof ( std::wstring(str), idx );
- }
-
- inline double stod (wstring_ref str, size_t* idx=0) {
- return std::stod ( std::wstring(str), idx );
- }
-
- inline long double stold (wstring_ref str, size_t* idx=0) {
- return std::stold ( std::wstring(str), idx );
- }
-#endif
-
-}
-
-#if 0
-namespace std {
- // Hashing
- template<> struct hash<boost::string_ref>;
- template<> struct hash<boost::u16string_ref>;
- template<> struct hash<boost::u32string_ref>;
- template<> struct hash<boost::wstring_ref>;
-}
-#endif
-
-#endif
diff --git a/contrib/restricted/boost/boost/utility/string_view.hpp b/contrib/restricted/boost/boost/utility/string_view.hpp
deleted file mode 100644
index 09d52d2d34..0000000000
--- a/contrib/restricted/boost/boost/utility/string_view.hpp
+++ /dev/null
@@ -1,690 +0,0 @@
-/*
- Copyright (c) Marshall Clow 2012-2015.
- Copyright (c) Beman Dawes 2015
-
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
- For more information, see http://www.boost.org
-
- Based on the StringRef implementation in LLVM (http://llvm.org) and
- N3422 by Jeffrey Yasskin
- http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3442.html
- Updated July 2015 to reflect the Library Fundamentals TS
- http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4480.html
-*/
-
-#ifndef BOOST_STRING_VIEW_HPP
-#define BOOST_STRING_VIEW_HPP
-
-#include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
-#include <boost/utility/string_view_fwd.hpp>
-#include <boost/throw_exception.hpp>
-
-#include <cstddef>
-#include <stdexcept>
-#include <algorithm>
-#include <iterator>
-#include <string>
-#include <cstring>
-#include <iosfwd>
-
-#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || (defined(BOOST_GCC) && ((BOOST_GCC+0) / 100) <= 406)
-// GCC 4.6 cannot handle a defaulted function with noexcept specifier
-#define BOOST_STRING_VIEW_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS
-#endif
-
-namespace boost {
-
- namespace detail {
- // A helper functor because sometimes we don't have lambdas
- template <typename charT, typename traits>
- class string_view_traits_eq {
- public:
- string_view_traits_eq ( charT ch ) : ch_(ch) {}
- bool operator()( charT val ) const { return traits::eq (ch_, val); }
- charT ch_;
- };
- }
-
- template<typename charT, typename traits> // traits defaulted in string_view_fwd.hpp
- class basic_string_view {
- public:
- // types
- typedef traits traits_type;
- typedef charT value_type;
- typedef charT* pointer;
- typedef const charT* const_pointer;
- typedef charT& reference;
- typedef const charT& const_reference;
- typedef const_pointer const_iterator; // impl-defined
- typedef const_iterator iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef const_reverse_iterator reverse_iterator;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
- static BOOST_CONSTEXPR_OR_CONST size_type npos = size_type(-1);
-
- // construct/copy
- BOOST_CONSTEXPR basic_string_view() BOOST_NOEXCEPT
- : ptr_(NULL), len_(0) {}
-
- // by defaulting these functions, basic_string_ref becomes
- // trivially copy/move constructible.
- BOOST_CONSTEXPR basic_string_view(const basic_string_view &rhs) BOOST_NOEXCEPT
-#ifndef BOOST_STRING_VIEW_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS
- = default;
-#else
- : ptr_(rhs.ptr_), len_(rhs.len_) {}
-#endif
-
- basic_string_view& operator=(const basic_string_view &rhs) BOOST_NOEXCEPT
-#ifndef BOOST_STRING_VIEW_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS
- = default;
-#else
- {
- ptr_ = rhs.ptr_;
- len_ = rhs.len_;
- return *this;
- }
-#endif
-
- template<typename Allocator>
- basic_string_view(const std::basic_string<charT, traits, Allocator>& str) BOOST_NOEXCEPT
- : ptr_(str.data()), len_(str.length()) {}
-
-// #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
-// // Constructing a string_view from a temporary string is a bad idea
-// template<typename Allocator>
-// basic_string_view( std::basic_string<charT, traits, Allocator>&&)
-// = delete;
-// #endif
-
- BOOST_CONSTEXPR basic_string_view(const charT* str)
- : ptr_(str), len_(traits::length(str)) {}
-
- BOOST_CONSTEXPR basic_string_view(const charT* str, size_type len)
- : ptr_(str), len_(len) {}
-
- // iterators
- BOOST_CONSTEXPR const_iterator begin() const BOOST_NOEXCEPT { return ptr_; }
- BOOST_CONSTEXPR const_iterator cbegin() const BOOST_NOEXCEPT { return ptr_; }
- BOOST_CONSTEXPR const_iterator end() const BOOST_NOEXCEPT { return ptr_ + len_; }
- BOOST_CONSTEXPR const_iterator cend() const BOOST_NOEXCEPT { return ptr_ + len_; }
- const_reverse_iterator rbegin() const BOOST_NOEXCEPT { return const_reverse_iterator(end()); }
- const_reverse_iterator crbegin() const BOOST_NOEXCEPT { return const_reverse_iterator(end()); }
- const_reverse_iterator rend() const BOOST_NOEXCEPT { return const_reverse_iterator(begin()); }
- const_reverse_iterator crend() const BOOST_NOEXCEPT { return const_reverse_iterator(begin()); }
-
- // capacity
- BOOST_CONSTEXPR size_type size() const BOOST_NOEXCEPT { return len_; }
- BOOST_CONSTEXPR size_type length() const BOOST_NOEXCEPT { return len_; }
- BOOST_CONSTEXPR size_type max_size() const BOOST_NOEXCEPT { return len_; }
- BOOST_CONSTEXPR bool empty() const BOOST_NOEXCEPT { return len_ == 0; }
-
- // element access
- BOOST_CONSTEXPR const_reference operator[](size_type pos) const BOOST_NOEXCEPT { return ptr_[pos]; }
-
- BOOST_CONSTEXPR const_reference at(size_t pos) const {
- return pos >= len_ ? BOOST_THROW_EXCEPTION(std::out_of_range("boost::string_view::at")), ptr_[0] : ptr_[pos];
- }
-
- BOOST_CONSTEXPR const_reference front() const { return ptr_[0]; }
- BOOST_CONSTEXPR const_reference back() const { return ptr_[len_-1]; }
- BOOST_CONSTEXPR const_pointer data() const BOOST_NOEXCEPT { return ptr_; }
-
- // modifiers
- void clear() BOOST_NOEXCEPT { len_ = 0; } // Boost extension
-
- BOOST_CXX14_CONSTEXPR void remove_prefix(size_type n) {
- if ( n > len_ )
- n = len_;
- ptr_ += n;
- len_ -= n;
- }
-
- BOOST_CXX14_CONSTEXPR void remove_suffix(size_type n) {
- if ( n > len_ )
- n = len_;
- len_ -= n;
- }
-
- BOOST_CXX14_CONSTEXPR void swap(basic_string_view& s) BOOST_NOEXCEPT {
- std::swap(ptr_, s.ptr_);
- std::swap(len_, s.len_);
- }
-
- // basic_string_view string operations
-#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
- template<typename Allocator>
- explicit operator std::basic_string<charT, traits, Allocator>() const {
- return std::basic_string<charT, traits, Allocator>(begin(), end());
- }
-#endif
-
-#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
- template<typename Allocator = std::allocator<charT> >
- std::basic_string<charT, traits, Allocator> to_string(const Allocator& a = Allocator()) const {
- return std::basic_string<charT, traits, Allocator>(begin(), end(), a);
- }
-#else
- std::basic_string<charT, traits> to_string() const {
- return std::basic_string<charT, traits>(begin(), end());
- }
-
- template<typename Allocator>
- std::basic_string<charT, traits, Allocator> to_string(const Allocator& a) const {
- return std::basic_string<charT, traits, Allocator>(begin(), end(), a);
- }
-#endif
-
- size_type copy(charT* s, size_type n, size_type pos=0) const {
- if (pos > size())
- BOOST_THROW_EXCEPTION(std::out_of_range("string_view::copy" ));
- size_type rlen = (std::min)(n, len_ - pos);
- traits_type::copy(s, data() + pos, rlen);
- return rlen;
- }
-
- BOOST_CXX14_CONSTEXPR basic_string_view substr(size_type pos, size_type n=npos) const {
- if ( pos > size())
- BOOST_THROW_EXCEPTION( std::out_of_range ( "string_view::substr" ) );
- return basic_string_view(data() + pos, (std::min)(size() - pos, n));
- }
-
- BOOST_CXX14_CONSTEXPR int compare(basic_string_view x) const BOOST_NOEXCEPT {
- const int cmp = traits::compare(ptr_, x.ptr_, (std::min)(len_, x.len_));
- return cmp != 0 ? cmp : (len_ == x.len_ ? 0 : len_ < x.len_ ? -1 : 1);
- }
-
- BOOST_CXX14_CONSTEXPR int compare(size_type pos1, size_type n1, basic_string_view x)
- const BOOST_NOEXCEPT {
- return substr(pos1, n1).compare(x);
- }
-
- BOOST_CXX14_CONSTEXPR int compare(size_type pos1, size_type n1,
- basic_string_view x, size_type pos2, size_type n2) const {
- return substr(pos1, n1).compare(x.substr(pos2, n2));
- }
-
- BOOST_CXX14_CONSTEXPR int compare(const charT* x) const {
- return compare(basic_string_view(x));
- }
-
- BOOST_CXX14_CONSTEXPR int compare(size_type pos1, size_type n1, const charT* x) const {
- return substr(pos1, n1).compare(basic_string_view(x));
- }
-
- BOOST_CXX14_CONSTEXPR int compare(size_type pos1, size_type n1,
- const charT* x, size_type n2) const {
- return substr(pos1, n1).compare(basic_string_view(x, n2));
- }
-
- // Searches
- BOOST_CONSTEXPR bool starts_with(charT c) const BOOST_NOEXCEPT { // Boost extension
- return !empty() && traits::eq(c, front());
- }
-
- BOOST_CONSTEXPR bool starts_with(basic_string_view x) const BOOST_NOEXCEPT { // Boost extension
- return len_ >= x.len_ && traits::compare(ptr_, x.ptr_, x.len_) == 0;
- }
-
- BOOST_CONSTEXPR bool ends_with(charT c) const BOOST_NOEXCEPT { // Boost extension
- return !empty() && traits::eq(c, back());
- }
-
- BOOST_CONSTEXPR bool ends_with(basic_string_view x) const BOOST_NOEXCEPT { // Boost extension
- return len_ >= x.len_ &&
- traits::compare(ptr_ + len_ - x.len_, x.ptr_, x.len_) == 0;
- }
-
- // find
- BOOST_CXX14_CONSTEXPR size_type find(basic_string_view s, size_type pos = 0) const BOOST_NOEXCEPT {
- if (pos > size())
- return npos;
- if (s.empty())
- return pos;
- const_iterator iter = std::search(this->cbegin() + pos, this->cend(),
- s.cbegin (), s.cend (), traits::eq);
- return iter == this->cend () ? npos : std::distance(this->cbegin (), iter);
- }
- BOOST_CXX14_CONSTEXPR size_type find(charT c, size_type pos = 0) const BOOST_NOEXCEPT
- { return find(basic_string_view(&c, 1), pos); }
- BOOST_CXX14_CONSTEXPR size_type find(const charT* s, size_type pos, size_type n) const BOOST_NOEXCEPT
- { return find(basic_string_view(s, n), pos); }
- BOOST_CXX14_CONSTEXPR size_type find(const charT* s, size_type pos = 0) const BOOST_NOEXCEPT
- { return find(basic_string_view(s), pos); }
-
- // rfind
- BOOST_CXX14_CONSTEXPR size_type rfind(basic_string_view s, size_type pos = npos) const BOOST_NOEXCEPT {
- if (len_ < s.len_)
- return npos;
- if (pos > len_ - s.len_)
- pos = len_ - s.len_;
- if (s.len_ == 0u) // an empty string is always found
- return pos;
- for (const charT* cur = ptr_ + pos; ; --cur) {
- if (traits::compare(cur, s.ptr_, s.len_) == 0)
- return cur - ptr_;
- if (cur == ptr_)
- return npos;
- };
- }
- BOOST_CXX14_CONSTEXPR size_type rfind(charT c, size_type pos = npos) const BOOST_NOEXCEPT
- { return rfind(basic_string_view(&c, 1), pos); }
- BOOST_CXX14_CONSTEXPR size_type rfind(const charT* s, size_type pos, size_type n) const BOOST_NOEXCEPT
- { return rfind(basic_string_view(s, n), pos); }
- BOOST_CXX14_CONSTEXPR size_type rfind(const charT* s, size_type pos = npos) const BOOST_NOEXCEPT
- { return rfind(basic_string_view(s), pos); }
-
- // find_first_of
- BOOST_CXX14_CONSTEXPR size_type find_first_of(basic_string_view s, size_type pos = 0) const BOOST_NOEXCEPT {
- if (pos >= len_ || s.len_ == 0)
- return npos;
- const_iterator iter = std::find_first_of
- (this->cbegin () + pos, this->cend (), s.cbegin (), s.cend (), traits::eq);
- return iter == this->cend () ? npos : std::distance ( this->cbegin (), iter );
- }
- BOOST_CXX14_CONSTEXPR size_type find_first_of(charT c, size_type pos = 0) const BOOST_NOEXCEPT
- { return find_first_of(basic_string_view(&c, 1), pos); }
- BOOST_CXX14_CONSTEXPR size_type find_first_of(const charT* s, size_type pos, size_type n) const BOOST_NOEXCEPT
- { return find_first_of(basic_string_view(s, n), pos); }
- BOOST_CXX14_CONSTEXPR size_type find_first_of(const charT* s, size_type pos = 0) const BOOST_NOEXCEPT
- { return find_first_of(basic_string_view(s), pos); }
-
- // find_last_of
- BOOST_CXX14_CONSTEXPR size_type find_last_of(basic_string_view s, size_type pos = npos) const BOOST_NOEXCEPT {
- if (s.len_ == 0u)
- return npos;
- if (pos >= len_)
- pos = 0;
- else
- pos = len_ - (pos+1);
- const_reverse_iterator iter = std::find_first_of
- ( this->crbegin () + pos, this->crend (), s.cbegin (), s.cend (), traits::eq );
- return iter == this->crend () ? npos : reverse_distance ( this->crbegin (), iter);
- }
- BOOST_CXX14_CONSTEXPR size_type find_last_of(charT c, size_type pos = npos) const BOOST_NOEXCEPT
- { return find_last_of(basic_string_view(&c, 1), pos); }
- BOOST_CXX14_CONSTEXPR size_type find_last_of(const charT* s, size_type pos, size_type n) const BOOST_NOEXCEPT
- { return find_last_of(basic_string_view(s, n), pos); }
- BOOST_CXX14_CONSTEXPR size_type find_last_of(const charT* s, size_type pos = npos) const BOOST_NOEXCEPT
- { return find_last_of(basic_string_view(s), pos); }
-
- // find_first_not_of
- BOOST_CXX14_CONSTEXPR size_type find_first_not_of(basic_string_view s, size_type pos = 0) const BOOST_NOEXCEPT {
- if (pos >= len_)
- return npos;
- if (s.len_ == 0)
- return pos;
- const_iterator iter = find_not_of ( this->cbegin () + pos, this->cend (), s );
- return iter == this->cend () ? npos : std::distance ( this->cbegin (), iter );
- }
- BOOST_CXX14_CONSTEXPR size_type find_first_not_of(charT c, size_type pos = 0) const BOOST_NOEXCEPT
- { return find_first_not_of(basic_string_view(&c, 1), pos); }
- BOOST_CXX14_CONSTEXPR size_type find_first_not_of(const charT* s, size_type pos, size_type n) const BOOST_NOEXCEPT
- { return find_first_not_of(basic_string_view(s, n), pos); }
- BOOST_CXX14_CONSTEXPR size_type find_first_not_of(const charT* s, size_type pos = 0) const BOOST_NOEXCEPT
- { return find_first_not_of(basic_string_view(s), pos); }
-
- // find_last_not_of
- BOOST_CXX14_CONSTEXPR size_type find_last_not_of(basic_string_view s, size_type pos = npos) const BOOST_NOEXCEPT {
- if (pos >= len_)
- pos = len_ - 1;
- if (s.len_ == 0u)
- return pos;
- pos = len_ - (pos+1);
- const_reverse_iterator iter = find_not_of ( this->crbegin () + pos, this->crend (), s );
- return iter == this->crend () ? npos : reverse_distance ( this->crbegin (), iter );
- }
- BOOST_CXX14_CONSTEXPR size_type find_last_not_of(charT c, size_type pos = npos) const BOOST_NOEXCEPT
- { return find_last_not_of(basic_string_view(&c, 1), pos); }
- BOOST_CXX14_CONSTEXPR size_type find_last_not_of(const charT* s, size_type pos, size_type n) const BOOST_NOEXCEPT
- { return find_last_not_of(basic_string_view(s, n), pos); }
- BOOST_CXX14_CONSTEXPR size_type find_last_not_of(const charT* s, size_type pos = npos) const BOOST_NOEXCEPT
- { return find_last_not_of(basic_string_view(s), pos); }
-
- private:
- template <typename r_iter>
- size_type reverse_distance(r_iter first, r_iter last) const BOOST_NOEXCEPT {
- // Portability note here: std::distance is not NOEXCEPT, but calling it with a string_view::reverse_iterator will not throw.
- return len_ - 1 - std::distance ( first, last );
- }
-
- template <typename Iterator>
- Iterator find_not_of(Iterator first, Iterator last, basic_string_view s) const BOOST_NOEXCEPT {
- for (; first != last ; ++first)
- if ( 0 == traits::find(s.ptr_, s.len_, *first))
- return first;
- return last;
- }
-
- const charT *ptr_;
- std::size_t len_;
- };
-
-
-// Comparison operators
-// Equality
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator==(basic_string_view<charT, traits> x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- if (x.size () != y.size ()) return false;
- return x.compare(y) == 0;
- }
-
-// Inequality
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator!=(basic_string_view<charT, traits> x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- if ( x.size () != y.size ()) return true;
- return x.compare(y) != 0;
- }
-
-// Less than
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator<(basic_string_view<charT, traits> x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return x.compare(y) < 0;
- }
-
-// Greater than
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator>(basic_string_view<charT, traits> x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return x.compare(y) > 0;
- }
-
-// Less than or equal to
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator<=(basic_string_view<charT, traits> x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return x.compare(y) <= 0;
- }
-
-// Greater than or equal to
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator>=(basic_string_view<charT, traits> x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return x.compare(y) >= 0;
- }
-
-// "sufficient additional overloads of comparison functions"
- template<typename charT, typename traits, typename Allocator>
- inline BOOST_CXX14_CONSTEXPR bool operator==(basic_string_view<charT, traits> x,
- const std::basic_string<charT, traits, Allocator> & y) BOOST_NOEXCEPT {
- return x == basic_string_view<charT, traits>(y);
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline BOOST_CXX14_CONSTEXPR bool operator==(const std::basic_string<charT, traits, Allocator> & x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return basic_string_view<charT, traits>(x) == y;
- }
-
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator==(basic_string_view<charT, traits> x,
- const charT * y) BOOST_NOEXCEPT {
- return x == basic_string_view<charT, traits>(y);
- }
-
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator==(const charT * x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return basic_string_view<charT, traits>(x) == y;
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline BOOST_CXX14_CONSTEXPR bool operator!=(basic_string_view<charT, traits> x,
- const std::basic_string<charT, traits, Allocator> & y) BOOST_NOEXCEPT {
- return x != basic_string_view<charT, traits>(y);
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline BOOST_CXX14_CONSTEXPR bool operator!=(const std::basic_string<charT, traits, Allocator> & x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return basic_string_view<charT, traits>(x) != y;
- }
-
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator!=(basic_string_view<charT, traits> x,
- const charT * y) BOOST_NOEXCEPT {
- return x != basic_string_view<charT, traits>(y);
- }
-
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator!=(const charT * x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return basic_string_view<charT, traits>(x) != y;
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline BOOST_CXX14_CONSTEXPR bool operator<(basic_string_view<charT, traits> x,
- const std::basic_string<charT, traits, Allocator> & y) BOOST_NOEXCEPT {
- return x < basic_string_view<charT, traits>(y);
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline BOOST_CXX14_CONSTEXPR bool operator<(const std::basic_string<charT, traits, Allocator> & x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return basic_string_view<charT, traits>(x) < y;
- }
-
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator<(basic_string_view<charT, traits> x,
- const charT * y) BOOST_NOEXCEPT {
- return x < basic_string_view<charT, traits>(y);
- }
-
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator<(const charT * x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return basic_string_view<charT, traits>(x) < y;
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline BOOST_CXX14_CONSTEXPR bool operator>(basic_string_view<charT, traits> x,
- const std::basic_string<charT, traits, Allocator> & y) BOOST_NOEXCEPT {
- return x > basic_string_view<charT, traits>(y);
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline BOOST_CXX14_CONSTEXPR bool operator>(const std::basic_string<charT, traits, Allocator> & x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return basic_string_view<charT, traits>(x) > y;
- }
-
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator>(basic_string_view<charT, traits> x,
- const charT * y) BOOST_NOEXCEPT {
- return x > basic_string_view<charT, traits>(y);
- }
-
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator>(const charT * x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return basic_string_view<charT, traits>(x) > y;
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline BOOST_CXX14_CONSTEXPR bool operator<=(basic_string_view<charT, traits> x,
- const std::basic_string<charT, traits, Allocator> & y) BOOST_NOEXCEPT {
- return x <= basic_string_view<charT, traits>(y);
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline BOOST_CXX14_CONSTEXPR bool operator<=(const std::basic_string<charT, traits, Allocator> & x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return basic_string_view<charT, traits>(x) <= y;
- }
-
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator<=(basic_string_view<charT, traits> x,
- const charT * y) BOOST_NOEXCEPT {
- return x <= basic_string_view<charT, traits>(y);
- }
-
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator<=(const charT * x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return basic_string_view<charT, traits>(x) <= y;
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline BOOST_CXX14_CONSTEXPR bool operator>=(basic_string_view<charT, traits> x,
- const std::basic_string<charT, traits, Allocator> & y) BOOST_NOEXCEPT {
- return x >= basic_string_view<charT, traits>(y);
- }
-
- template<typename charT, typename traits, typename Allocator>
- inline BOOST_CXX14_CONSTEXPR bool operator>=(const std::basic_string<charT, traits, Allocator> & x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return basic_string_view<charT, traits>(x) >= y;
- }
-
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator>=(basic_string_view<charT, traits> x,
- const charT * y) BOOST_NOEXCEPT {
- return x >= basic_string_view<charT, traits>(y);
- }
-
- template<typename charT, typename traits>
- inline BOOST_CXX14_CONSTEXPR bool operator>=(const charT * x,
- basic_string_view<charT, traits> y) BOOST_NOEXCEPT {
- return basic_string_view<charT, traits>(x) >= y;
- }
-
- namespace detail {
-
- template<class charT, class traits>
- inline void sv_insert_fill_chars(std::basic_ostream<charT, traits>& os, std::size_t n) {
- enum { chunk_size = 8 };
- charT fill_chars[chunk_size];
- std::fill_n(fill_chars, static_cast< std::size_t >(chunk_size), os.fill());
- for (; n >= chunk_size && os.good(); n -= chunk_size)
- os.write(fill_chars, static_cast< std::size_t >(chunk_size));
- if (n > 0 && os.good())
- os.write(fill_chars, n);
- }
-
- template<class charT, class traits>
- void sv_insert_aligned(std::basic_ostream<charT, traits>& os, const basic_string_view<charT,traits>& str) {
- const std::size_t size = str.size();
- const std::size_t alignment_size = static_cast< std::size_t >(os.width()) - size;
- const bool align_left = (os.flags() & std::basic_ostream<charT, traits>::adjustfield) == std::basic_ostream<charT, traits>::left;
- if (!align_left) {
- detail::sv_insert_fill_chars(os, alignment_size);
- if (os.good())
- os.write(str.data(), size);
- }
- else {
- os.write(str.data(), size);
- if (os.good())
- detail::sv_insert_fill_chars(os, alignment_size);
- }
- }
-
- } // namespace detail
-
- // Inserter
- template<class charT, class traits>
- inline std::basic_ostream<charT, traits>&
- operator<<(std::basic_ostream<charT, traits>& os,
- const basic_string_view<charT,traits>& str) {
- if (os.good()) {
- const std::size_t size = str.size();
- const std::size_t w = static_cast< std::size_t >(os.width());
- if (w <= size)
- os.write(str.data(), size);
- else
- detail::sv_insert_aligned(os, str);
- os.width(0);
- }
- return os;
- }
-
-#if 0
- // numeric conversions
- //
- // These are short-term implementations.
- // In a production environment, I would rather avoid the copying.
- //
- inline int stoi (string_view str, size_t* idx=0, int base=10) {
- return std::stoi ( std::string(str), idx, base );
- }
-
- inline long stol (string_view str, size_t* idx=0, int base=10) {
- return std::stol ( std::string(str), idx, base );
- }
-
- inline unsigned long stoul (string_view str, size_t* idx=0, int base=10) {
- return std::stoul ( std::string(str), idx, base );
- }
-
- inline long long stoll (string_view str, size_t* idx=0, int base=10) {
- return std::stoll ( std::string(str), idx, base );
- }
-
- inline unsigned long long stoull (string_view str, size_t* idx=0, int base=10) {
- return std::stoull ( std::string(str), idx, base );
- }
-
- inline float stof (string_view str, size_t* idx=0) {
- return std::stof ( std::string(str), idx );
- }
-
- inline double stod (string_view str, size_t* idx=0) {
- return std::stod ( std::string(str), idx );
- }
-
- inline long double stold (string_view str, size_t* idx=0) {
- return std::stold ( std::string(str), idx );
- }
-
- inline int stoi (wstring_view str, size_t* idx=0, int base=10) {
- return std::stoi ( std::wstring(str), idx, base );
- }
-
- inline long stol (wstring_view str, size_t* idx=0, int base=10) {
- return std::stol ( std::wstring(str), idx, base );
- }
-
- inline unsigned long stoul (wstring_view str, size_t* idx=0, int base=10) {
- return std::stoul ( std::wstring(str), idx, base );
- }
-
- inline long long stoll (wstring_view str, size_t* idx=0, int base=10) {
- return std::stoll ( std::wstring(str), idx, base );
- }
-
- inline unsigned long long stoull (wstring_view str, size_t* idx=0, int base=10) {
- return std::stoull ( std::wstring(str), idx, base );
- }
-
- inline float stof (wstring_view str, size_t* idx=0) {
- return std::stof ( std::wstring(str), idx );
- }
-
- inline double stod (wstring_view str, size_t* idx=0) {
- return std::stod ( std::wstring(str), idx );
- }
-
- inline long double stold (wstring_view str, size_t* idx=0) {
- return std::stold ( std::wstring(str), idx );
- }
-#endif
-
-}
-
-#if 0
-namespace std {
- // Hashing
- template<> struct hash<boost::string_view>;
- template<> struct hash<boost::u16string_view>;
- template<> struct hash<boost::u32string_view>;
- template<> struct hash<boost::wstring_view>;
-}
-#endif
-
-#endif
diff --git a/contrib/restricted/boost/boost/utility/typed_in_place_factory.hpp b/contrib/restricted/boost/boost/utility/typed_in_place_factory.hpp
deleted file mode 100644
index 833a34692d..0000000000
--- a/contrib/restricted/boost/boost/utility/typed_in_place_factory.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
-// Copyright (C) 2007, Tobias Schwinger.
-//
-// Use, modification, and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/optional for documentation.
-//
-// You are welcome to contact the author at:
-// fernando_cacciola@hotmail.com
-//
-#ifndef BOOST_UTILITY_TYPED_INPLACE_FACTORY_04APR2007_HPP
-#ifndef BOOST_PP_IS_ITERATING
-
-#include <boost/utility/detail/in_place_factory_prefix.hpp>
-
-namespace boost {
-
-class typed_in_place_factory_base {} ;
-
-#define BOOST_PP_ITERATION_LIMITS (0, BOOST_MAX_INPLACE_FACTORY_ARITY)
-#define BOOST_PP_FILENAME_1 <boost/utility/typed_in_place_factory.hpp>
-#include BOOST_PP_ITERATE()
-
-} // namespace boost
-
-#include <boost/utility/detail/in_place_factory_suffix.hpp>
-
-#define BOOST_UTILITY_TYPED_INPLACE_FACTORY_04APR2007_HPP
-#else
-#define N BOOST_PP_ITERATION()
-
-template< class T BOOST_PP_ENUM_TRAILING_PARAMS(N,class A) >
-class BOOST_PP_CAT(typed_in_place_factory,N)
- :
- public typed_in_place_factory_base
-{
-public:
-
- typedef T value_type;
-
- explicit BOOST_PP_CAT(typed_in_place_factory,N)
- ( BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a) )
-#if N > 0
- : BOOST_PP_ENUM(N, BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT, _)
-#endif
- {}
-
- void* apply (void* address) const
- {
- return new(address) T( BOOST_PP_ENUM_PARAMS(N, m_a) );
- }
-
- void* apply (void* address, std::size_t n) const
- {
- for(void* next = address = this->apply(address); !! --n;)
- this->apply(next = static_cast<char *>(next) + sizeof(T));
- return address;
- }
-
- BOOST_PP_REPEAT(N, BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL, _)
-};
-
-template< class T BOOST_PP_ENUM_TRAILING_PARAMS(N, class A) >
-inline BOOST_PP_CAT(typed_in_place_factory,N)<
- T BOOST_PP_ENUM_TRAILING_PARAMS(N, A) >
-in_place( BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a) )
-{
- return BOOST_PP_CAT(typed_in_place_factory,N)<
- T BOOST_PP_ENUM_TRAILING_PARAMS(N, A) >( BOOST_PP_ENUM_PARAMS(N, a) );
-}
-
-#undef N
-#endif
-#endif
-
diff --git a/contrib/restricted/boost/utility/CMakeLists.txt b/contrib/restricted/boost/utility/CMakeLists.txt
new file mode 100644
index 0000000000..f017d73737
--- /dev/null
+++ b/contrib/restricted/boost/utility/CMakeLists.txt
@@ -0,0 +1,23 @@
+
+# This file was gererated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(restricted-boost-utility INTERFACE)
+target_include_directories(restricted-boost-utility INTERFACE
+ ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/utility/include
+)
+target_link_libraries(restricted-boost-utility INTERFACE
+ contrib-libs-cxxsupp
+ yutil
+ restricted-boost-config
+ restricted-boost-core
+ restricted-boost-preprocessor
+ restricted-boost-static_assert
+ restricted-boost-throw_exception
+ restricted-boost-type_traits
+)
diff --git a/contrib/restricted/boost/boost/call_traits.hpp b/contrib/restricted/boost/utility/include/boost/call_traits.hpp
index 2c1328e94d..2c1328e94d 100644
--- a/contrib/restricted/boost/boost/call_traits.hpp
+++ b/contrib/restricted/boost/utility/include/boost/call_traits.hpp
diff --git a/contrib/restricted/boost/boost/compressed_pair.hpp b/contrib/restricted/boost/utility/include/boost/compressed_pair.hpp
index a7be0f2ba2..a7be0f2ba2 100644
--- a/contrib/restricted/boost/boost/compressed_pair.hpp
+++ b/contrib/restricted/boost/utility/include/boost/compressed_pair.hpp
diff --git a/contrib/restricted/boost/boost/detail/call_traits.hpp b/contrib/restricted/boost/utility/include/boost/detail/call_traits.hpp
index 36dea0003a..36dea0003a 100644
--- a/contrib/restricted/boost/boost/detail/call_traits.hpp
+++ b/contrib/restricted/boost/utility/include/boost/detail/call_traits.hpp
diff --git a/contrib/restricted/boost/boost/detail/compressed_pair.hpp b/contrib/restricted/boost/utility/include/boost/detail/compressed_pair.hpp
index 5dc21e23e6..5dc21e23e6 100644
--- a/contrib/restricted/boost/boost/detail/compressed_pair.hpp
+++ b/contrib/restricted/boost/utility/include/boost/detail/compressed_pair.hpp
diff --git a/contrib/restricted/boost/boost/operators.hpp b/contrib/restricted/boost/utility/include/boost/operators.hpp
index 156571c1a9..156571c1a9 100644
--- a/contrib/restricted/boost/boost/operators.hpp
+++ b/contrib/restricted/boost/utility/include/boost/operators.hpp
diff --git a/contrib/restricted/boost/boost/operators_v1.hpp b/contrib/restricted/boost/utility/include/boost/operators_v1.hpp
index e1c53e8703..e1c53e8703 100644
--- a/contrib/restricted/boost/boost/operators_v1.hpp
+++ b/contrib/restricted/boost/utility/include/boost/operators_v1.hpp
diff --git a/contrib/restricted/boost/boost/utility.hpp b/contrib/restricted/boost/utility/include/boost/utility.hpp
index 5ac9ecbd85..5ac9ecbd85 100644
--- a/contrib/restricted/boost/boost/utility.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility.hpp
diff --git a/contrib/restricted/boost/boost/utility/base_from_member.hpp b/contrib/restricted/boost/utility/include/boost/utility/base_from_member.hpp
index 604541d19a..604541d19a 100644
--- a/contrib/restricted/boost/boost/utility/base_from_member.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility/base_from_member.hpp
diff --git a/contrib/restricted/boost/boost/utility/binary.hpp b/contrib/restricted/boost/utility/include/boost/utility/binary.hpp
index 8cef1468e5..8cef1468e5 100644
--- a/contrib/restricted/boost/boost/utility/binary.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility/binary.hpp
diff --git a/contrib/restricted/boost/boost/utility/compare_pointees.hpp b/contrib/restricted/boost/utility/include/boost/utility/compare_pointees.hpp
index 5ab21cdee2..5ab21cdee2 100644
--- a/contrib/restricted/boost/boost/utility/compare_pointees.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility/compare_pointees.hpp
diff --git a/contrib/restricted/boost/boost/utility/detail/in_place_factory_prefix.hpp b/contrib/restricted/boost/utility/include/boost/utility/detail/in_place_factory_prefix.hpp
index afd76b5a85..afd76b5a85 100644
--- a/contrib/restricted/boost/boost/utility/detail/in_place_factory_prefix.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility/detail/in_place_factory_prefix.hpp
diff --git a/contrib/restricted/boost/boost/utility/detail/in_place_factory_suffix.hpp b/contrib/restricted/boost/utility/include/boost/utility/detail/in_place_factory_suffix.hpp
index 58f48c708c..58f48c708c 100644
--- a/contrib/restricted/boost/boost/utility/detail/in_place_factory_suffix.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility/detail/in_place_factory_suffix.hpp
diff --git a/contrib/restricted/boost/boost/utility/detail/result_of_iterate.hpp b/contrib/restricted/boost/utility/include/boost/utility/detail/result_of_iterate.hpp
index d6538447b1..d6538447b1 100644
--- a/contrib/restricted/boost/boost/utility/detail/result_of_iterate.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility/detail/result_of_iterate.hpp
diff --git a/contrib/restricted/boost/boost/utility/identity_type.hpp b/contrib/restricted/boost/utility/include/boost/utility/identity_type.hpp
index 4a1f6c4de5..4a1f6c4de5 100644
--- a/contrib/restricted/boost/boost/utility/identity_type.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility/identity_type.hpp
diff --git a/contrib/restricted/boost/boost/utility/in_place_factory.hpp b/contrib/restricted/boost/utility/include/boost/utility/in_place_factory.hpp
index 1a62ace10a..1a62ace10a 100644
--- a/contrib/restricted/boost/boost/utility/in_place_factory.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility/in_place_factory.hpp
diff --git a/contrib/restricted/boost/boost/utility/result_of.hpp b/contrib/restricted/boost/utility/include/boost/utility/result_of.hpp
index 2b652ba0ca..2b652ba0ca 100644
--- a/contrib/restricted/boost/boost/utility/result_of.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility/result_of.hpp
diff --git a/contrib/restricted/boost/boost/utility/string_ref_fwd.hpp b/contrib/restricted/boost/utility/include/boost/utility/string_ref_fwd.hpp
index f58b98c1fb..f58b98c1fb 100644
--- a/contrib/restricted/boost/boost/utility/string_ref_fwd.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility/string_ref_fwd.hpp
diff --git a/contrib/restricted/boost/boost/utility/string_view_fwd.hpp b/contrib/restricted/boost/utility/include/boost/utility/string_view_fwd.hpp
index dbda0de46a..dbda0de46a 100644
--- a/contrib/restricted/boost/boost/utility/string_view_fwd.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility/string_view_fwd.hpp
diff --git a/contrib/restricted/boost/boost/utility/value_init.hpp b/contrib/restricted/boost/utility/include/boost/utility/value_init.hpp
index 9d8de70733..9d8de70733 100644
--- a/contrib/restricted/boost/boost/utility/value_init.hpp
+++ b/contrib/restricted/boost/utility/include/boost/utility/value_init.hpp