This commit is contained in:
bolero-MURAKAMI 2016-03-31 00:39:48 +09:00
parent 7233a268fd
commit 6e8b5ea395
5 changed files with 41 additions and 19 deletions

View file

@ -0,0 +1,14 @@
/*=============================================================================
Copyright (c) 2011-2016 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_ALGORITHM_FOR_EACH_HPP
#define SPROUT_ALGORITHM_FOR_EACH_HPP
#include <sprout/config.hpp>
#include <sprout/algorithm/cxx14/for_each.hpp>
#endif // #ifndef SPROUT_ALGORITHM_FOR_EACH_HPP

View file

@ -0,0 +1,14 @@
/*=============================================================================
Copyright (c) 2011-2016 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_ALGORITHM_GATHER_HPP
#define SPROUT_ALGORITHM_GATHER_HPP
#include <sprout/config.hpp>
#include <sprout/algorithm/cxx14/gather.hpp>
#endif // #ifndef SPROUT_ALGORITHM_GATHER_HPP

View file

@ -184,14 +184,12 @@ namespace sprout {
return elems[i]; return elems[i];
} }
SPROUT_CXX14_CONSTEXPR reference at(size_type i) { SPROUT_CXX14_CONSTEXPR reference at(size_type i) {
return i < size() return i < size() ? elems[i]
? elems[i]
: (throw std::out_of_range("array<>: index out of range"), elems[i]) : (throw std::out_of_range("array<>: index out of range"), elems[i])
; ;
} }
SPROUT_CONSTEXPR const_reference at(size_type i) const { SPROUT_CONSTEXPR const_reference at(size_type i) const {
return i < size() return i < size() ? elems[i]
? elems[i]
: (throw std::out_of_range("array<>: index out of range"), elems[i]) : (throw std::out_of_range("array<>: index out of range"), elems[i])
; ;
} }
@ -222,21 +220,19 @@ namespace sprout {
} }
// others: // others:
SPROUT_CXX14_CONSTEXPR void rangecheck(size_type i) const { SPROUT_CXX14_CONSTEXPR void rangecheck(size_type i) const {
return i >= size() ? throw std::out_of_range("uuid: index out of range") return i >= size() ? throw std::out_of_range("array<>: index out of range")
: (void)0 : (void)0
; ;
} }
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
SPROUT_CXX14_CONSTEXPR iterator nth(size_type i) { SPROUT_CXX14_CONSTEXPR iterator nth(size_type i) {
return i < size() return i < size() ? iterator(*this, i)
? iterator(*this, i)
: (throw std::out_of_range("array<>: index out of range"), iterator()) : (throw std::out_of_range("array<>: index out of range"), iterator())
; ;
} }
SPROUT_CONSTEXPR const_iterator nth(size_type i) const { SPROUT_CONSTEXPR const_iterator nth(size_type i) const {
return i < size() return i < size() ? const_iterator(*this, i)
? const_iterator(*this, i)
: (throw std::out_of_range("array<>: index out of range"), const_iterator()) : (throw std::out_of_range("array<>: index out of range"), const_iterator())
; ;
} }
@ -248,14 +244,12 @@ namespace sprout {
} }
#else #else
SPROUT_CXX14_CONSTEXPR iterator nth(size_type i) { SPROUT_CXX14_CONSTEXPR iterator nth(size_type i) {
return i < size() return i < size() ? iterator(elems) + i
? iterator(elems) + i
: (throw std::out_of_range("array<>: index out of range"), iterator()) : (throw std::out_of_range("array<>: index out of range"), iterator())
; ;
} }
SPROUT_CONSTEXPR const_iterator nth(size_type i) const { SPROUT_CONSTEXPR const_iterator nth(size_type i) const {
return i < size() return i < size() ? const_iterator(elems) + i
? const_iterator(elems) + i
: (throw std::out_of_range("array<>: index out of range"), const_iterator()) : (throw std::out_of_range("array<>: index out of range"), const_iterator())
; ;
} }

View file

@ -5,8 +5,8 @@
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/ =============================================================================*/
#ifndef SPROUT_FUNCTIONAL_SHIFT_LEFT_ASSIGN_HPP #ifndef SPROUT_FUNCTIONAL_SHIFT_RIGHT_ASSIGN_HPP
#define SPROUT_FUNCTIONAL_SHIFT_LEFT_ASSIGN_HPP #define SPROUT_FUNCTIONAL_SHIFT_RIGHT_ASSIGN_HPP
#include <utility> #include <utility>
#include <sprout/config.hpp> #include <sprout/config.hpp>
@ -33,4 +33,4 @@ namespace sprout {
}; };
} // namespace sprout } // namespace sprout
#endif // #ifndef SPROUT_FUNCTIONAL_SHIFT_LEFT_ASSIGN_HPP #endif // #ifndef SPROUT_FUNCTIONAL_SHIFT_RIGHT_ASSIGN_HPP

View file

@ -157,7 +157,7 @@ namespace sprout {
)... )...
} }
, len(!sprout::math::less(N, n) ? n , len(!sprout::math::less(N, n) ? n
: throw std::out_of_range("basic_string<>: index out of range") : throw std::length_error("basic_string<>: length exceeded")
) )
{} {}
template<typename RandomAccessIterator, typename Size, sprout::index_t... Indexes> template<typename RandomAccessIterator, typename Size, sprout::index_t... Indexes>
@ -172,7 +172,7 @@ namespace sprout {
)... )...
} }
, len(!sprout::math::less(N, n) ? n , len(!sprout::math::less(N, n) ? n
: throw std::out_of_range("basic_string<>: index out of range") : throw std::length_error("basic_string<>: length exceeded")
) )
{} {}
template<typename InputIterator, typename Source, sprout::index_t... Indexes> template<typename InputIterator, typename Source, sprout::index_t... Indexes>
@ -187,7 +187,7 @@ namespace sprout {
)... )...
} }
, len(!(N < str.size()) ? str.size() , len(!(N < str.size()) ? str.size()
: throw std::out_of_range("basic_string<>: index out of range") : throw std::length_error("basic_string<>: length exceeded")
) )
{} {}
template<typename... Args, sprout::index_t... Indexes> template<typename... Args, sprout::index_t... Indexes>