mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
temporary workaround for old GCC
This commit is contained in:
parent
8274f34db4
commit
6e8f686f72
6 changed files with 101 additions and 20 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <sprout/algorithm/cxx14/swap_ranges.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
#include <sprout/utility/string_view/string_view_fwd.hpp>
|
||||
#include <sprout/type_traits/integral_constant.hpp>
|
||||
#include <sprout/type_traits/identity.hpp>
|
||||
#include <sprout/type_traits/enabler_if.hpp>
|
||||
|
@ -885,6 +886,9 @@ namespace sprout {
|
|||
SPROUT_EXPLICIT_CONVERSION SPROUT_NON_CONSTEXPR operator std::basic_string<T, Traits, Allocator>() const {
|
||||
return std::basic_string<T, Traits, Allocator>(data(), size());
|
||||
}
|
||||
operator sprout::basic_string_view<T, Traits>() const SPROUT_NOEXCEPT {
|
||||
return sprout::basic_string_view<T, Traits>(*this);
|
||||
}
|
||||
|
||||
SPROUT_CXX14_CONSTEXPR void rangecheck(size_type i) const {
|
||||
return i >= size() ? throw std::out_of_range("basic_string<>: index out of range")
|
||||
|
|
|
@ -137,6 +137,12 @@ namespace sprout {
|
|||
return sprout::sub_window(arr, to_first);
|
||||
}
|
||||
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container&> >::type
|
||||
sub(Container& arr) {
|
||||
return sprout::sub(arr, sprout::begin(arr), sprout::end(arr));
|
||||
}
|
||||
|
||||
//
|
||||
// csub
|
||||
//
|
||||
|
@ -218,6 +224,12 @@ namespace sprout {
|
|||
return sprout::csub_window(arr, to_first);
|
||||
}
|
||||
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container const&> >::type
|
||||
csub(Container const& arr) {
|
||||
return sprout::csub(arr, sprout::begin(arr), sprout::end(arr));
|
||||
}
|
||||
|
||||
//
|
||||
// sub_copy
|
||||
//
|
||||
|
@ -298,6 +310,12 @@ namespace sprout {
|
|||
{
|
||||
return sprout::sub_window_copy(arr, to_first);
|
||||
}
|
||||
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<!sprout::is_sub_array<Container>::value, sprout::sub_array<Container> >::type
|
||||
sub_copy(Container const& arr) {
|
||||
return sprout::sub_copy(arr, sprout::begin(arr), sprout::end(arr));
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_SUB_ARRAY_SUB_HPP
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <sprout/iterator/reverse_iterator.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
#include <sprout/string/char_traits.hpp>
|
||||
#include <sprout/utility/string_view/string_view_fwd.hpp>
|
||||
#include <sprout/string/npos.hpp>
|
||||
#include <sprout/string/string.hpp>
|
||||
#include <sprout/string/detail/operations.hpp>
|
||||
|
@ -31,7 +31,7 @@ namespace sprout {
|
|||
//
|
||||
// basic_string_view
|
||||
//
|
||||
template<typename T, typename Traits = sprout::char_traits<T> >
|
||||
template<typename T, typename Traits>
|
||||
class basic_string_view {
|
||||
public:
|
||||
typedef T value_type;
|
||||
|
@ -94,14 +94,14 @@ namespace sprout {
|
|||
: ptr_(str), len_(traits_type::length(str))
|
||||
{}
|
||||
template<std::size_t N>
|
||||
SPROUT_CONSTEXPR basic_string_view(sprout::basic_string<T, N, Traits> const& str)
|
||||
SPROUT_CONSTEXPR basic_string_view(sprout::basic_string<T, N, Traits> const& str) SPROUT_NOEXCEPT
|
||||
: ptr_(str.data()), len_(str.size())
|
||||
{}
|
||||
template<typename Allocator>
|
||||
SPROUT_NON_CONSTEXPR basic_string_view(std::basic_string<T, Traits, Allocator> const& str)
|
||||
SPROUT_NON_CONSTEXPR basic_string_view(std::basic_string<T, Traits, Allocator> const& str) SPROUT_NOEXCEPT
|
||||
: ptr_(str.data()), len_(str.size())
|
||||
{}
|
||||
SPROUT_CONSTEXPR basic_string_view(const_pointer str, size_type len)
|
||||
SPROUT_CONSTEXPR basic_string_view(const_pointer str, size_type len) SPROUT_NOEXCEPT
|
||||
: ptr_(str), len_(len)
|
||||
{}
|
||||
// iterators:
|
||||
|
|
22
sprout/utility/string_view/string_view_fwd.hpp
Normal file
22
sprout/utility/string_view/string_view_fwd.hpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 Bolero MURAKAMI
|
||||
https://github.com/bolero-MURAKAMI/Sprout
|
||||
|
||||
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)
|
||||
=============================================================================*/
|
||||
#ifndef SPROUT_UTILITY_STRING_VIEW_STRING_VIEW_FWD_HPP
|
||||
#define SPROUT_UTILITY_STRING_VIEW_STRING_VIEW_FWD_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/string/char_traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// basic_string_view
|
||||
//
|
||||
template<typename T, typename Traits = sprout::char_traits<T> >
|
||||
class basic_string_view;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_UTILITY_STRING_VIEW_STRING_VIEW_FWD_HPP
|
|
@ -118,9 +118,11 @@ namespace sprout {
|
|||
return sprout::addressof(p);
|
||||
}
|
||||
static SPROUT_CONSTEXPR reference ref(holder_type r) {
|
||||
return r ? *r
|
||||
: (throw sprout::bad_optional_access("value_holder<>: bad optional access"), *r)
|
||||
;
|
||||
return *r;
|
||||
// !!!
|
||||
// return r ? *r
|
||||
// : (throw sprout::bad_optional_access("value_holder<>: bad optional access"), *r)
|
||||
// ;
|
||||
}
|
||||
static SPROUT_CONSTEXPR pointer ptr(holder_type r) SPROUT_NOEXCEPT {
|
||||
return r;
|
||||
|
@ -148,9 +150,11 @@ namespace sprout {
|
|||
return sprout::addressof(p);
|
||||
}
|
||||
static SPROUT_CONSTEXPR reference ref(holder_type r) {
|
||||
return r ? *r
|
||||
: (throw sprout::bad_optional_access("value_holder<>: bad optional access"), *r)
|
||||
;
|
||||
return *r;
|
||||
// !!!
|
||||
// return r ? *r
|
||||
// : (throw sprout::bad_optional_access("value_holder<>: bad optional access"), *r)
|
||||
// ;
|
||||
}
|
||||
static SPROUT_CONSTEXPR pointer ptr(holder_type r) SPROUT_NOEXCEPT {
|
||||
return r;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue