mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
fix.
This commit is contained in:
parent
93e22a984d
commit
15c3f55ebb
69 changed files with 406 additions and 367 deletions
|
@ -26,10 +26,10 @@ namespace sprout {
|
|||
merge(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp) {
|
||||
while (true) {
|
||||
if (first1 == last1) {
|
||||
return std::copy(first2, last2, result);
|
||||
return sprout::copy(first2, last2, result);
|
||||
}
|
||||
if (first2 == last2) {
|
||||
return std::copy(first1, last1, result);
|
||||
return sprout::copy(first1, last1, result);
|
||||
}
|
||||
*result++ = comp(*first2, *first1)
|
||||
? *first2++
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace sprout {
|
|||
typename sprout::container_traits<Container>::difference_type start,
|
||||
typename sprout::container_traits<Container>::difference_type end
|
||||
)
|
||||
{ // pivot を選ぶ(中央の要素)
|
||||
{ // select pivot (center)
|
||||
return *sprout::next(origin, (end + start) / 2);
|
||||
}
|
||||
template<typename Container, typename RandomAccessIterator, typename Compare>
|
||||
|
@ -58,7 +58,7 @@ namespace sprout {
|
|||
typename sprout::container_traits<Container>::difference_type l,
|
||||
typename sprout::container_traits<Container>::value_type const& p
|
||||
)
|
||||
{ // left を見つける
|
||||
{ // find left
|
||||
return comp(*sprout::next(origin, l), p)
|
||||
? sprout::fixed::detail::sort_find_l<Container>(origin, comp, l + 1, p)
|
||||
: l
|
||||
|
@ -72,7 +72,7 @@ namespace sprout {
|
|||
typename sprout::container_traits<Container>::difference_type r,
|
||||
typename sprout::container_traits<Container>::value_type const& p
|
||||
)
|
||||
{ // right を見つける
|
||||
{ // find right
|
||||
return comp(p, *sprout::next(origin, r))
|
||||
? sprout::fixed::detail::sort_find_r<Container>(origin, comp, r - 1, p)
|
||||
: r
|
||||
|
@ -86,7 +86,7 @@ namespace sprout {
|
|||
Compare comp,
|
||||
typename sprout::container_traits<Container>::difference_type l
|
||||
)
|
||||
{ // 左側をソート
|
||||
{ // sort left side
|
||||
return start < l - 1
|
||||
? sprout::fixed::detail::sort_start(cont, start, l - 1, comp)
|
||||
: sprout::deep_copy(cont)
|
||||
|
@ -100,7 +100,7 @@ namespace sprout {
|
|||
Compare comp,
|
||||
typename sprout::container_traits<Container>::difference_type r
|
||||
)
|
||||
{ // 右側をソート
|
||||
{ // sort right side
|
||||
return r + 1 < end
|
||||
? sprout::fixed::detail::sort_start(cont, r + 1, end, comp)
|
||||
: sprout::deep_copy(cont)
|
||||
|
@ -116,7 +116,7 @@ namespace sprout {
|
|||
typename sprout::container_traits<Container>::difference_type l,
|
||||
typename sprout::container_traits<Container>::difference_type r
|
||||
)
|
||||
{ // 左右に分けてソート
|
||||
{ // sort both side
|
||||
return sprout::fixed::detail::sort_part_r(
|
||||
sprout::fixed::detail::sort_part_l(cont, start, comp, l),
|
||||
end,
|
||||
|
@ -135,7 +135,7 @@ namespace sprout {
|
|||
typename sprout::container_traits<Container>::difference_type r,
|
||||
typename sprout::container_traits<Container>::value_type const& p
|
||||
)
|
||||
{ // left と right 比較して、左右に分けてソートするか、またはスワップしてこの範囲のソートを続ける
|
||||
{ // comparing right and left, sort both side, or swap and continue
|
||||
return l >= r
|
||||
? sprout::fixed::detail::sort_part_lr(cont, start, end, comp, l, r)
|
||||
: sprout::fixed::detail::sort_lr(
|
||||
|
@ -164,7 +164,7 @@ namespace sprout {
|
|||
typename sprout::container_traits<Container>::difference_type r,
|
||||
typename sprout::container_traits<Container>::value_type const& p
|
||||
)
|
||||
{ // left と right を検索
|
||||
{ // find left and right
|
||||
return sprout::fixed::detail::sort_next(
|
||||
cont,
|
||||
start,
|
||||
|
@ -183,7 +183,7 @@ namespace sprout {
|
|||
typename sprout::container_traits<Container>::difference_type end,
|
||||
Compare comp
|
||||
)
|
||||
{ // pivot を選択してソートを開始
|
||||
{ // start sort
|
||||
return sprout::fixed::detail::sort_lr(
|
||||
cont,
|
||||
start,
|
||||
|
|
|
@ -21,11 +21,11 @@ namespace sprout {
|
|||
template<typename T>
|
||||
struct memchr_result {
|
||||
private:
|
||||
static void const* check(void const*);
|
||||
static void* check(void*);
|
||||
static void check(...);
|
||||
static void const* test(void const*);
|
||||
static void* test(void*);
|
||||
static void test(...);
|
||||
public:
|
||||
typedef decltype(check(std::declval<T>())) type;
|
||||
typedef decltype(test(std::declval<T>())) type;
|
||||
};
|
||||
|
||||
template<typename PtrIterator>
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <sprout/type_traits/arithmetic_promote.hpp>
|
||||
#include <sprout/type_traits/float_promote.hpp>
|
||||
#include <sprout/type_traits/inherit_if_type.hpp>
|
||||
#include <sprout/type_traits/enable_if.hpp>
|
||||
#include <sprout/type_traits/enabler_if.hpp>
|
||||
#include <sprout/type_traits/has_xxx.hpp>
|
||||
#include <sprout/type_traits/inherit_if_xxx.hpp>
|
||||
|
|
30
sprout/type_traits/enable_if.hpp
Normal file
30
sprout/type_traits/enable_if.hpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2014 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_TYPE_TRAITS_ENABLE_IF_HPP
|
||||
#define SPROUT_TYPE_TRAITS_ENABLE_IF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/type_traits/std_type_traits.hpp>
|
||||
#include <sprout/type_traits/std_type_aliases.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// disable_if
|
||||
//
|
||||
template<bool B, typename T = void>
|
||||
struct disable_if
|
||||
: public sprout::enable_if<!B, T>
|
||||
{};
|
||||
|
||||
#if SPROUT_USE_TEMPLATE_ALIASES
|
||||
template<bool B, typename T = void>
|
||||
using disable_if_t = typename sprout::disable_if<B, T>::type;
|
||||
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_TYPE_TRAITS_ENABLE_IF_HPP
|
|
@ -35,10 +35,19 @@ namespace sprout {
|
|||
: public std::enable_if<C, sprout::enabler_t&>
|
||||
#endif
|
||||
{};
|
||||
//
|
||||
// disabler_if
|
||||
//
|
||||
template<bool C>
|
||||
struct disabler_if
|
||||
: public sprout::enabler_if<!C>
|
||||
{};
|
||||
|
||||
#if SPROUT_USE_TEMPLATE_ALIASES
|
||||
template<bool C>
|
||||
using enabler_if_t = typename sprout::enabler_if<C>::type;
|
||||
template<bool C>
|
||||
using disabler_if_t = typename sprout::disabler_if<C>::type;
|
||||
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||
} // namespace sprout
|
||||
|
||||
|
|
|
@ -58,8 +58,7 @@ namespace sprout {
|
|||
&&sprout::equal(sprout::begin(arg), sprout::end(arg), ctx.begin())
|
||||
? result_type(
|
||||
true,
|
||||
sprout::next(ctx.begin(),
|
||||
sprout::size(arg)),
|
||||
sprout::next(ctx.begin(), sprout::size(arg)),
|
||||
attribute_type(),
|
||||
context_type(ctx, sprout::next(ctx.begin(), sprout::size(arg)))
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue