From 48f76dbb5211e9731b7f8aa19209ba86a1b8df23 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 29 Sep 2019 09:47:32 -0700 Subject: [PATCH] Remove unneeded stuff --- src/text/boost/config.hpp | 3 - src/text/boost/text/config.hpp | 4 +- src/text/boost/text/detail/algorithm.hpp | 580 -------------------- src/text/boost/text/detail/iterator.hpp | 424 -------------- src/text/boost/text/detail/sentinel_tag.hpp | 12 - src/text/boost/text/grapheme_break.hpp | 3 +- src/text/grapheme_break.cpp | 6 +- 7 files changed, 4 insertions(+), 1028 deletions(-) delete mode 100644 src/text/boost/config.hpp delete mode 100644 src/text/boost/text/detail/algorithm.hpp delete mode 100644 src/text/boost/text/detail/iterator.hpp delete mode 100644 src/text/boost/text/detail/sentinel_tag.hpp diff --git a/src/text/boost/config.hpp b/src/text/boost/config.hpp deleted file mode 100644 index 8dadfc0a..00000000 --- a/src/text/boost/config.hpp +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef BOOST_CXX14_CONSTEXPR -# define BOOST_CXX14_CONSTEXPR -#endif diff --git a/src/text/boost/text/config.hpp b/src/text/boost/text/config.hpp index 2c3797c5..93ca833d 100755 --- a/src/text/boost/text/config.hpp +++ b/src/text/boost/text/config.hpp @@ -1,8 +1,6 @@ #ifndef BOOST_TEXT_CONFIG_HPP #define BOOST_TEXT_CONFIG_HPP -#include - /** There are ICU-based implementations of many operations, but those are only defined when BOOST_TEXT_HAS_ICU is nonzero. If you define this, you must @@ -38,7 +36,7 @@ # define BOOST_TEXT_CXX14_CONSTEXPR # define BOOST_TEXT_NO_CXX14_CONSTEXPR #else -# define BOOST_TEXT_CXX14_CONSTEXPR BOOST_CXX14_CONSTEXPR +# define BOOST_TEXT_CXX14_CONSTEXPR # if defined(BOOST_NO_CXX14_CONSTEXPR) # define BOOST_TEXT_NO_CXX14_CONSTEXPR # endif diff --git a/src/text/boost/text/detail/algorithm.hpp b/src/text/boost/text/detail/algorithm.hpp deleted file mode 100644 index e7e01371..00000000 --- a/src/text/boost/text/detail/algorithm.hpp +++ /dev/null @@ -1,580 +0,0 @@ -#ifndef BOOST_TEXT_DETAIL_ALGORITHM_HPP -#define BOOST_TEXT_DETAIL_ALGORITHM_HPP - -#include - -#include - -#include -#include -#include - - -namespace boost { namespace text { - - struct unencoded_rope; - struct unencoded_rope_view; - -}} - -namespace boost { namespace text { namespace detail { - - template - struct void_ - { - using type = void; - }; - - template - using void_t = typename void_::type; - - template - struct fixup_ptr - { - using type = T; - }; - - template - using remove_v_t = typename std::remove_volatile::type; - - template - struct fixup_ptr - { - using type = remove_v_t const *; - }; - - template - using fixup_ptr_t = typename fixup_ptr::type; - - template - using remove_cv_ref_t = - typename std::remove_cv::type>::type; - - struct nonesuch - {}; - - template< - typename Default, - typename AlwaysVoid, - template class Template, - typename... Args> - struct detector - { - using value_t = std::false_type; - using type = Default; - }; - - template< - typename Default, - template class Template, - typename... Args> - struct detector>, Template, Args...> - { - using value_t = std::true_type; - using type = Template; - }; - - template class Template, typename... Args> - using is_detected = - typename detector::value_t; - - template class Template, typename... Args> - using detected_t = - typename detector::type; - - template< - typename Default, - template class Template, - typename... Args> - using detected_or = - typename detector::type; - - - - template - using has_begin = decltype(*std::begin(std::declval())); - template - using has_end = decltype(*std::end(std::declval())); - - template - using value_type_ = typename std::remove_cv< - typename std::remove_reference::type>::type; - - - template - using nonpointer_iterator_category_ = - typename T::iterator::iterator_category; - - template - using iterator_category_ = typename std::conditional< - std::is_pointer::value, - std::random_access_iterator_tag, - detected_t>::type; - - - - template - struct is_convertible_and_n_bytes - : std::integral_constant< - bool, - std::is_convertible::value && sizeof(T) == N> - { - }; - - - - template - using is_char_iter = std::integral_constant< - bool, - std::is_same::type>::value || - std::is_same::type>:: - value || - is_convertible_and_n_bytes, char, 1>:: - value>; - - template - using is_char_range = std::integral_constant< - bool, - std::is_same, unencoded_rope_view>::value || - std::is_same, unencoded_rope>::value || - (is_convertible_and_n_bytes< - remove_cv_ref_t>, - char, - 1>::value && - is_convertible_and_n_bytes< - remove_cv_ref_t>, - char, - 1>::value)>; - - - - template< - typename T, - typename R1, - typename Exclude1, - typename Exclude2, - bool R1IsCharRange = is_char_range::value && - !std::is_same::value && - !std::is_same::value> - struct rng_alg_ret - { - }; - - template - struct rng_alg_ret - { - using type = T; - }; - - template< - typename T, - typename R1, - typename Exclude1 = void, - typename Exclude2 = void> - using rng_alg_ret_t = typename rng_alg_ret::type; - - template< - typename T, - typename R1, - typename R2, - bool R1IsCharRange = is_char_range::value, - bool R2IsCharRange = is_char_range::value> - struct rngs_alg_ret - { - }; - - template - struct rngs_alg_ret - { - using type = T; - }; - - template - using rngs_alg_ret_t = typename rngs_alg_ret::type; - - - - template - using has_contig_begin = decltype(&*std::begin(std::declval())); - template - using has_contig_end = decltype(&*std::end(std::declval())); - - template - using is_contig_char_range = std::integral_constant< - bool, - std::is_same< - fixup_ptr_t>, - char const *>::value && - std::is_same< - fixup_ptr_t>, - char const *>::value && - std::is_convertible< - iterator_category_, - std::random_access_iterator_tag>::value && - !std::is_same::value && - !std::is_same::value>; - - - - template< - typename T, - typename R1, - bool R1IsContigCharRange = is_contig_char_range::value> - struct contig_rng_alg_ret - { - }; - - template - struct contig_rng_alg_ret - { - using type = T; - }; - - template - using contig_rng_alg_ret_t = typename contig_rng_alg_ret::type; - - template< - typename T, - typename R1, - typename R2, - bool R1IsContigCharRange = is_contig_char_range::value, - bool R2IsContigCharRange = is_contig_char_range::value> - struct contig_rngs_alg_ret - { - }; - - template - struct contig_rngs_alg_ret - { - using type = T; - }; - - template - using contig_rngs_alg_ret_t = typename contig_rngs_alg_ret::type; - - - - template - using is_char16_range = std::integral_constant< - bool, - (is_convertible_and_n_bytes< - remove_cv_ref_t>, - uint16_t, - 2>::value && - is_convertible_and_n_bytes< - remove_cv_ref_t>, - uint16_t, - 2>::value)>; - - - - template< - typename T, - typename R1, - bool R1IsChar16Range = is_char16_range::value> - struct rng16_alg_ret - { - }; - - template - struct rng16_alg_ret - { - using type = T; - }; - - template - using rng16_alg_ret_t = typename rng16_alg_ret::type; - - - - template< - typename T, - typename R1, - bool R1IsCharRange = is_char_iter::value> - struct char_iter_ret - { - }; - - template - struct char_iter_ret - { - using type = T; - }; - - template - using char_iter_ret_t = typename char_iter_ret::type; - - - - template - using is_code_point = std::integral_constant< - bool, - (std::is_unsigned::value && std::is_integral::value && - sizeof(T) == 4)>; - - template - using has_deref_and_incr = - std::pair()), decltype(++std::declval())>; - - template - using is_cp_iter = std::integral_constant< - bool, - ((std::is_pointer::value && - is_code_point::type>::type>::value) || - (is_detected::value && - is_code_point>::type>::value))>; - - template::value> - struct cp_iter_ret - { - }; - - template - struct cp_iter_ret - { - using type = T; - }; - - template - using cp_iter_ret_t = typename cp_iter_ret::type; - - - template - using is_16_code_unit = std::integral_constant< - bool, - (std::is_unsigned::value && std::is_integral::value && - sizeof(T) == 2)>; - - template - using is_16_iter = std::integral_constant< - bool, - ((std::is_pointer::value && - is_16_code_unit::type>::type>::value) || - (is_detected::value && - is_16_code_unit>::type>::value))>; - - template::value> - struct _16_iter_ret - { - }; - - template - struct _16_iter_ret - { - using type = T; - }; - - template - using _16_iter_ret_t = typename _16_iter_ret::type; - - - template - using is_8_code_unit = std:: - integral_constant::value && sizeof(T) == 1>; - - template - using is_8_iter = std::integral_constant< - bool, - ((std::is_pointer::value && - is_8_code_unit::type>::type>::value) || - (is_detected::value && - is_8_code_unit>::type>::value))>; - - template::value> - struct _8_iter_ret - { - }; - - template - struct _8_iter_ret - { - using type = T; - }; - - template - using _8_iter_ret_t = typename _8_iter_ret::type; - - - - template - using comparable_ = decltype(std::declval() == std::declval()); - - template< - typename T, - typename CPIter, - typename Sentinel, - bool FIsWordPropFunc = is_cp_iter::value && - is_detected::value> - struct cp_iter_sntl_ret - { - }; - - template - struct cp_iter_sntl_ret - { - using type = T; - }; - - template - using cp_iter_sntl_ret_t = - typename cp_iter_sntl_ret::type; - - - - template - using cp_rng_alg_ret_t = cp_iter_sntl_ret_t< - T, - decltype(std::declval().begin()), - decltype(std::declval().end())>; - - - - template - using is_grapheme_char_range = std::integral_constant< - bool, - is_char_iter().begin().base().base())>>::value && - is_char_iter().end().base().base())>>::value>; - - template< - typename T, - typename R1, - bool R1IsGraphemeCharRange = is_grapheme_char_range::value> - struct graph_rng_alg_ret - { - }; - - template - struct graph_rng_alg_ret - { - using type = T; - }; - - template - using graph_rng_alg_ret_t = typename graph_rng_alg_ret::type; - - - - template - using is_contig_grapheme_char_range = std::integral_constant< - bool, - (std::is_same< - decltype(std::declval().begin().base().base()), - char const *>::value || - std::is_same< - decltype(std::declval().begin().base().base()), - char *>::value) && - (std::is_same< - decltype(std::declval().end().base().base()), - char const *>::value || - std::is_same< - decltype(std::declval().end().base().base()), - char *>::value)>; - - template< - typename T, - typename R1, - bool R1IsContigGraphemeCharRange = - is_contig_grapheme_char_range::value> - struct contig_graph_rng_alg_ret - { - }; - - template - struct contig_graph_rng_alg_ret - { - using type = T; - }; - - template - using contig_graph_rng_alg_ret_t = - typename contig_graph_rng_alg_ret::type; - - - - template - detail::reverse_iterator make_reverse_iterator(Iter it) - { - return detail::reverse_iterator(it); - } - - inline std::size_t - hash_combine_(std::size_t seed, std::size_t value) noexcept - { - return seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2); - } - - template - struct hash_4_more_chars - { - template - static std::size_t call(std::size_t curr, Iter it) - { - return curr; - } - }; - - template<> - struct hash_4_more_chars<8> - { - template - static std::size_t call(std::size_t curr, Iter it) - { - curr <<= 32; - curr += (*(it + 4) << 24) + (*(it + 5) << 16) + (*(it + 2) << 6) + - (*(it + 7) << 0); - return curr; - } - }; - - template - std::size_t hash_char_range(CharRange const & r) noexcept - { - auto first = r.begin(); - auto last = r.end(); - auto const size = last - first; - auto const remainder = size % sizeof(std::size_t); - last -= remainder; - - std::size_t retval = size; - for (; first != last; first += sizeof(std::size_t)) { - std::size_t curr = (*(first + 0) << 24) + (*(first + 1) << 16) + - (*(first + 2) << 8) + (*(first + 3) << 0); - curr = hash_4_more_chars::call(curr, first); - retval = hash_combine_(retval, curr); - } - - first = last; - last += remainder; - for (; first != last; ++first) { - retval = hash_combine_(retval, *first); - } - - return retval; - } - - template - std::size_t hash_grapheme_range(GraphemeRange const & r) noexcept - { - std::size_t cps = 0; - std::size_t retval = std::accumulate( - r.begin().base(), - r.end().base(), - std::size_t(0), - [&cps](std::size_t seed, std::size_t value) { - ++cps; - return hash_combine_(seed, value); - }); - return hash_combine_(retval, cps); - } - -}}} - -#endif diff --git a/src/text/boost/text/detail/iterator.hpp b/src/text/boost/text/detail/iterator.hpp deleted file mode 100644 index 091e8529..00000000 --- a/src/text/boost/text/detail/iterator.hpp +++ /dev/null @@ -1,424 +0,0 @@ -#ifndef BOOST_TEXT_DETAIL_ITERATOR_HPP -#define BOOST_TEXT_DETAIL_ITERATOR_HPP - -#include - -#include - - -namespace boost { namespace text { namespace detail { - - template - struct arrow_proxy - { - T * operator->() noexcept { return &value_; } - T const * operator->() const noexcept { return &value_; } - - explicit arrow_proxy(T value) noexcept : value_(std::move(value)) {} - - private: - T value_; - }; - - template - struct invoke_op_arrow - { - template - static arrow_proxy call(U && value) noexcept - { - return arrow_proxy(std::forward(value)); - } - }; - - template - struct invoke_op_arrow - { - static T * call(T & value) noexcept { return &value; } - }; - - - template - struct reverse_iterator - { - using iterator_category = - typename std::iterator_traits::iterator_category; - using value_type = typename std::iterator_traits::value_type; - using difference_type = - typename std::iterator_traits::difference_type; - using pointer = typename std::conditional< - IterIsProxy, - arrow_proxy, - typename std::iterator_traits::pointer>::type; - using reference = typename std::iterator_traits::reference; - using iterator_type = Iter; - - constexpr reverse_iterator() noexcept : it_() {} - explicit constexpr reverse_iterator(iterator_type it) noexcept : it_(it) - {} - - constexpr reverse_iterator(reverse_iterator const & other) noexcept : - it_(other.it_) - {} - - template - constexpr reverse_iterator( - const reverse_iterator & other) noexcept : - it_(other.base()) - {} - - constexpr iterator_type base() const noexcept { return it_; } - - BOOST_TEXT_CXX14_CONSTEXPR reference operator*() const noexcept - { - Iter temp = it_; - return *--temp; - } - - constexpr pointer operator->() const noexcept - { - Iter temp = it_; - return invoke_op_arrow::call(*--temp); - } - - constexpr reference operator[](difference_type n) const noexcept - { - return *(it_ - n - 1); - } - - constexpr reverse_iterator operator+(difference_type n) const noexcept - { - return reverse_iterator(it_ - n); - } - - constexpr reverse_iterator operator-(difference_type n) const noexcept - { - return reverse_iterator(it_ + n); - } - - BOOST_TEXT_CXX14_CONSTEXPR reverse_iterator & operator++() noexcept - { - --it_; - return *this; - } - - BOOST_TEXT_CXX14_CONSTEXPR reverse_iterator operator++(int)noexcept - { - reverse_iterator retval = *this; - --it_; - return retval; - } - - BOOST_TEXT_CXX14_CONSTEXPR reverse_iterator & operator--() noexcept - { - ++it_; - return *this; - } - - BOOST_TEXT_CXX14_CONSTEXPR reverse_iterator operator--(int)noexcept - { - reverse_iterator retval = *this; - ++it_; - return retval; - } - - BOOST_TEXT_CXX14_CONSTEXPR reverse_iterator & - operator+=(difference_type n) noexcept - { - it_ -= n; - return *this; - } - - BOOST_TEXT_CXX14_CONSTEXPR reverse_iterator & - operator-=(difference_type n) noexcept - { - it_ += n; - return *this; - } - - private: - Iter it_; - }; - - template - constexpr bool operator==( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - { - return lhs.base() == rhs.base(); - } - - template - constexpr bool operator<( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - { - return rhs.base() < lhs.base(); - } - - template - constexpr bool operator!=( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - { - return !(lhs == rhs); - } - - template - constexpr bool operator>( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - { - return rhs < lhs; - } - - template - constexpr bool operator<=( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - { - return !(rhs < lhs); - } - - template - constexpr bool operator>=( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - { - return !(lhs < rhs); - } - - template< - typename Iter1, - bool Iter1IsProxy, - typename Iter2, - bool Iter2IsProxy> - constexpr bool operator==( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - { - return lhs.base() == rhs.base(); - } - - template< - typename Iter1, - bool Iter1IsProxy, - typename Iter2, - bool Iter2IsProxy> - constexpr bool operator<( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - { - return rhs.base() < lhs.base(); - } - - template< - typename Iter1, - bool Iter1IsProxy, - typename Iter2, - bool Iter2IsProxy> - constexpr bool operator!=( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - { - return !(lhs == rhs); - } - - template< - typename Iter1, - bool Iter1IsProxy, - typename Iter2, - bool Iter2IsProxy> - constexpr bool operator>( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - { - return rhs < lhs; - } - - template< - typename Iter1, - bool Iter1IsProxy, - typename Iter2, - bool Iter2IsProxy> - constexpr bool operator<=( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - { - return !(rhs < lhs); - } - - template< - typename Iter1, - bool Iter1IsProxy, - typename Iter2, - bool Iter2IsProxy> - constexpr bool operator>=( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - { - return !(lhs < rhs); - } - - template< - typename Iter1, - bool Iter1IsProxy, - typename Iter2, - bool Iter2IsProxy> - constexpr auto operator-( - reverse_iterator const & lhs, - reverse_iterator const & rhs) noexcept - -> decltype(rhs.base() - lhs.base()) - { - return rhs.base() - lhs.base(); - } - - using reverse_char_iterator = reverse_iterator; - using const_reverse_char_iterator = reverse_iterator; - - - struct const_repeated_chars_iterator - { - using value_type = char; - using difference_type = std::ptrdiff_t; - using pointer = char const *; - using reference = char; - using iterator_category = std::random_access_iterator_tag; - - constexpr const_repeated_chars_iterator() noexcept : - first_(nullptr), - size_(0), - n_(0) - {} - constexpr const_repeated_chars_iterator( - char const * first, - difference_type size, - difference_type n) noexcept : - first_(first), - size_(size), - n_(n) - {} - - constexpr reference operator*() const noexcept - { - return first_[n_ % size_]; - } - - constexpr value_type operator[](difference_type n) const noexcept - { - return first_[(n_ + n) % size_]; - } - - BOOST_TEXT_CXX14_CONSTEXPR const_repeated_chars_iterator & - operator++() noexcept - { - ++n_; - return *this; - } - BOOST_TEXT_CXX14_CONSTEXPR const_repeated_chars_iterator - operator++(int)noexcept - { - const_repeated_chars_iterator retval = *this; - ++*this; - return retval; - } - BOOST_TEXT_CXX14_CONSTEXPR const_repeated_chars_iterator & - operator+=(difference_type n) noexcept - { - n_ += n; - return *this; - } - - BOOST_TEXT_CXX14_CONSTEXPR const_repeated_chars_iterator & - operator--() noexcept - { - --n_; - return *this; - } - BOOST_TEXT_CXX14_CONSTEXPR const_repeated_chars_iterator - operator--(int)noexcept - { - const_repeated_chars_iterator retval = *this; - --*this; - return retval; - } - BOOST_TEXT_CXX14_CONSTEXPR const_repeated_chars_iterator & - operator-=(difference_type n) noexcept - { - n_ -= n; - return *this; - } - - friend constexpr bool operator==( - const_repeated_chars_iterator lhs, - const_repeated_chars_iterator rhs) noexcept - { - return lhs.first_ == rhs.first_ && lhs.n_ == rhs.n_; - } - friend constexpr bool operator!=( - const_repeated_chars_iterator lhs, - const_repeated_chars_iterator rhs) noexcept - { - return !(lhs == rhs); - } - friend constexpr bool operator<( - const_repeated_chars_iterator lhs, - const_repeated_chars_iterator rhs) noexcept - { - return lhs.first_ == rhs.first_ && lhs.n_ < rhs.n_; - } - friend constexpr bool operator<=( - const_repeated_chars_iterator lhs, - const_repeated_chars_iterator rhs) noexcept - { - return lhs == rhs || lhs < rhs; - } - friend constexpr bool operator>( - const_repeated_chars_iterator lhs, - const_repeated_chars_iterator rhs) noexcept - { - return rhs < lhs; - } - friend constexpr bool operator>=( - const_repeated_chars_iterator lhs, - const_repeated_chars_iterator rhs) noexcept - { - return rhs <= lhs; - } - - friend BOOST_TEXT_CXX14_CONSTEXPR const_repeated_chars_iterator - operator+( - const_repeated_chars_iterator lhs, difference_type rhs) noexcept - { - return lhs += rhs; - } - friend BOOST_TEXT_CXX14_CONSTEXPR const_repeated_chars_iterator - operator+( - difference_type lhs, const_repeated_chars_iterator rhs) noexcept - { - return rhs += lhs; - } - friend BOOST_TEXT_CXX14_CONSTEXPR const_repeated_chars_iterator - operator-( - const_repeated_chars_iterator lhs, difference_type rhs) noexcept - { - return lhs -= rhs; - } - friend constexpr difference_type operator-( - const_repeated_chars_iterator lhs, - const_repeated_chars_iterator rhs) noexcept - { - return lhs.n_ - rhs.n_; - } - - private: - char const * first_; - difference_type size_; - difference_type n_; - }; - - using const_reverse_repeated_chars_iterator = - reverse_iterator; - -}}} - -#endif diff --git a/src/text/boost/text/detail/sentinel_tag.hpp b/src/text/boost/text/detail/sentinel_tag.hpp deleted file mode 100644 index 3a2d2f0f..00000000 --- a/src/text/boost/text/detail/sentinel_tag.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef BOOST_TEXT_DETAIL_SENTINEL_TAG_HPP -#define BOOST_TEXT_DETAIL_SENTINEL_TAG_HPP - - -namespace boost { namespace text { namespace detail { - struct sentinel_tag - {}; - struct non_sentinel_tag - {}; -}}} - -#endif diff --git a/src/text/boost/text/grapheme_break.hpp b/src/text/boost/text/grapheme_break.hpp index c45e5175..92050d65 100644 --- a/src/text/boost/text/grapheme_break.hpp +++ b/src/text/boost/text/grapheme_break.hpp @@ -1,13 +1,12 @@ #ifndef BOOST_TEXT_GRAPHEME_BREAK_HPP #define BOOST_TEXT_GRAPHEME_BREAK_HPP -#include - #include #include #include +#define BOOST_TEXT_DECL namespace boost { namespace text { diff --git a/src/text/grapheme_break.cpp b/src/text/grapheme_break.cpp index 41a6e328..ef9c7c75 100644 --- a/src/text/grapheme_break.cpp +++ b/src/text/grapheme_break.cpp @@ -2,8 +2,6 @@ #include #include -#include - #include #include #include @@ -3583,8 +3581,8 @@ std::copy( compressed.begin(), compressed.end(), lzw_to_break_prop_iter(retval, buf)); -BOOST_ASSERT(buf.empty()); -BOOST_ASSERT(retval.size() == 15958); +assert(buf.empty()); +assert(retval.size() == 15958); return retval; }