diff options
author | bugaevskiy <bugaevskiy@yandex-team.com> | 2022-07-23 21:28:06 +0300 |
---|---|---|
committer | bugaevskiy <bugaevskiy@yandex-team.com> | 2022-07-23 21:28:06 +0300 |
commit | bdfa64a2dfbfa18015103f731c6017fd61a34842 (patch) | |
tree | 17f15b4a5bb4ca6546d19950902d0304175cf1db | |
parent | 4fdcbb93872d8192072780d5b346e91d229fa951 (diff) | |
download | ydb-bdfa64a2dfbfa18015103f731c6017fd61a34842.tar.gz |
Reimport boost/align as a separate project
53 files changed, 44 insertions, 802 deletions
diff --git a/CMakeLists.darwin.txt b/CMakeLists.darwin.txt index f86c6f2c57..4e5dd11417 100644 --- a/CMakeLists.darwin.txt +++ b/CMakeLists.darwin.txt @@ -144,6 +144,7 @@ add_subdirectory(contrib/restricted/boost/static_assert) add_subdirectory(contrib/restricted/boost/throw_exception) add_subdirectory(contrib/restricted/boost/vmd) add_subdirectory(contrib/restricted/boost/winapi) +add_subdirectory(contrib/restricted/boost/align) add_subdirectory(contrib/restricted/fast_float) add_subdirectory(contrib/restricted/thrift) add_subdirectory(contrib/libs/libevent) diff --git a/CMakeLists.linux.txt b/CMakeLists.linux.txt index 682afa8f39..4376ea8599 100644 --- a/CMakeLists.linux.txt +++ b/CMakeLists.linux.txt @@ -222,6 +222,7 @@ add_subdirectory(contrib/restricted/boost/static_assert) add_subdirectory(contrib/restricted/boost/throw_exception) add_subdirectory(contrib/restricted/boost/vmd) add_subdirectory(contrib/restricted/boost/winapi) +add_subdirectory(contrib/restricted/boost/align) add_subdirectory(contrib/restricted/fast_float) add_subdirectory(contrib/restricted/thrift) add_subdirectory(contrib/libs/libevent) diff --git a/contrib/restricted/boost/CMakeLists.txt b/contrib/restricted/boost/CMakeLists.txt index 03836504b6..a4a7373209 100644 --- a/contrib/restricted/boost/CMakeLists.txt +++ b/contrib/restricted/boost/CMakeLists.txt @@ -24,4 +24,5 @@ target_link_libraries(contrib-restricted-boost INTERFACE restricted-boost-throw_exception restricted-boost-vmd restricted-boost-winapi + restricted-boost-align ) diff --git a/contrib/restricted/boost/align/CMakeLists.txt b/contrib/restricted/boost/align/CMakeLists.txt new file mode 100644 index 0000000000..284887ead4 --- /dev/null +++ b/contrib/restricted/boost/align/CMakeLists.txt @@ -0,0 +1,22 @@ + +# 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-align INTERFACE) +target_include_directories(restricted-boost-align INTERFACE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/align/include +) +target_link_libraries(restricted-boost-align INTERFACE + contrib-libs-cxxsupp + yutil + restricted-boost-assert + restricted-boost-config + restricted-boost-core + restricted-boost-static_assert + restricted-boost-throw_exception +) diff --git a/contrib/restricted/boost/align/README.md b/contrib/restricted/boost/align/README.md new file mode 100644 index 0000000000..983b806f18 --- /dev/null +++ b/contrib/restricted/boost/align/README.md @@ -0,0 +1,9 @@ +# Boost.Align + +The Boost Align C++ library provides functions, classes, templates, traits, +and macros, for the control, inspection, and diagnostic of memory alignment. + +### License + +Distributed under the +[Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). diff --git a/contrib/restricted/boost/boost/align/align.hpp b/contrib/restricted/boost/align/include/boost/align/align.hpp index ee4371091c..ee4371091c 100644 --- a/contrib/restricted/boost/boost/align/align.hpp +++ b/contrib/restricted/boost/align/include/boost/align/align.hpp diff --git a/contrib/restricted/boost/boost/align/align_up.hpp b/contrib/restricted/boost/align/include/boost/align/align_up.hpp index 6401ea848a..6401ea848a 100644 --- a/contrib/restricted/boost/boost/align/align_up.hpp +++ b/contrib/restricted/boost/align/include/boost/align/align_up.hpp diff --git a/contrib/restricted/boost/boost/align/aligned_alloc.hpp b/contrib/restricted/boost/align/include/boost/align/aligned_alloc.hpp index 42128f1b24..42128f1b24 100644 --- a/contrib/restricted/boost/boost/align/aligned_alloc.hpp +++ b/contrib/restricted/boost/align/include/boost/align/aligned_alloc.hpp diff --git a/contrib/restricted/boost/boost/align/alignment_of.hpp b/contrib/restricted/boost/align/include/boost/align/alignment_of.hpp index 488df0b9e0..488df0b9e0 100644 --- a/contrib/restricted/boost/boost/align/alignment_of.hpp +++ b/contrib/restricted/boost/align/include/boost/align/alignment_of.hpp diff --git a/contrib/restricted/boost/boost/align/alignment_of_forward.hpp b/contrib/restricted/boost/align/include/boost/align/alignment_of_forward.hpp index 31db15f23c..31db15f23c 100644 --- a/contrib/restricted/boost/boost/align/alignment_of_forward.hpp +++ b/contrib/restricted/boost/align/include/boost/align/alignment_of_forward.hpp diff --git a/contrib/restricted/boost/boost/align/detail/align.hpp b/contrib/restricted/boost/align/include/boost/align/detail/align.hpp index 905940ad77..905940ad77 100644 --- a/contrib/restricted/boost/boost/align/detail/align.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/align.hpp diff --git a/contrib/restricted/boost/boost/align/detail/align_cxx11.hpp b/contrib/restricted/boost/align/include/boost/align/detail/align_cxx11.hpp index 637541ab40..637541ab40 100644 --- a/contrib/restricted/boost/boost/align/detail/align_cxx11.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/align_cxx11.hpp diff --git a/contrib/restricted/boost/boost/align/detail/align_up.hpp b/contrib/restricted/boost/align/include/boost/align/detail/align_up.hpp index ac11f8964f..ac11f8964f 100644 --- a/contrib/restricted/boost/boost/align/detail/align_up.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/align_up.hpp diff --git a/contrib/restricted/boost/boost/align/detail/aligned_alloc.hpp b/contrib/restricted/boost/align/include/boost/align/detail/aligned_alloc.hpp index 69da19659a..69da19659a 100644 --- a/contrib/restricted/boost/boost/align/detail/aligned_alloc.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/aligned_alloc.hpp diff --git a/contrib/restricted/boost/boost/align/detail/aligned_alloc_android.hpp b/contrib/restricted/boost/align/include/boost/align/detail/aligned_alloc_android.hpp index 4119fbd9bc..4119fbd9bc 100644 --- a/contrib/restricted/boost/boost/align/detail/aligned_alloc_android.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/aligned_alloc_android.hpp diff --git a/contrib/restricted/boost/boost/align/detail/aligned_alloc_macos.hpp b/contrib/restricted/boost/align/include/boost/align/detail/aligned_alloc_macos.hpp index 76366fa5c1..76366fa5c1 100644 --- a/contrib/restricted/boost/boost/align/detail/aligned_alloc_macos.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/aligned_alloc_macos.hpp diff --git a/contrib/restricted/boost/boost/align/detail/aligned_alloc_msvc.hpp b/contrib/restricted/boost/align/include/boost/align/detail/aligned_alloc_msvc.hpp index 45c57c9915..45c57c9915 100644 --- a/contrib/restricted/boost/boost/align/detail/aligned_alloc_msvc.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/aligned_alloc_msvc.hpp diff --git a/contrib/restricted/boost/boost/align/detail/aligned_alloc_posix.hpp b/contrib/restricted/boost/align/include/boost/align/detail/aligned_alloc_posix.hpp index 78fc842d20..78fc842d20 100644 --- a/contrib/restricted/boost/boost/align/detail/aligned_alloc_posix.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/aligned_alloc_posix.hpp diff --git a/contrib/restricted/boost/boost/align/detail/aligned_alloc_sunos.hpp b/contrib/restricted/boost/align/include/boost/align/detail/aligned_alloc_sunos.hpp index 0948b40e39..0948b40e39 100644 --- a/contrib/restricted/boost/boost/align/detail/aligned_alloc_sunos.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/aligned_alloc_sunos.hpp diff --git a/contrib/restricted/boost/boost/align/detail/alignment_of.hpp b/contrib/restricted/boost/align/include/boost/align/detail/alignment_of.hpp index b6fc3dcdcf..b6fc3dcdcf 100644 --- a/contrib/restricted/boost/boost/align/detail/alignment_of.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/alignment_of.hpp diff --git a/contrib/restricted/boost/boost/align/detail/alignment_of_clang.hpp b/contrib/restricted/boost/align/include/boost/align/detail/alignment_of_clang.hpp index 95773e5ea3..95773e5ea3 100644 --- a/contrib/restricted/boost/boost/align/detail/alignment_of_clang.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/alignment_of_clang.hpp diff --git a/contrib/restricted/boost/boost/align/detail/alignment_of_codegear.hpp b/contrib/restricted/boost/align/include/boost/align/detail/alignment_of_codegear.hpp index ea6f904242..ea6f904242 100644 --- a/contrib/restricted/boost/boost/align/detail/alignment_of_codegear.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/alignment_of_codegear.hpp diff --git a/contrib/restricted/boost/boost/align/detail/alignment_of_cxx11.hpp b/contrib/restricted/boost/align/include/boost/align/detail/alignment_of_cxx11.hpp index 05c7429385..05c7429385 100644 --- a/contrib/restricted/boost/boost/align/detail/alignment_of_cxx11.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/alignment_of_cxx11.hpp diff --git a/contrib/restricted/boost/boost/align/detail/alignment_of_gcc.hpp b/contrib/restricted/boost/align/include/boost/align/detail/alignment_of_gcc.hpp index 66a63a50b1..66a63a50b1 100644 --- a/contrib/restricted/boost/boost/align/detail/alignment_of_gcc.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/alignment_of_gcc.hpp diff --git a/contrib/restricted/boost/boost/align/detail/alignment_of_msvc.hpp b/contrib/restricted/boost/align/include/boost/align/detail/alignment_of_msvc.hpp index 440b840db4..440b840db4 100644 --- a/contrib/restricted/boost/boost/align/detail/alignment_of_msvc.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/alignment_of_msvc.hpp diff --git a/contrib/restricted/boost/boost/align/detail/element_type.hpp b/contrib/restricted/boost/align/include/boost/align/detail/element_type.hpp index 5b2b732da0..5b2b732da0 100644 --- a/contrib/restricted/boost/boost/align/detail/element_type.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/element_type.hpp diff --git a/contrib/restricted/boost/boost/align/detail/integral_constant.hpp b/contrib/restricted/boost/align/include/boost/align/detail/integral_constant.hpp index 860096783e..860096783e 100644 --- a/contrib/restricted/boost/boost/align/detail/integral_constant.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/integral_constant.hpp diff --git a/contrib/restricted/boost/boost/align/detail/is_alignment.hpp b/contrib/restricted/boost/align/include/boost/align/detail/is_alignment.hpp index 542fbe4694..542fbe4694 100644 --- a/contrib/restricted/boost/boost/align/detail/is_alignment.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/is_alignment.hpp diff --git a/contrib/restricted/boost/boost/align/detail/min_size.hpp b/contrib/restricted/boost/align/include/boost/align/detail/min_size.hpp index 5b478fdaf0..5b478fdaf0 100644 --- a/contrib/restricted/boost/boost/align/detail/min_size.hpp +++ b/contrib/restricted/boost/align/include/boost/align/detail/min_size.hpp diff --git a/contrib/restricted/boost/boost/align.hpp b/contrib/restricted/boost/boost/align.hpp deleted file mode 100644 index 45fe36bbcc..0000000000 --- a/contrib/restricted/boost/boost/align.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/* -Copyright 2014-2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_HPP -#define BOOST_ALIGN_HPP - -#include <boost/align/align.hpp> -#include <boost/align/align_down.hpp> -#include <boost/align/align_up.hpp> -#include <boost/align/aligned_alloc.hpp> -#include <boost/align/aligned_allocator.hpp> -#include <boost/align/aligned_allocator_adaptor.hpp> -#include <boost/align/aligned_delete.hpp> -#include <boost/align/alignment_of.hpp> -#include <boost/align/assume_aligned.hpp> -#include <boost/align/is_aligned.hpp> - -#endif diff --git a/contrib/restricted/boost/boost/align/align_down.hpp b/contrib/restricted/boost/boost/align/align_down.hpp deleted file mode 100644 index 355844f8aa..0000000000 --- a/contrib/restricted/boost/boost/align/align_down.hpp +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright 2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_ALIGN_DOWN_HPP -#define BOOST_ALIGN_ALIGN_DOWN_HPP - -#include <boost/align/detail/align_down.hpp> - -namespace boost { -namespace alignment { - -BOOST_CONSTEXPR inline std::size_t -align_down(std::size_t value, std::size_t alignment) BOOST_NOEXCEPT -{ - return value & ~(alignment - 1); -} - -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/aligned_allocator.hpp b/contrib/restricted/boost/boost/align/aligned_allocator.hpp deleted file mode 100644 index 6176bc27c0..0000000000 --- a/contrib/restricted/boost/boost/align/aligned_allocator.hpp +++ /dev/null @@ -1,158 +0,0 @@ -/* -Copyright 2014-2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_HPP -#define BOOST_ALIGN_ALIGNED_ALLOCATOR_HPP - -#include <boost/align/detail/addressof.hpp> -#include <boost/align/detail/is_alignment_constant.hpp> -#include <boost/align/detail/max_objects.hpp> -#include <boost/align/detail/max_size.hpp> -#include <boost/align/aligned_alloc.hpp> -#include <boost/align/aligned_allocator_forward.hpp> -#include <boost/align/alignment_of.hpp> -#include <boost/static_assert.hpp> -#include <boost/throw_exception.hpp> -#include <new> - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -#include <utility> -#endif - -namespace boost { -namespace alignment { - -template<class T, std::size_t Alignment> -class aligned_allocator { - BOOST_STATIC_ASSERT(detail::is_alignment_constant<Alignment>::value); - -public: - typedef T value_type; - typedef T* pointer; - typedef const T* const_pointer; - typedef void* void_pointer; - typedef const void* const_void_pointer; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef T& reference; - typedef const T& const_reference; - -private: - enum { - min_align = detail::max_size<Alignment, - alignment_of<value_type>::value>::value - }; - -public: - template<class U> - struct rebind { - typedef aligned_allocator<U, Alignment> other; - }; - -#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) - aligned_allocator() = default; -#else - aligned_allocator() BOOST_NOEXCEPT { } -#endif - - template<class U> - aligned_allocator(const aligned_allocator<U, Alignment>&) - BOOST_NOEXCEPT { } - - pointer address(reference value) const BOOST_NOEXCEPT { - return detail::addressof(value); - } - - const_pointer address(const_reference value) const BOOST_NOEXCEPT { - return detail::addressof(value); - } - - pointer allocate(size_type size, const_void_pointer = 0) { - if (size == 0) { - return 0; - } - void* p = aligned_alloc(min_align, sizeof(T) * size); - if (!p) { - boost::throw_exception(std::bad_alloc()); - } - return static_cast<T*>(p); - } - - void deallocate(pointer ptr, size_type) { - boost::alignment::aligned_free(ptr); - } - - BOOST_CONSTEXPR size_type max_size() const BOOST_NOEXCEPT { - return detail::max_objects<T>::value; - } - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template<class U, class... Args> - void construct(U* ptr, Args&&... args) { - ::new((void*)ptr) U(std::forward<Args>(args)...); - } -#else - template<class U, class V> - void construct(U* ptr, V&& value) { - ::new((void*)ptr) U(std::forward<V>(value)); - } -#endif -#else - template<class U, class V> - void construct(U* ptr, const V& value) { - ::new((void*)ptr) U(value); - } -#endif - - template<class U> - void construct(U* ptr) { - ::new((void*)ptr) U(); - } - - template<class U> - void destroy(U* ptr) { - (void)ptr; - ptr->~U(); - } -}; - -template<std::size_t Alignment> -class aligned_allocator<void, Alignment> { - BOOST_STATIC_ASSERT(detail::is_alignment_constant<Alignment>::value); - -public: - typedef void value_type; - typedef void* pointer; - typedef const void* const_pointer; - - template<class U> - struct rebind { - typedef aligned_allocator<U, Alignment> other; - }; -}; - -template<class T, class U, std::size_t Alignment> -inline bool -operator==(const aligned_allocator<T, Alignment>&, - const aligned_allocator<U, Alignment>&) BOOST_NOEXCEPT -{ - return true; -} - -template<class T, class U, std::size_t Alignment> -inline bool -operator!=(const aligned_allocator<T, Alignment>&, - const aligned_allocator<U, Alignment>&) BOOST_NOEXCEPT -{ - return false; -} - -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/aligned_allocator_adaptor.hpp b/contrib/restricted/boost/boost/align/aligned_allocator_adaptor.hpp deleted file mode 100644 index 86b2d934f6..0000000000 --- a/contrib/restricted/boost/boost/align/aligned_allocator_adaptor.hpp +++ /dev/null @@ -1,162 +0,0 @@ -/* -Copyright 2014-2016 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_HPP -#define BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_HPP - -#include <boost/align/detail/is_alignment_constant.hpp> -#include <boost/align/detail/max_align.hpp> -#include <boost/align/detail/max_size.hpp> -#include <boost/align/align.hpp> -#include <boost/align/aligned_allocator_adaptor_forward.hpp> -#include <boost/align/alignment_of.hpp> -#include <boost/core/pointer_traits.hpp> -#include <boost/static_assert.hpp> -#include <new> - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -#include <memory> -#endif - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -#include <utility> -#endif - -namespace boost { -namespace alignment { - -template<class Allocator, std::size_t Alignment> -class aligned_allocator_adaptor - : public Allocator { - BOOST_STATIC_ASSERT(detail::is_alignment_constant<Alignment>::value); - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) - typedef std::allocator_traits<Allocator> traits; - typedef typename traits::template rebind_alloc<char> char_alloc; - typedef typename traits::template rebind_traits<char> char_traits; - typedef typename char_traits::pointer char_ptr; -#else - typedef typename Allocator::template rebind<char>::other char_alloc; - typedef typename char_alloc::pointer char_ptr; -#endif - -public: - typedef typename Allocator::value_type value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef void* void_pointer; - typedef const void* const_void_pointer; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - -private: - enum { - min_align = detail::max_size<Alignment, - detail::max_align<value_type, char_ptr>::value>::value - }; - -public: - template<class U> - struct rebind { -#if !defined(BOOST_NO_CXX11_ALLOCATOR) - typedef aligned_allocator_adaptor<typename traits::template - rebind_alloc<U>, Alignment> other; -#else - typedef aligned_allocator_adaptor<typename Allocator::template - rebind<U>::other, Alignment> other; -#endif - }; - -#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) - aligned_allocator_adaptor() = default; -#else - aligned_allocator_adaptor() - : Allocator() { } -#endif - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - template<class A> - explicit aligned_allocator_adaptor(A&& alloc) BOOST_NOEXCEPT - : Allocator(std::forward<A>(alloc)) { } -#else - template<class A> - explicit aligned_allocator_adaptor(const A& alloc) BOOST_NOEXCEPT - : Allocator(alloc) { } -#endif - - template<class U> - aligned_allocator_adaptor(const aligned_allocator_adaptor<U, - Alignment>& other) BOOST_NOEXCEPT - : Allocator(other.base()) { } - - Allocator& base() BOOST_NOEXCEPT { - return static_cast<Allocator&>(*this); - } - - const Allocator& base() const BOOST_NOEXCEPT { - return static_cast<const Allocator&>(*this); - } - - pointer allocate(size_type size) { - std::size_t s = size * sizeof(value_type); - std::size_t n = s + min_align - 1; - char_alloc a(base()); - char_ptr p = a.allocate(sizeof p + n); - void* r = boost::to_address(p) + sizeof p; - (void)align(min_align, s, r, n); - ::new(static_cast<void*>(static_cast<char_ptr*>(r) - 1)) char_ptr(p); - return static_cast<pointer>(r); - } - - pointer allocate(size_type size, const_void_pointer hint) { - std::size_t s = size * sizeof(value_type); - std::size_t n = s + min_align - 1; - char_ptr h = char_ptr(); - if (hint) { - h = *(static_cast<const char_ptr*>(hint) - 1); - } - char_alloc a(base()); -#if !defined(BOOST_NO_CXX11_ALLOCATOR) - char_ptr p = char_traits::allocate(a, sizeof p + n, h); -#else - char_ptr p = a.allocate(sizeof p + n, h); -#endif - void* r = boost::to_address(p) + sizeof p; - (void)align(min_align, s, r, n); - ::new(static_cast<void*>(static_cast<char_ptr*>(r) - 1)) char_ptr(p); - return static_cast<pointer>(r); - } - - void deallocate(pointer ptr, size_type size) { - char_ptr* p = reinterpret_cast<char_ptr*>(ptr) - 1; - char_ptr r = *p; - p->~char_ptr(); - char_alloc a(base()); - a.deallocate(r, sizeof r + size * sizeof(value_type) + min_align - 1); - } -}; - -template<class A, class B, std::size_t Alignment> -inline bool -operator==(const aligned_allocator_adaptor<A, Alignment>& a, - const aligned_allocator_adaptor<B, Alignment>& b) BOOST_NOEXCEPT -{ - return a.base() == b.base(); -} - -template<class A, class B, std::size_t Alignment> -inline bool -operator!=(const aligned_allocator_adaptor<A, Alignment>& a, - const aligned_allocator_adaptor<B, Alignment>& b) BOOST_NOEXCEPT -{ - return !(a == b); -} - -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/aligned_allocator_adaptor_forward.hpp b/contrib/restricted/boost/boost/align/aligned_allocator_adaptor_forward.hpp deleted file mode 100644 index f762cd1c3a..0000000000 --- a/contrib/restricted/boost/boost/align/aligned_allocator_adaptor_forward.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/* -Copyright 2014 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_FORWARD_HPP -#define BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_FORWARD_HPP - -#include <cstddef> - -namespace boost { -namespace alignment { - -template<class Allocator, std::size_t Alignment = 1> -class aligned_allocator_adaptor; - -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/aligned_allocator_forward.hpp b/contrib/restricted/boost/boost/align/aligned_allocator_forward.hpp deleted file mode 100644 index 23add71aaa..0000000000 --- a/contrib/restricted/boost/boost/align/aligned_allocator_forward.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/* -Copyright 2014 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_FORWARD_HPP -#define BOOST_ALIGN_ALIGNED_ALLOCATOR_FORWARD_HPP - -#include <cstddef> - -namespace boost { -namespace alignment { - -template<class T, std::size_t Alignment = 1> -class aligned_allocator; - -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/aligned_delete.hpp b/contrib/restricted/boost/boost/align/aligned_delete.hpp deleted file mode 100644 index 385bd557af..0000000000 --- a/contrib/restricted/boost/boost/align/aligned_delete.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/* -Copyright 2014-2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_ALIGNED_DELETE_HPP -#define BOOST_ALIGN_ALIGNED_DELETE_HPP - -#include <boost/align/aligned_alloc.hpp> -#include <boost/align/aligned_delete_forward.hpp> - -namespace boost { -namespace alignment { - -struct aligned_delete { - template<class T> - void operator()(T* ptr) const - BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(ptr->~T())) { - if (ptr) { - ptr->~T(); - boost::alignment::aligned_free(ptr); - } - } -}; - -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/aligned_delete_forward.hpp b/contrib/restricted/boost/boost/align/aligned_delete_forward.hpp deleted file mode 100644 index d5b766d7f0..0000000000 --- a/contrib/restricted/boost/boost/align/aligned_delete_forward.hpp +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2014-2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_ALIGNED_DELETE_FORWARD_HPP -#define BOOST_ALIGN_ALIGNED_DELETE_FORWARD_HPP - -namespace boost { -namespace alignment { - -struct aligned_delete; - -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/assume_aligned.hpp b/contrib/restricted/boost/boost/align/assume_aligned.hpp deleted file mode 100644 index 22e5103654..0000000000 --- a/contrib/restricted/boost/boost/align/assume_aligned.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright 2015 NumScale SAS -Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI - -Copyright 2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_ASSUME_ALIGNED_HPP -#define BOOST_ALIGN_ASSUME_ALIGNED_HPP - -#include <boost/config.hpp> - -#if defined(BOOST_MSVC) -#include <boost/align/detail/assume_aligned_msvc.hpp> -#elif defined(BOOST_CLANG) && defined(__has_builtin) -#include <boost/align/detail/assume_aligned_clang.hpp> -#elif BOOST_GCC_VERSION >= 40700 -#include <boost/align/detail/assume_aligned_gcc.hpp> -#elif defined(__INTEL_COMPILER) -#include <boost/align/detail/assume_aligned_intel.hpp> -#else -#include <boost/align/detail/assume_aligned.hpp> -#endif - -#endif diff --git a/contrib/restricted/boost/boost/align/detail/addressof.hpp b/contrib/restricted/boost/boost/align/detail/addressof.hpp deleted file mode 100644 index a314830bed..0000000000 --- a/contrib/restricted/boost/boost/align/detail/addressof.hpp +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright 2014 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_ADDRESSOF_HPP -#define BOOST_ALIGN_DETAIL_ADDRESSOF_HPP - -#include <boost/config.hpp> - -#if !defined(BOOST_NO_CXX11_ADDRESSOF) -#include <memory> -#else -#include <boost/core/addressof.hpp> -#endif - -namespace boost { -namespace alignment { -namespace detail { - -#if !defined(BOOST_NO_CXX11_ADDRESSOF) -using std::addressof; -#else -using boost::addressof; -#endif - -} /* detail */ -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/detail/align_down.hpp b/contrib/restricted/boost/boost/align/detail/align_down.hpp deleted file mode 100644 index de3c80d06d..0000000000 --- a/contrib/restricted/boost/boost/align/detail/align_down.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright 2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_ALIGN_DOWN_HPP -#define BOOST_ALIGN_DETAIL_ALIGN_DOWN_HPP - -#include <boost/align/detail/is_alignment.hpp> -#include <boost/assert.hpp> - -namespace boost { -namespace alignment { - -inline void* -align_down(void* ptr, std::size_t alignment) BOOST_NOEXCEPT -{ - BOOST_ASSERT(detail::is_alignment(alignment)); - return reinterpret_cast<void*>(~(alignment - 1) & - reinterpret_cast<std::size_t>(ptr)); -} - -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/detail/assume_aligned.hpp b/contrib/restricted/boost/boost/align/detail/assume_aligned.hpp deleted file mode 100644 index d218d8c64e..0000000000 --- a/contrib/restricted/boost/boost/align/detail/assume_aligned.hpp +++ /dev/null @@ -1,16 +0,0 @@ -/* -Copyright 2015 NumScale SAS -Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI - -Copyright 2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_HPP -#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_HPP - -#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) - -#endif diff --git a/contrib/restricted/boost/boost/align/detail/assume_aligned_clang.hpp b/contrib/restricted/boost/boost/align/detail/assume_aligned_clang.hpp deleted file mode 100644 index 4c7159fa28..0000000000 --- a/contrib/restricted/boost/boost/align/detail/assume_aligned_clang.hpp +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_CLANG_HPP -#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_CLANG_HPP - -#if __has_builtin(__builtin_assume_aligned) -#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) \ -(p) = static_cast<__typeof__(p)>(__builtin_assume_aligned((p), (n))) -#else -#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) -#endif - -#endif diff --git a/contrib/restricted/boost/boost/align/detail/assume_aligned_gcc.hpp b/contrib/restricted/boost/boost/align/detail/assume_aligned_gcc.hpp deleted file mode 100644 index 117344447a..0000000000 --- a/contrib/restricted/boost/boost/align/detail/assume_aligned_gcc.hpp +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright 2015 NumScale SAS -Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI - -Copyright 2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_GCC_HPP -#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_GCC_HPP - -#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) \ -(p) = static_cast<__typeof__(p)>(__builtin_assume_aligned((p), (n))) - -#endif diff --git a/contrib/restricted/boost/boost/align/detail/assume_aligned_intel.hpp b/contrib/restricted/boost/boost/align/detail/assume_aligned_intel.hpp deleted file mode 100644 index 6792ce005c..0000000000 --- a/contrib/restricted/boost/boost/align/detail/assume_aligned_intel.hpp +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright 2015 NumScale SAS -Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI - -Copyright 2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_INTEL_HPP -#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_INTEL_HPP - -#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \ -__assume_aligned((ptr), (alignment)) - -#endif diff --git a/contrib/restricted/boost/boost/align/detail/assume_aligned_msvc.hpp b/contrib/restricted/boost/boost/align/detail/assume_aligned_msvc.hpp deleted file mode 100644 index 75ac7e1242..0000000000 --- a/contrib/restricted/boost/boost/align/detail/assume_aligned_msvc.hpp +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2015 NumScale SAS -Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI - -Copyright 2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_MSVC_HPP -#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_MSVC_HPP - -#include <cstddef> - -#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \ -__assume((reinterpret_cast<std::size_t>(ptr) & ((alignment) - 1)) == 0) - -#endif diff --git a/contrib/restricted/boost/boost/align/detail/is_aligned.hpp b/contrib/restricted/boost/boost/align/detail/is_aligned.hpp deleted file mode 100644 index 61982c4685..0000000000 --- a/contrib/restricted/boost/boost/align/detail/is_aligned.hpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -Copyright 2014 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_IS_ALIGNED_HPP -#define BOOST_ALIGN_DETAIL_IS_ALIGNED_HPP - -#include <boost/align/detail/is_alignment.hpp> -#include <boost/assert.hpp> - -namespace boost { -namespace alignment { - -inline bool -is_aligned(const void* ptr, std::size_t alignment) BOOST_NOEXCEPT -{ - BOOST_ASSERT(detail::is_alignment(alignment)); - return (reinterpret_cast<std::size_t>(ptr) & (alignment - 1)) == 0; -} - -inline bool -is_aligned(std::size_t alignment, const void* ptr) BOOST_NOEXCEPT -{ - BOOST_ASSERT(detail::is_alignment(alignment)); - return (reinterpret_cast<std::size_t>(ptr) & (alignment - 1)) == 0; -} - -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/detail/is_alignment_constant.hpp b/contrib/restricted/boost/boost/align/detail/is_alignment_constant.hpp deleted file mode 100644 index 0ded62857e..0000000000 --- a/contrib/restricted/boost/boost/align/detail/is_alignment_constant.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2014 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_IS_ALIGNMENT_CONSTANT_HPP -#define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_CONSTANT_HPP - -#include <boost/align/detail/integral_constant.hpp> -#include <cstddef> - -namespace boost { -namespace alignment { -namespace detail { - -template<std::size_t N> -struct is_alignment_constant - : integral_constant<bool, (N > 0) && ((N & (N - 1)) == 0)> { }; - -} /* detail */ -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/detail/max_align.hpp b/contrib/restricted/boost/boost/align/detail/max_align.hpp deleted file mode 100644 index 9c09fec9c9..0000000000 --- a/contrib/restricted/boost/boost/align/detail/max_align.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2014-2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_MAX_ALIGN_HPP -#define BOOST_ALIGN_DETAIL_MAX_ALIGN_HPP - -#include <boost/align/detail/max_size.hpp> -#include <boost/align/alignment_of.hpp> - -namespace boost { -namespace alignment { -namespace detail { - -template<class A, class B> -struct max_align - : max_size<alignment_of<A>::value, alignment_of<B>::value> { }; - -} /* detail */ -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/detail/max_objects.hpp b/contrib/restricted/boost/boost/align/detail/max_objects.hpp deleted file mode 100644 index 9fdd30e118..0000000000 --- a/contrib/restricted/boost/boost/align/detail/max_objects.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 2014 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_MAX_OBJECTS_HPP -#define BOOST_ALIGN_DETAIL_MAX_OBJECTS_HPP - -#include <boost/align/detail/integral_constant.hpp> -#include <cstddef> - -namespace boost { -namespace alignment { -namespace detail { - -template<class T> -struct max_objects - : integral_constant<std::size_t, - ~static_cast<std::size_t>(0) / sizeof(T)> { }; - -} /* detail */ -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/detail/max_size.hpp b/contrib/restricted/boost/boost/align/detail/max_size.hpp deleted file mode 100644 index 22cefdbec5..0000000000 --- a/contrib/restricted/boost/boost/align/detail/max_size.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2014-2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_MAX_SIZE_HPP -#define BOOST_ALIGN_DETAIL_MAX_SIZE_HPP - -#include <boost/align/detail/integral_constant.hpp> -#include <cstddef> - -namespace boost { -namespace alignment { -namespace detail { - -template<std::size_t A, std::size_t B> -struct max_size - : integral_constant<std::size_t, (A > B) ? A : B> { }; - -} /* detail */ -} /* alignment */ -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/align/is_aligned.hpp b/contrib/restricted/boost/boost/align/is_aligned.hpp deleted file mode 100644 index c8266d0eae..0000000000 --- a/contrib/restricted/boost/boost/align/is_aligned.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2014 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) - -*/ -#ifndef BOOST_ALIGN_IS_ALIGNED_HPP -#define BOOST_ALIGN_IS_ALIGNED_HPP - -#include <boost/align/detail/is_aligned.hpp> - -namespace boost { -namespace alignment { - -BOOST_CONSTEXPR inline bool -is_aligned(std::size_t value, std::size_t alignment) BOOST_NOEXCEPT -{ - return (value & (alignment - 1)) == 0; -} - -} /* alignment */ -} /* boost */ - -#endif diff --git a/library/cpp/yt/small_containers/compact_set-inl.h b/library/cpp/yt/small_containers/compact_set-inl.h index 75b8600175..c027f44600 100644 --- a/library/cpp/yt/small_containers/compact_set-inl.h +++ b/library/cpp/yt/small_containers/compact_set-inl.h @@ -230,6 +230,12 @@ typename TCompactSet<T, N, C>::size_type TCompactSet<T, N, C>::count(const T& v) } template <typename T, unsigned N, typename C> +bool TCompactSet<T, N, C>::contains(const T& v) const +{ + return count(v) == 1; +} + +template <typename T, unsigned N, typename C> std::pair<typename TCompactSet<T, N, C>::const_iterator, bool> TCompactSet<T, N, C>::insert(const T& v) { if (!IsSmall()) { diff --git a/library/cpp/yt/small_containers/compact_set.h b/library/cpp/yt/small_containers/compact_set.h index 2ca8713ea7..910eef88eb 100644 --- a/library/cpp/yt/small_containers/compact_set.h +++ b/library/cpp/yt/small_containers/compact_set.h @@ -46,6 +46,7 @@ private: public: class const_iterator; using size_type = std::size_t; + using key_type = T; TCompactSet() {} @@ -58,6 +59,9 @@ public: /// count - Return true if the element is in the set. size_type count(const T& v) const; + /// contains - Return true if the element is in the set. + bool contains(const T& v) const; + /// insert - Insert an element into the set if it isn't already there. std::pair<const_iterator, bool> insert(const T& v); |