mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
fix bugs
This commit is contained in:
parent
7233a268fd
commit
6e8b5ea395
5 changed files with 41 additions and 19 deletions
14
sprout/algorithm/for_each.hpp
Normal file
14
sprout/algorithm/for_each.hpp
Normal 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
|
14
sprout/algorithm/gather.hpp
Normal file
14
sprout/algorithm/gather.hpp
Normal 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
|
|
@ -184,14 +184,12 @@ namespace sprout {
|
|||
return elems[i];
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR reference at(size_type i) {
|
||||
return i < size()
|
||||
? elems[i]
|
||||
return i < size() ? elems[i]
|
||||
: (throw std::out_of_range("array<>: index out of range"), elems[i])
|
||||
;
|
||||
}
|
||||
SPROUT_CONSTEXPR const_reference at(size_type i) const {
|
||||
return i < size()
|
||||
? elems[i]
|
||||
return i < size() ? elems[i]
|
||||
: (throw std::out_of_range("array<>: index out of range"), elems[i])
|
||||
;
|
||||
}
|
||||
|
@ -222,21 +220,19 @@ namespace sprout {
|
|||
}
|
||||
// others:
|
||||
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
|
||||
;
|
||||
}
|
||||
|
||||
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
|
||||
SPROUT_CXX14_CONSTEXPR iterator nth(size_type i) {
|
||||
return i < size()
|
||||
? iterator(*this, i)
|
||||
return i < size() ? iterator(*this, i)
|
||||
: (throw std::out_of_range("array<>: index out of range"), iterator())
|
||||
;
|
||||
}
|
||||
SPROUT_CONSTEXPR const_iterator nth(size_type i) const {
|
||||
return i < size()
|
||||
? const_iterator(*this, i)
|
||||
return i < size() ? const_iterator(*this, i)
|
||||
: (throw std::out_of_range("array<>: index out of range"), const_iterator())
|
||||
;
|
||||
}
|
||||
|
@ -248,14 +244,12 @@ namespace sprout {
|
|||
}
|
||||
#else
|
||||
SPROUT_CXX14_CONSTEXPR iterator nth(size_type i) {
|
||||
return i < size()
|
||||
? iterator(elems) + i
|
||||
return i < size() ? iterator(elems) + i
|
||||
: (throw std::out_of_range("array<>: index out of range"), iterator())
|
||||
;
|
||||
}
|
||||
SPROUT_CONSTEXPR const_iterator nth(size_type i) const {
|
||||
return i < size()
|
||||
? const_iterator(elems) + i
|
||||
return i < size() ? const_iterator(elems) + i
|
||||
: (throw std::out_of_range("array<>: index out of range"), const_iterator())
|
||||
;
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
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_FUNCTIONAL_SHIFT_LEFT_ASSIGN_HPP
|
||||
#define SPROUT_FUNCTIONAL_SHIFT_LEFT_ASSIGN_HPP
|
||||
#ifndef SPROUT_FUNCTIONAL_SHIFT_RIGHT_ASSIGN_HPP
|
||||
#define SPROUT_FUNCTIONAL_SHIFT_RIGHT_ASSIGN_HPP
|
||||
|
||||
#include <utility>
|
||||
#include <sprout/config.hpp>
|
||||
|
@ -33,4 +33,4 @@ namespace sprout {
|
|||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FUNCTIONAL_SHIFT_LEFT_ASSIGN_HPP
|
||||
#endif // #ifndef SPROUT_FUNCTIONAL_SHIFT_RIGHT_ASSIGN_HPP
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace sprout {
|
|||
)...
|
||||
}
|
||||
, 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>
|
||||
|
@ -172,7 +172,7 @@ namespace sprout {
|
|||
)...
|
||||
}
|
||||
, 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>
|
||||
|
@ -187,7 +187,7 @@ namespace sprout {
|
|||
)...
|
||||
}
|
||||
, 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>
|
||||
|
|
Loading…
Reference in a new issue