fix for gcc 5.1.0

This commit is contained in:
bolero-MURAKAMI 2015-04-28 01:55:35 +09:00
parent 2893664abf
commit 22b65a01d6
7 changed files with 46 additions and 37 deletions

View file

@ -11,11 +11,13 @@
#ifndef SPROUT_ALGORITHM_PARTITION_POINT_HPP
#define SPROUT_ALGORITHM_PARTITION_POINT_HPP
#include <iterator>
#include <sprout/config.hpp>
#include <sprout/detail/predef.hpp>
#include <sprout/iterator/operation.hpp>
namespace sprout {
#ifdef SPROUT_CONFIG_DISABLE_CXX14_CONSTEXPR
#if defined(SPROUT_CONFIG_DISABLE_CXX14_CONSTEXPR) || SPROUT_GCC_IN_RANGE((5, 1, 0), (5, 1, 1))
namespace detail {
template<typename ForwardIterator, typename Predicate>
inline SPROUT_CONSTEXPR ForwardIterator

View file

@ -212,9 +212,9 @@ namespace sprout {
}
// others:
SPROUT_CXX14_CONSTEXPR void rangecheck(size_type i) const {
if (i >= size()) {
throw std::out_of_range("array<>: index out of range");
}
return i >= size() ? throw std::out_of_range("uuid: index out of range")
: (void)0
;
}
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION

View file

@ -155,9 +155,9 @@ namespace sprout {
}
// others:
SPROUT_CXX14_CONSTEXPR void rangecheck(size_type i) const {
if (i >= size()) {
throw std::out_of_range("pit<>: index out of range");
}
return i >= size() ? throw std::out_of_range("uuid: index out of range")
: (void)0
;
}
};
template<typename Container>

View file

@ -15,6 +15,7 @@
#include <type_traits>
#include <initializer_list>
#include <sprout/config.hpp>
#include <sprout/detail/predef.hpp>
#include <sprout/workaround/std/cstddef.hpp>
#include <sprout/index_tuple/metafunction.hpp>
#include <sprout/array/array.hpp>
@ -603,19 +604,19 @@ namespace sprout {
}
SPROUT_CXX14_CONSTEXPR pointer
data() SPROUT_NOEXCEPT {
return &elems[0];
return elems;
}
SPROUT_CONSTEXPR const_pointer
data() const SPROUT_NOEXCEPT {
return &elems[0];
return elems;
}
SPROUT_CXX14_CONSTEXPR pointer
c_array() SPROUT_NOEXCEPT {
return &elems[0];
return elems;
}
SPROUT_CONSTEXPR const_pointer
c_array() const SPROUT_NOEXCEPT {
return &elems[0];
return elems;
}
template<std::size_t N2>
SPROUT_CONSTEXPR size_type
@ -692,7 +693,11 @@ namespace sprout {
}
SPROUT_CONSTEXPR size_type
find_first_not_of(value_type const* s, size_type pos, size_type n) const {
#if SPROUT_GCC_IN_RANGE((5, 1, 0), (5, 1, 1))
return sprout::string_detail::find_first_not_of_impl<basic_string>(begin(), size(), sprout::ptr_index(s), pos, n);
#else
return sprout::string_detail::find_first_not_of_impl<basic_string>(begin(), size(), s, pos, n);
#endif
}
SPROUT_CONSTEXPR size_type
find_first_not_of(value_type const* s, size_type pos = 0) const {
@ -709,7 +714,11 @@ namespace sprout {
}
SPROUT_CONSTEXPR size_type
find_last_not_of(value_type const* s, size_type pos, size_type n) const {
#if SPROUT_GCC_IN_RANGE((5, 1, 0), (5, 1, 1))
return sprout::string_detail::find_last_not_of_impl<basic_string>(begin(), size(), sprout::ptr_index(s), pos, n);
#else
return sprout::string_detail::find_last_not_of_impl<basic_string>(begin(), size(), s, pos, n);
#endif
}
SPROUT_CONSTEXPR size_type
find_last_not_of(value_type const* s, size_type pos = npos) const {
@ -764,11 +773,10 @@ namespace sprout {
return std::basic_string<T, Traits, Allocator>(data(), size());
}
SPROUT_CXX14_CONSTEXPR void
rangecheck(size_type i) const {
if (i >= size()) {
throw std::out_of_range("basic_string<>: index out of range");
}
SPROUT_CXX14_CONSTEXPR void rangecheck(size_type i) const {
return i >= size() ? throw std::out_of_range("uuid: index out of range")
: (void)0
;
}
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION

View file

@ -386,9 +386,9 @@ namespace sprout {
fill(value);
}
SPROUT_CXX14_CONSTEXPR void rangecheck(size_type i) const {
if (i >= size()) {
throw std::out_of_range("sub_array<>: index out of range");
}
return i >= size() ? throw std::out_of_range("uuid: index out of range")
: (void)0
;
}
SPROUT_CXX14_CONSTEXPR internal_type& get_internal() {

View file

@ -423,11 +423,10 @@ namespace sprout {
return data();
}
// others:
SPROUT_CXX14_CONSTEXPR void
rangecheck(size_type i) const {
if (i >= size()) {
throw std::out_of_range("basic_string_ref<>: index out of range");
}
SPROUT_CXX14_CONSTEXPR void rangecheck(size_type i) const {
return i >= size() ? throw std::out_of_range("uuid: index out of range")
: (void)0
;
}
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION

View file

@ -104,16 +104,16 @@ namespace sprout {
}
#else
SPROUT_CXX14_CONSTEXPR iterator begin() SPROUT_NOEXCEPT {
return &elems[0];
return elems;
}
SPROUT_CONSTEXPR const_iterator begin() const SPROUT_NOEXCEPT {
return &elems[0];
return elems;
}
SPROUT_CXX14_CONSTEXPR iterator end() SPROUT_NOEXCEPT {
return &elems[0] + size();
return begin() + size();
}
SPROUT_CONSTEXPR const_iterator end() const SPROUT_NOEXCEPT {
return &elems[0] + size();
return begin() + size();
}
#endif
SPROUT_CXX14_CONSTEXPR reverse_iterator rbegin() SPROUT_NOEXCEPT {
@ -137,10 +137,10 @@ namespace sprout {
}
#else
SPROUT_CONSTEXPR const_iterator cbegin() const SPROUT_NOEXCEPT {
return &elems[0];
return elems;
}
SPROUT_CONSTEXPR const_iterator cend() const SPROUT_NOEXCEPT {
return &elems[0] + size();
return cbegin() + size();
}
#endif
SPROUT_CONSTEXPR const_reverse_iterator crbegin() const SPROUT_NOEXCEPT {
@ -192,26 +192,26 @@ namespace sprout {
}
SPROUT_CXX14_CONSTEXPR pointer data() SPROUT_NOEXCEPT {
return &elems[0];
return elems;
}
SPROUT_CONSTEXPR const_pointer data() const SPROUT_NOEXCEPT {
return &elems[0];
return elems;
}
// others:
SPROUT_CXX14_CONSTEXPR pointer c_array() SPROUT_NOEXCEPT {
return &elems[0];
return elems;
}
SPROUT_CONSTEXPR const_pointer c_array() const SPROUT_NOEXCEPT {
return &elems[0];
return elems;
}
SPROUT_CXX14_CONSTEXPR void assign(const_reference value) {
fill(value);
}
SPROUT_CXX14_CONSTEXPR void rangecheck(size_type i) const {
if (i >= size()) {
throw std::out_of_range("uuid: index out of range");
}
return i >= size() ? throw std::out_of_range("uuid: index out of range")
: (void)0
;
}
SPROUT_CONSTEXPR bool is_nil() const {