mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-02-11 10:03:59 +00:00
rewrite sprout::algorithm::join performance
This commit is contained in:
parent
0ceabb5b9b
commit
1ea9d30e2a
145 changed files with 1359 additions and 364 deletions
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012
|
||||
// bolero-MURAKAMI : http://d.hatena.ne.jp/boleros/
|
||||
// osyo-manga : http://d.hatena.ne.jp/osyo-manga/
|
||||
//
|
||||
//
|
||||
// Readme:
|
||||
// https://github.com/osyo-manga/cpp-half/blob/master/README
|
||||
//
|
||||
|
@ -26,9 +26,9 @@ struct fizzbuzz{
|
|||
constexpr result_type
|
||||
operator ()(int n) const{
|
||||
return n % 15 == 0 ? sprout::to_string("FizzBuzz")
|
||||
: n % 3 == 0 ? sprout::to_string("Fizz")
|
||||
: n % 5 == 0 ? sprout::to_string("Buzz")
|
||||
: sprout::to_string(n);
|
||||
: n % 3 == 0 ? sprout::to_string("Fizz")
|
||||
: n % 5 == 0 ? sprout::to_string("Buzz")
|
||||
: sprout::to_string(n);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -45,7 +45,7 @@ main(){
|
|||
static_assert(fizzbuzz()( 3) == "Fizz", "");
|
||||
static_assert(fizzbuzz()( 5) == "Buzz", "");
|
||||
static_assert(fizzbuzz()(15) == "FizzBuzz", "");
|
||||
|
||||
|
||||
//
|
||||
// Sequence [1..15]
|
||||
//
|
||||
|
@ -63,7 +63,7 @@ main(){
|
|||
sprout::pit<sprout::array<string, 15> >(),
|
||||
fizzbuzz()
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Check result
|
||||
//
|
||||
|
|
|
@ -135,4 +135,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_BOGO_SORT_CPP
|
||||
|
||||
|
|
|
@ -177,4 +177,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_BOGO_SORT_RESULT_CPP
|
||||
|
||||
|
|
|
@ -104,4 +104,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_COPY_CPP
|
||||
|
||||
|
|
|
@ -104,4 +104,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_COPY_BACKWARD_CPP
|
||||
|
||||
|
|
|
@ -110,4 +110,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_COPY_IF_CPP
|
||||
|
||||
|
|
|
@ -104,4 +104,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_COPY_N_CPP
|
||||
|
||||
|
|
|
@ -74,4 +74,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_FILL_CPP
|
||||
|
||||
|
|
|
@ -78,4 +78,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_FILL_N_CPP
|
||||
|
||||
|
|
|
@ -78,4 +78,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_GENERATE_CPP
|
||||
|
||||
|
|
|
@ -82,4 +82,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_GENERATE_N_CPP
|
||||
|
||||
|
|
|
@ -133,4 +133,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_INPLACE_MERGE_CPP
|
||||
|
||||
|
|
|
@ -125,4 +125,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_MAKE_HEAP_CPP
|
||||
|
||||
|
|
|
@ -133,4 +133,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_MAKE_PARTIAL_HEAP_CPP
|
||||
|
||||
|
|
|
@ -221,4 +221,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_MERGE_CPP
|
||||
|
||||
|
|
|
@ -133,4 +133,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_NTH_ELEMENT_CPP
|
||||
|
||||
|
|
|
@ -133,4 +133,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_PARTIAL_SORT_CPP
|
||||
|
||||
|
|
|
@ -74,4 +74,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_PARTITION_CPP
|
||||
|
||||
|
|
|
@ -110,4 +110,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_PARTITION_COPY_CPP
|
||||
|
||||
|
|
|
@ -70,4 +70,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_POP_HEAP_CPP
|
||||
|
||||
|
|
|
@ -125,4 +125,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_PUSH_HEAP_CPP
|
||||
|
||||
|
|
|
@ -74,4 +74,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REMOVE_CPP
|
||||
|
||||
|
|
|
@ -110,4 +110,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REMOVE_COPY_CPP
|
||||
|
||||
|
|
|
@ -110,4 +110,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REMOVE_COPY_IF_CPP
|
||||
|
||||
|
|
|
@ -74,4 +74,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REMOVE_IF_CPP
|
||||
|
||||
|
|
|
@ -78,4 +78,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REPLACE_CPP
|
||||
|
||||
|
|
|
@ -116,4 +116,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REPLACE_COPY_CPP
|
||||
|
||||
|
|
|
@ -116,4 +116,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REPLACE_COPY_IF_CPP
|
||||
|
||||
|
|
|
@ -78,4 +78,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REPLACE_IF_CPP
|
||||
|
||||
|
|
|
@ -70,4 +70,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REBERSE_CPP
|
||||
|
||||
|
|
|
@ -104,4 +104,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REBERSE_COPY_CPP
|
||||
|
||||
|
|
|
@ -74,4 +74,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_ROTATE_CPP
|
||||
|
||||
|
|
|
@ -110,4 +110,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_ROTATE_COPY_CPP
|
||||
|
||||
|
|
|
@ -221,4 +221,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SET_DIFFERENCE_CPP
|
||||
|
||||
|
|
|
@ -221,4 +221,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SET_INTERSECTION_CPP
|
||||
|
||||
|
|
|
@ -221,4 +221,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SET_SYMMETRIC_DIFFERENCE_CPP
|
||||
|
||||
|
|
|
@ -221,4 +221,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SET_UNION_CPP
|
||||
|
||||
|
|
|
@ -76,4 +76,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SHUFFLE_CPP
|
||||
|
||||
|
|
|
@ -97,4 +97,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SHUFFLE_RESULT_CPP
|
||||
|
||||
|
|
|
@ -125,4 +125,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SORT_CPP
|
||||
|
||||
|
|
|
@ -125,4 +125,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SORT_HEAP_CPP
|
||||
|
||||
|
|
|
@ -74,4 +74,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_STABLE_PARTITION_CPP
|
||||
|
||||
|
|
|
@ -110,4 +110,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_STABLE_PARTITION_COPY_CPP
|
||||
|
||||
|
|
|
@ -125,4 +125,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_STABLE_SORT_CPP
|
||||
|
||||
|
|
|
@ -78,4 +78,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SWAP_ELEMENT_CPP
|
||||
|
||||
|
|
|
@ -116,4 +116,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SWAP_ELEMENT_COPY_CPP
|
||||
|
||||
|
|
|
@ -208,4 +208,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_TRANSFORM_CPP
|
||||
|
||||
|
|
|
@ -125,4 +125,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_UNIQUE_CPP
|
||||
|
||||
|
|
|
@ -195,4 +195,3 @@ namespace testspr {
|
|||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_UNIQUE_COPY_CPP
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012
|
||||
// bolero-MURAKAMI : http://d.hatena.ne.jp/boleros/
|
||||
// osyo-manga : http://d.hatena.ne.jp/osyo-manga/
|
||||
//
|
||||
//
|
||||
// Readme:
|
||||
// https://github.com/osyo-manga/cpp-half/blob/master/README
|
||||
//
|
||||
|
@ -17,7 +17,7 @@
|
|||
|
||||
int
|
||||
main(){
|
||||
|
||||
|
||||
//
|
||||
// String literal to Sprout.String
|
||||
//
|
||||
|
@ -30,7 +30,7 @@ main(){
|
|||
static_assert(str2 == L"ほむほむ", "");
|
||||
static_assert(std::is_same<decltype(str2), sprout::wstring<4> const>{}, "");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Integer literal to Sprout.String
|
||||
//
|
||||
|
@ -38,7 +38,7 @@ main(){
|
|||
static constexpr auto str = sprout::to_string(42);
|
||||
static_assert(str == "42", "");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Float literal to Sprout.String
|
||||
//
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012
|
||||
// bolero-MURAKAMI : http://d.hatena.ne.jp/boleros/
|
||||
// osyo-manga : http://d.hatena.ne.jp/osyo-manga/
|
||||
//
|
||||
//
|
||||
// Readme:
|
||||
// https://github.com/osyo-manga/cpp-half/blob/master/README
|
||||
//
|
||||
|
@ -22,7 +22,7 @@
|
|||
//
|
||||
int
|
||||
main(){
|
||||
|
||||
|
||||
//
|
||||
// String literal to Sprout.String
|
||||
//
|
||||
|
@ -66,7 +66,7 @@ main(){
|
|||
static_assert(*(str1.end() - 1) == 'u', "");
|
||||
static_assert(*(str1.rbegin() + 1) == 'm', "");
|
||||
static_assert(*(str1.rend() - 2) == 'o', "");
|
||||
|
||||
|
||||
//
|
||||
// IOStream
|
||||
//
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012
|
||||
// bolero-MURAKAMI : http://d.hatena.ne.jp/boleros/
|
||||
// osyo-manga : http://d.hatena.ne.jp/osyo-manga/
|
||||
//
|
||||
//
|
||||
// Readme:
|
||||
// https://github.com/osyo-manga/cpp-half/blob/master/README
|
||||
//
|
||||
|
@ -23,13 +23,13 @@
|
|||
int
|
||||
main(){
|
||||
namespace w = sprout::weed;
|
||||
|
||||
|
||||
//
|
||||
// __TIME__ to Sprout.String
|
||||
//
|
||||
static constexpr auto time = sprout::to_string(__TIME__);
|
||||
// static constexpr auto time = sprout::to_string("23:22:45");
|
||||
|
||||
|
||||
|
||||
//
|
||||
// parse __TIME__
|
||||
|
@ -37,8 +37,8 @@ main(){
|
|||
constexpr auto expr = w::int_ >> ':' >> w::int_ >> ':' >> w::int_;
|
||||
static constexpr auto result = w::parse(time.begin(), time.end(), parser);
|
||||
static_assert(result.success(), "failed parse");
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// get result
|
||||
//
|
||||
|
@ -54,8 +54,8 @@ main(){
|
|||
std::cout << hour << std::endl;
|
||||
std::cout << minute << std::endl;
|
||||
std::cout << second << std::endl;
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// compile time output
|
||||
//
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012
|
||||
// bolero-MURAKAMI : http://d.hatena.ne.jp/boleros/
|
||||
// osyo-manga : http://d.hatena.ne.jp/osyo-manga/
|
||||
//
|
||||
//
|
||||
// Readme:
|
||||
// https://github.com/osyo-manga/cpp-half/blob/master/README
|
||||
//
|
||||
|
@ -18,11 +18,11 @@
|
|||
int
|
||||
main(){
|
||||
namespace w = sprout::weed;
|
||||
|
||||
|
||||
static constexpr auto max_string_size = 32;
|
||||
static constexpr auto space = *w::omit[ w::space ];
|
||||
static constexpr auto remove_space = *w::lim<max_string_size>(space >> w::char_);
|
||||
|
||||
|
||||
static constexpr auto source = sprout::to_string(" homu : mami= 10 ");
|
||||
static constexpr auto result = w::parse(
|
||||
sprout::begin(source), sprout::end(source),
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <sprout/tuple/tuple.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/shuffle.hpp>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <sprout/tuple/tuple.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/shuffle.hpp>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/copy.hpp>
|
||||
#include <sprout/detail/container_complate.hpp>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include <sprout/algorithm/fixed/pop_heap.hpp>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include <sprout/algorithm/fixed/make_partial_heap.hpp>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include <sprout/algorithm/fixed/pop_heap.hpp>
|
||||
|
|
|
@ -3,6 +3,5 @@
|
|||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/string/join.hpp>
|
||||
#include <sprout/algorithm/string/join2.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_STRING_HPP
|
||||
|
|
|
@ -1,22 +1,88 @@
|
|||
#ifndef SPROUT_ALGORITHM_STRING_JOIN_HPP
|
||||
#define SPROUT_ALGORITHM_STRING_JOIN_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include <sprout/iterator/traits.hpp>
|
||||
#include <sprout/utility/enabler_if.hpp>
|
||||
#include <sprout/range/adaptor/size_enumed.hpp>
|
||||
#include <sprout/range/algorithm/lower_bound.hpp>
|
||||
#include <sprout/range/numeric/partial_sum.hpp>
|
||||
#include <sprout/weed/traits/type/is_c_str.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
template<typename String, typename = void>
|
||||
struct string_size;
|
||||
template<typename String>
|
||||
struct string_size<
|
||||
String,
|
||||
typename std::enable_if<sprout::weed::traits::is_c_str<String>::value>::type
|
||||
>
|
||||
: public std::integral_constant<
|
||||
typename sprout::container_traits<String>::size_type,
|
||||
sprout::container_traits<String>::static_size - 1
|
||||
>
|
||||
{};
|
||||
template<typename String>
|
||||
struct string_size<
|
||||
String,
|
||||
typename std::enable_if<!sprout::weed::traits::is_c_str<String>::value>::type
|
||||
>
|
||||
: public std::integral_constant<
|
||||
typename sprout::container_traits<String>::size_type,
|
||||
sprout::container_traits<String>::static_size
|
||||
>
|
||||
{};
|
||||
|
||||
template<
|
||||
typename String,
|
||||
typename sprout::enabler_if<sprout::weed::traits::is_c_str<String>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<String>::difference_type
|
||||
str_size(String const& str) {
|
||||
return sprout::size(str) - 1;
|
||||
}
|
||||
template<
|
||||
typename String,
|
||||
typename sprout::enabler_if<!sprout::weed::traits::is_c_str<String>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<String>::difference_type
|
||||
str_size(String const& str) {
|
||||
return sprout::size(str);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
namespace result_of {
|
||||
//
|
||||
// join
|
||||
//
|
||||
template<typename ContainerContainer>
|
||||
template<typename ContainerContainer, typename Separator = void>
|
||||
struct join {
|
||||
public:
|
||||
typedef typename sprout::container_transform_traits<
|
||||
typename sprout::container_traits<ContainerContainer>::value_type
|
||||
>::template rebind_size<
|
||||
sprout::container_traits<
|
||||
typename sprout::container_traits<ContainerContainer>::value_type
|
||||
>::static_size
|
||||
? (sprout::container_traits<
|
||||
typename sprout::container_traits<ContainerContainer>::value_type
|
||||
>::static_size
|
||||
+ sprout::algorithm::detail::string_size<Separator>::value
|
||||
)
|
||||
* sprout::container_traits<ContainerContainer>::static_size
|
||||
- sprout::algorithm::detail::string_size<Separator>::value
|
||||
: 0
|
||||
>::type type;
|
||||
};
|
||||
template<typename ContainerContainer>
|
||||
struct join<ContainerContainer, void> {
|
||||
public:
|
||||
typedef typename sprout::container_transform_traits<
|
||||
typename sprout::container_traits<ContainerContainer>::value_type
|
||||
|
@ -30,31 +96,80 @@ namespace sprout {
|
|||
} // namespace result_of
|
||||
|
||||
namespace detail {
|
||||
template<typename Result, typename ContainerInputIterator, typename... Args>
|
||||
template<typename Result, typename ContIterator, typename SizeIterator, typename Sizes>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<Result>::value_type
|
||||
join_impl_ra_2(
|
||||
ContIterator first_cont,
|
||||
SizeIterator found,
|
||||
Sizes const& sizes,
|
||||
sprout::index_t idx
|
||||
)
|
||||
{
|
||||
typedef typename sprout::container_traits<Result>::value_type value_type;
|
||||
return found == sizes.end() ? value_type()
|
||||
: sprout::begin(first_cont[found - sizes.begin()])[idx - (found != sizes.begin() ? found[-1] : 0)]
|
||||
;
|
||||
}
|
||||
template<typename Result, typename ContIterator, sprout::index_t... Indexes, typename Sizes>
|
||||
inline SPROUT_CONSTEXPR Result
|
||||
join_impl_ra_1(
|
||||
ContIterator first_cont,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
Sizes const& sizes
|
||||
)
|
||||
{
|
||||
return sprout::make<Result>(
|
||||
sprout::algorithm::detail::join_impl_ra_2<Result>(
|
||||
first_cont,
|
||||
sprout::range::lower_bound(sizes, Indexes + 1),
|
||||
sizes,
|
||||
Indexes
|
||||
)...
|
||||
);
|
||||
}
|
||||
template<typename Result, typename ContainerContainer>
|
||||
inline SPROUT_CONSTEXPR Result
|
||||
join_impl_ra(ContainerContainer const& cont_cont) {
|
||||
typedef typename sprout::container_traits<Result>::difference_type size_type;
|
||||
typedef sprout::array<
|
||||
size_type,
|
||||
sprout::container_traits<ContainerContainer>::static_size
|
||||
> sizes_type;
|
||||
return sprout::algorithm::detail::join_impl_ra_1<Result>(
|
||||
sprout::begin(cont_cont),
|
||||
sprout::index_range<0, sprout::container_traits<Result>::static_size>::make(),
|
||||
sprout::range::partial_sum(
|
||||
cont_cont | sprout::adaptors::size_enumed,
|
||||
sprout::pit<sizes_type>()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
template<typename Result, typename ContIterator, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
Result
|
||||
>::type join_impl(
|
||||
ContainerInputIterator first_cont,
|
||||
ContainerInputIterator last_cont,
|
||||
ContIterator first_cont,
|
||||
ContIterator last_cont,
|
||||
Args const&... args
|
||||
);
|
||||
template<typename Result, typename ContainerInputIterator, typename... Args>
|
||||
template<typename Result, typename ContIterator, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
Result
|
||||
>::type join_impl(
|
||||
ContainerInputIterator first_cont,
|
||||
ContainerInputIterator last_cont,
|
||||
ContIterator first_cont,
|
||||
ContIterator last_cont,
|
||||
Args const&... args
|
||||
);
|
||||
template<typename Result, typename ContainerInputIterator, typename InputIterator, typename... Args>
|
||||
template<typename Result, typename ContIterator, typename InputIterator, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
Result
|
||||
>::type join_impl_1(
|
||||
ContainerInputIterator first_cont,
|
||||
ContainerInputIterator last_cont,
|
||||
ContIterator first_cont,
|
||||
ContIterator last_cont,
|
||||
InputIterator first,
|
||||
InputIterator last,
|
||||
Args const&... args
|
||||
|
@ -62,63 +177,344 @@ namespace sprout {
|
|||
{
|
||||
return sprout::make<Result>(args...);
|
||||
}
|
||||
template<typename Result, typename ContainerInputIterator, typename InputIterator, typename... Args>
|
||||
template<typename Result, typename ContIterator, typename InputIterator, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
Result
|
||||
>::type join_impl_1(
|
||||
ContainerInputIterator first_cont,
|
||||
ContainerInputIterator last_cont,
|
||||
ContIterator first_cont,
|
||||
ContIterator last_cont,
|
||||
InputIterator first,
|
||||
InputIterator last,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first != last
|
||||
? sprout::algorithm::detail::join_impl_1<Result>(first_cont, last_cont, sprout::next(first), last, args..., *first)
|
||||
? sprout::algorithm::detail::join_impl_1<Result>(
|
||||
first_cont, last_cont,
|
||||
sprout::next(first), last,
|
||||
args..., *first
|
||||
)
|
||||
: sprout::algorithm::detail::join_impl<Result>(sprout::next(first_cont), last_cont, args...)
|
||||
;
|
||||
}
|
||||
template<typename Result, typename ContainerInputIterator, typename... Args>
|
||||
template<typename Result, typename ContIterator, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
Result
|
||||
>::type join_impl(
|
||||
ContainerInputIterator first_cont,
|
||||
ContainerInputIterator last_cont,
|
||||
ContIterator first_cont,
|
||||
ContIterator last_cont,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::make<Result>(args...);
|
||||
}
|
||||
template<typename Result, typename ContainerInputIterator, typename... Args>
|
||||
template<typename Result, typename ContIterator, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
Result
|
||||
>::type join_impl(
|
||||
ContainerInputIterator first_cont,
|
||||
ContainerInputIterator last_cont,
|
||||
ContIterator first_cont,
|
||||
ContIterator last_cont,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first_cont != last_cont
|
||||
? sprout::algorithm::detail::join_impl_1<Result>(first_cont, last_cont, sprout::begin(*first_cont), sprout::end(*first_cont), args...)
|
||||
? sprout::algorithm::detail::join_impl_1<Result>(
|
||||
first_cont, last_cont,
|
||||
sprout::begin(*first_cont), sprout::end(*first_cont),
|
||||
args...
|
||||
)
|
||||
: sprout::make<Result>(args...)
|
||||
;
|
||||
}
|
||||
|
||||
template<
|
||||
typename ContainerContainer,
|
||||
typename sprout::enabler_if<
|
||||
sprout::is_random_access_iterator<
|
||||
typename sprout::container_traits<ContainerContainer const>::iterator
|
||||
>::value
|
||||
&& sprout::is_random_access_iterator<
|
||||
typename sprout::container_traits<
|
||||
typename sprout::container_traits<ContainerContainer const>::value_type
|
||||
>::iterator
|
||||
>::value
|
||||
>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join<ContainerContainer>::type
|
||||
join(ContainerContainer const& cont_cont) {
|
||||
typedef typename sprout::algorithm::result_of::join<ContainerContainer>::type result_type;
|
||||
return sprout::algorithm::detail::join_impl_ra<result_type>(cont_cont);
|
||||
}
|
||||
template<
|
||||
typename ContainerContainer,
|
||||
typename sprout::enabler_if<!(
|
||||
sprout::is_random_access_iterator<
|
||||
typename sprout::container_traits<ContainerContainer const>::iterator
|
||||
>::value
|
||||
&& sprout::is_random_access_iterator<
|
||||
typename sprout::container_traits<
|
||||
typename sprout::container_traits<ContainerContainer const>::value_type
|
||||
>::iterator
|
||||
>::value
|
||||
)>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join<ContainerContainer>::type
|
||||
join(ContainerContainer const& cont_cont) {
|
||||
typedef typename sprout::algorithm::result_of::join<ContainerContainer>::type result_type;
|
||||
return sprout::algorithm::detail::join_impl<result_type>(
|
||||
sprout::begin(cont_cont),
|
||||
sprout::end(cont_cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// join
|
||||
//
|
||||
template<typename ContainerContainer>
|
||||
inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join<ContainerContainer>::type join(
|
||||
ContainerContainer const& cont_cont
|
||||
)
|
||||
{
|
||||
return sprout::algorithm::detail::join_impl<typename sprout::algorithm::result_of::join<ContainerContainer>::type>(
|
||||
sprout::begin(cont_cont),
|
||||
sprout::end(cont_cont)
|
||||
inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join<ContainerContainer>::type
|
||||
join(ContainerContainer const& cont_cont) {
|
||||
return sprout::algorithm::detail::join(cont_cont);
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Result, typename ContIterator, typename SepIterator, typename SizeIterator, typename Sizes>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<Result>::value_type
|
||||
join_impl_ra_2(
|
||||
ContIterator first_cont,
|
||||
SepIterator first,
|
||||
SizeIterator found,
|
||||
Sizes const& sizes,
|
||||
sprout::index_t idx
|
||||
)
|
||||
{
|
||||
typedef typename sprout::container_traits<Result>::value_type value_type;
|
||||
return found == sizes.end() ? value_type()
|
||||
: (found - sizes.begin()) % 2 ? first[idx - found[-1]]
|
||||
: sprout::begin(first_cont[(found - sizes.begin()) / 2])[idx - (found != sizes.begin() ? found[-1] : 0)]
|
||||
;
|
||||
}
|
||||
template<typename Result, typename ContIterator, typename SepIterator, sprout::index_t... Indexes, typename Sizes>
|
||||
inline SPROUT_CONSTEXPR Result
|
||||
join_impl_ra_1(
|
||||
ContIterator first_cont,
|
||||
SepIterator first,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
Sizes const& sizes
|
||||
)
|
||||
{
|
||||
return sprout::make<Result>(
|
||||
sprout::algorithm::detail::join_impl_ra_2<Result>(
|
||||
first_cont,
|
||||
first,
|
||||
sprout::range::lower_bound(sizes, Indexes + 1),
|
||||
sizes,
|
||||
Indexes
|
||||
)...
|
||||
);
|
||||
}
|
||||
template<typename Result, typename ContainerContainer, typename Separator>
|
||||
inline SPROUT_CONSTEXPR Result
|
||||
join_impl_ra(ContainerContainer const& cont_cont, Separator const& separator) {
|
||||
typedef typename sprout::container_traits<Result>::difference_type size_type;
|
||||
typedef sprout::array<
|
||||
size_type,
|
||||
sprout::container_traits<ContainerContainer>::static_size
|
||||
? sprout::container_traits<ContainerContainer>::static_size * 2 - 1
|
||||
: 0
|
||||
> sizes_type;
|
||||
return sprout::algorithm::detail::join_impl_ra_1<Result>(
|
||||
sprout::begin(cont_cont),
|
||||
sprout::begin(separator),
|
||||
sprout::index_range<0, sprout::container_traits<Result>::static_size>::make(),
|
||||
sprout::range::partial_sum(
|
||||
cont_cont | sprout::adaptors::size_enumed(sprout::algorithm::detail::str_size(separator), true),
|
||||
sprout::pit<sizes_type>()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
template<typename Result, typename ContIterator, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
Result
|
||||
>::type join_impl(
|
||||
ContIterator first_cont,
|
||||
ContIterator last_cont,
|
||||
Args const&... args
|
||||
);
|
||||
template<typename Result, typename ContIterator, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
Result
|
||||
>::type join_impl(
|
||||
ContIterator first_cont,
|
||||
ContIterator last_cont,
|
||||
Args const&... args
|
||||
);
|
||||
template<typename Result, typename ContIterator, typename SepIterator, typename InputIterator, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
Result
|
||||
>::type join_impl_1(
|
||||
ContIterator first_cont,
|
||||
ContIterator last_cont,
|
||||
SepIterator sep_first,
|
||||
SepIterator sep_last,
|
||||
bool sep,
|
||||
InputIterator first,
|
||||
InputIterator last,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::make<Result>(args...);
|
||||
}
|
||||
template<typename Result, typename ContIterator, typename SepIterator, typename InputIterator, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
Result
|
||||
>::type join_impl_1(
|
||||
ContIterator first_cont,
|
||||
ContIterator last_cont,
|
||||
SepIterator sep_first,
|
||||
SepIterator sep_last,
|
||||
bool sep,
|
||||
InputIterator first,
|
||||
InputIterator last,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first != last
|
||||
? sprout::algorithm::detail::join_impl_1<Result>(
|
||||
first_cont, last_cont,
|
||||
sep_first, sep_last,
|
||||
sep,
|
||||
sprout::next(first), last,
|
||||
args..., *first
|
||||
)
|
||||
: sep
|
||||
? sprout::algorithm::detail::join_impl<Result>(
|
||||
sprout::next(first_cont), last_cont,
|
||||
sep_first, sep_last,
|
||||
false,
|
||||
args...
|
||||
)
|
||||
: sprout::algorithm::detail::join_impl<Result>(
|
||||
first_cont, last_cont,
|
||||
sep_first, sep_last,
|
||||
true,
|
||||
args...
|
||||
)
|
||||
;
|
||||
}
|
||||
template<typename Result, typename ContIterator, typename SepIterator, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
Result
|
||||
>::type join_impl(
|
||||
ContIterator first_cont,
|
||||
ContIterator last_cont,
|
||||
SepIterator sep_first,
|
||||
SepIterator sep_last,
|
||||
bool sep,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::make<Result>(args...);
|
||||
}
|
||||
template<typename Result, typename ContIterator, typename SepIterator, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
Result
|
||||
>::type join_impl(
|
||||
ContIterator first_cont,
|
||||
ContIterator last_cont,
|
||||
SepIterator sep_first,
|
||||
SepIterator sep_last,
|
||||
bool sep,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first_cont != last_cont
|
||||
? sep
|
||||
? sprout::algorithm::detail::join_impl_1<Result>(
|
||||
first_cont, last_cont,
|
||||
sep_first, sep_last,
|
||||
sep,
|
||||
sep_first, sep_last,
|
||||
args...
|
||||
)
|
||||
: sprout::algorithm::detail::join_impl_1<Result>(
|
||||
first_cont, last_cont,
|
||||
sep_first, sep_last,
|
||||
sep,
|
||||
sprout::begin(*first_cont), sprout::end(*first_cont),
|
||||
args...
|
||||
)
|
||||
: sprout::make<Result>(args...)
|
||||
;
|
||||
}
|
||||
|
||||
template<
|
||||
typename ContainerContainer,
|
||||
typename Separator,
|
||||
typename sprout::enabler_if<
|
||||
sprout::is_random_access_iterator<
|
||||
typename sprout::container_traits<ContainerContainer const>::iterator
|
||||
>::value
|
||||
&& sprout::is_random_access_iterator<
|
||||
typename sprout::container_traits<
|
||||
typename sprout::container_traits<ContainerContainer const>::value_type
|
||||
>::iterator
|
||||
>::value
|
||||
&& sprout::is_random_access_iterator<
|
||||
typename sprout::container_traits<Separator const>::iterator
|
||||
>::value
|
||||
>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join<ContainerContainer>::type
|
||||
join(ContainerContainer const& cont_cont, Separator const& separator) {
|
||||
typedef typename sprout::algorithm::result_of::join<ContainerContainer>::type result_type;
|
||||
return sprout::algorithm::detail::join_impl_ra<result_type>(cont_cont, separator);
|
||||
}
|
||||
template<
|
||||
typename ContainerContainer,
|
||||
typename Separator,
|
||||
typename sprout::enabler_if<!(
|
||||
sprout::is_random_access_iterator<
|
||||
typename sprout::container_traits<ContainerContainer const>::iterator
|
||||
>::value
|
||||
&& sprout::is_random_access_iterator<
|
||||
typename sprout::container_traits<
|
||||
typename sprout::container_traits<ContainerContainer const>::value_type
|
||||
>::iterator
|
||||
>::value
|
||||
&& sprout::is_random_access_iterator<
|
||||
typename sprout::container_traits<Separator const>::iterator
|
||||
>::value
|
||||
)>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join<ContainerContainer>::type
|
||||
join(ContainerContainer const& cont_cont, Separator const& separator) {
|
||||
typedef typename sprout::algorithm::result_of::join<ContainerContainer>::type result_type;
|
||||
return sprout::algorithm::detail::join_impl<result_type>(
|
||||
sprout::begin(cont_cont),
|
||||
sprout::end(cont_cont),
|
||||
sprout::begin(separator),
|
||||
sprout::end(separator),
|
||||
false
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// join
|
||||
//
|
||||
template<typename ContainerContainer, typename Separator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join<ContainerContainer, Separator>::type
|
||||
join(ContainerContainer const& cont_cont, Separator const& separator) {
|
||||
return sprout::algorithm::detail::join(cont_cont, separator);
|
||||
}
|
||||
} // namespace algorithm
|
||||
} // namespace sprout
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_STRING_JOIN2_HPP
|
||||
#define SPROUT_ALGORITHM_STRING_JOIN2_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/operation/fixed/append_back.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace algorithm {
|
||||
namespace result_of {
|
||||
//
|
||||
// join2
|
||||
//
|
||||
template<typename ContainerContainer, typename Separator>
|
||||
struct join2 {
|
||||
public:
|
||||
typedef typename sprout::container_transform_traits<
|
||||
typename sprout::container_traits<ContainerContainer>::value_type
|
||||
>::template rebind_size<
|
||||
sprout::container_traits<ContainerContainer>::static_size != 0
|
||||
? (
|
||||
sprout::container_traits<
|
||||
typename sprout::container_traits<ContainerContainer>::value_type
|
||||
>::static_size
|
||||
+ (sprout::container_traits<ContainerContainer>::static_size - 1) * (
|
||||
sprout::container_traits<Separator>::static_size
|
||||
+ sprout::container_traits<
|
||||
typename sprout::container_traits<ContainerContainer>::value_type
|
||||
>::static_size
|
||||
)
|
||||
)
|
||||
: 0
|
||||
>::type type;
|
||||
};
|
||||
} // namespace result_of
|
||||
|
||||
namespace detail {
|
||||
template<typename Result, typename ContainerIterator, typename Separator, typename Container>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
(sprout::container_traits<Container>::static_size == sprout::container_traits<Result>::static_size),
|
||||
Result
|
||||
>::type join2_impl_1(
|
||||
ContainerIterator first,
|
||||
ContainerIterator last,
|
||||
Separator const& separator,
|
||||
Container const& current
|
||||
)
|
||||
{
|
||||
return current;
|
||||
}
|
||||
template<typename Result, typename ContainerIterator, typename Separator, typename Container>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
(sprout::container_traits<Container>::static_size < sprout::container_traits<Result>::static_size),
|
||||
Result
|
||||
>::type join2_impl_1(
|
||||
ContainerIterator first,
|
||||
ContainerIterator last,
|
||||
Separator const& separator,
|
||||
Container const& current
|
||||
)
|
||||
{
|
||||
return sprout::algorithm::detail::join2_impl_1<Result>(
|
||||
sprout::next(first),
|
||||
last,
|
||||
separator,
|
||||
sprout::fixed::append_back(sprout::fixed::append_back(current, separator), *first)
|
||||
);
|
||||
}
|
||||
template<typename Result, typename ContainerIterator, typename Separator>
|
||||
inline SPROUT_CONSTEXPR Result join2_impl(
|
||||
ContainerIterator first,
|
||||
ContainerIterator last,
|
||||
Separator const& separator
|
||||
)
|
||||
{
|
||||
return first != last
|
||||
? sprout::algorithm::detail::join2_impl_1<Result>(
|
||||
sprout::next(first),
|
||||
last,
|
||||
separator,
|
||||
*first
|
||||
)
|
||||
: sprout::make<Result>()
|
||||
;
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// join2
|
||||
//
|
||||
template<typename ContainerContainer, typename Separator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join2<ContainerContainer, Separator>::type join2(
|
||||
ContainerContainer const& cont_cont,
|
||||
Separator const& separator
|
||||
)
|
||||
{
|
||||
return sprout::algorithm::detail::join2_impl<typename sprout::algorithm::result_of::join2<ContainerContainer, Separator>::type>(
|
||||
sprout::begin(cont_cont),
|
||||
sprout::end(cont_cont),
|
||||
separator
|
||||
);
|
||||
}
|
||||
} // namespace algorithm
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_STRING_JOIN2_HPP
|
|
@ -17,7 +17,7 @@ namespace sprout {
|
|||
private:
|
||||
SPROUT_CONSTEXPR not_a_valid_type() {}
|
||||
};
|
||||
|
||||
|
||||
template<typename Tag, typename Arg>
|
||||
struct address_of_hack {
|
||||
public:
|
||||
|
@ -317,12 +317,12 @@ namespace sprout {
|
|||
template<typename... As>
|
||||
SPROUT_CONSTEXPR typename sprout::breed::result_of::funop<
|
||||
expr(As const&...),
|
||||
expr,
|
||||
expr,
|
||||
sprout::breed::default_domain
|
||||
>::type operator()(As const&... args) const {
|
||||
return sprout::breed::result_of::funop<
|
||||
expr(As const&...),
|
||||
expr,
|
||||
expr,
|
||||
sprout::breed::default_domain
|
||||
>::call(*this, args...);
|
||||
}
|
||||
|
@ -444,12 +444,12 @@ namespace sprout {
|
|||
template<typename... As>
|
||||
SPROUT_CONSTEXPR typename sprout::breed::result_of::funop<
|
||||
expr(As const&...),
|
||||
expr,
|
||||
expr,
|
||||
sprout::breed::default_domain
|
||||
>::type operator()(As const&... args) const {
|
||||
return sprout::breed::result_of::funop<
|
||||
expr(As const&...),
|
||||
expr,
|
||||
expr,
|
||||
sprout::breed::default_domain
|
||||
>::call(*this, args...);
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace sprout {
|
|||
struct basic_default_generator
|
||||
: public sprout::breed::use_basic_expr<sprout::breed::default_generator>
|
||||
{};
|
||||
|
||||
|
||||
//
|
||||
// generator
|
||||
//
|
||||
|
@ -146,7 +146,7 @@ namespace sprout {
|
|||
template<typename This, typename Expr>
|
||||
struct result<This(Expr const&)>
|
||||
{
|
||||
public:
|
||||
public:
|
||||
typedef Extends<Expr> type;
|
||||
};
|
||||
public:
|
||||
|
|
|
@ -8,52 +8,52 @@ namespace sprout {
|
|||
namespace breed {
|
||||
namespace tagns_ {
|
||||
namespace tag {
|
||||
struct terminal {};
|
||||
struct unary_plus {};
|
||||
struct negate {};
|
||||
struct dereference {};
|
||||
struct complement {};
|
||||
struct address_of {};
|
||||
struct logical_not {};
|
||||
struct pre_inc {};
|
||||
struct pre_dec {};
|
||||
struct post_inc {};
|
||||
struct post_dec {};
|
||||
struct shift_left {};
|
||||
struct shift_right {};
|
||||
struct multiplies {};
|
||||
struct divides {};
|
||||
struct modulus {};
|
||||
struct plus {};
|
||||
struct minus {};
|
||||
struct less {};
|
||||
struct greater {};
|
||||
struct less_equal {};
|
||||
struct greater_equal {};
|
||||
struct equal_to {};
|
||||
struct not_equal_to {};
|
||||
struct logical_or {};
|
||||
struct logical_and {};
|
||||
struct bitwise_and {};
|
||||
struct bitwise_or {};
|
||||
struct bitwise_xor {};
|
||||
struct comma {};
|
||||
struct mem_ptr {};
|
||||
struct assign {};
|
||||
struct shift_left_assign {};
|
||||
struct shift_right_assign {};
|
||||
struct multiplies_assign {};
|
||||
struct divides_assign {};
|
||||
struct modulus_assign {};
|
||||
struct plus_assign {};
|
||||
struct minus_assign {};
|
||||
struct bitwise_and_assign {};
|
||||
struct bitwise_or_assign {};
|
||||
struct bitwise_xor_assign {};
|
||||
struct subscript {};
|
||||
struct member {};
|
||||
struct if_else_ {};
|
||||
struct function {};
|
||||
struct terminal {};
|
||||
struct unary_plus {};
|
||||
struct negate {};
|
||||
struct dereference {};
|
||||
struct complement {};
|
||||
struct address_of {};
|
||||
struct logical_not {};
|
||||
struct pre_inc {};
|
||||
struct pre_dec {};
|
||||
struct post_inc {};
|
||||
struct post_dec {};
|
||||
struct shift_left {};
|
||||
struct shift_right {};
|
||||
struct multiplies {};
|
||||
struct divides {};
|
||||
struct modulus {};
|
||||
struct plus {};
|
||||
struct minus {};
|
||||
struct less {};
|
||||
struct greater {};
|
||||
struct less_equal {};
|
||||
struct greater_equal {};
|
||||
struct equal_to {};
|
||||
struct not_equal_to {};
|
||||
struct logical_or {};
|
||||
struct logical_and {};
|
||||
struct bitwise_and {};
|
||||
struct bitwise_or {};
|
||||
struct bitwise_xor {};
|
||||
struct comma {};
|
||||
struct mem_ptr {};
|
||||
struct assign {};
|
||||
struct shift_left_assign {};
|
||||
struct shift_right_assign {};
|
||||
struct multiplies_assign {};
|
||||
struct divides_assign {};
|
||||
struct modulus_assign {};
|
||||
struct plus_assign {};
|
||||
struct minus_assign {};
|
||||
struct bitwise_and_assign {};
|
||||
struct bitwise_or_assign {};
|
||||
struct bitwise_xor_assign {};
|
||||
struct subscript {};
|
||||
struct member {};
|
||||
struct if_else_ {};
|
||||
struct function {};
|
||||
} // namespace tag
|
||||
} // namespace tagns_
|
||||
} // namespace breed
|
||||
|
|
|
@ -481,7 +481,7 @@ namespace sprout {
|
|||
N < sizeof...(Args),
|
||||
sprout::tppack_at<N, Args...>,
|
||||
sprout::breed::detail::if_vararg<typename sprout::tppack_at<sizeof...(Args) - 1, Args...>::type>
|
||||
>::type::type
|
||||
>::type::type
|
||||
};
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
|
@ -519,7 +519,7 @@ namespace sprout {
|
|||
N < sizeof...(Args),
|
||||
sprout::tppack_at<N, Args...>,
|
||||
sprout::breed::detail::if_vararg<typename sprout::tppack_at<sizeof...(Args) - 1, Args...>::type>
|
||||
>::type::type
|
||||
>::type::type
|
||||
};
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace sprout {
|
||||
namespace breed {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
template<
|
||||
typename Grammar,
|
||||
typename Expr,
|
||||
|
@ -32,10 +32,10 @@ namespace sprout {
|
|||
public:
|
||||
typedef sprout::breed::list<
|
||||
typename Grammar::template breed_child<Indexes>::type::template impl<
|
||||
typename sprout::breed::result_of::child_c<Expr, Indexes>::type,
|
||||
State,
|
||||
Data
|
||||
>::result_type...
|
||||
typename sprout::breed::result_of::child_c<Expr, Indexes>::type,
|
||||
State,
|
||||
Data
|
||||
>::result_type...
|
||||
> type;
|
||||
};
|
||||
public:
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace sprout {
|
|||
struct otherwise
|
||||
: public sprout::breed::when<sprout::breed::_, Fun>
|
||||
{};
|
||||
//
|
||||
//
|
||||
// external_transforms
|
||||
//
|
||||
template<typename... Args>
|
||||
|
|
|
@ -292,7 +292,7 @@ namespace sprout {
|
|||
}
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
|
||||
//
|
||||
// compressed_pair
|
||||
//
|
||||
|
|
|
@ -10,7 +10,8 @@ namespace sprout {
|
|||
// empty
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR bool empty(Container const& cont) {
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
empty(Container const& cont) {
|
||||
return sprout::begin(cont) == sprout::end(cont);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
|
|
@ -12,7 +12,8 @@ namespace sprout {
|
|||
// size
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::difference_type size(Container const& cont) {
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::difference_type
|
||||
size(Container const& cont) {
|
||||
return NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), sprout::end(cont));
|
||||
}
|
||||
} // namespace sprout
|
||||
|
|
|
@ -179,4 +179,3 @@ namespace sprout {
|
|||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_DETAIL_INTEGER_HPP
|
||||
|
||||
|
|
|
@ -63,4 +63,3 @@ namespace sprout {
|
|||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_DETAIL_INTEGER_INTEGER_MASK_HPP
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR Result call_cv(sprout::tuples::tuple<Args...>&& args, sprout::index_tuple<Indexes...>) const volatile {
|
||||
return f_(sprout::detail::mu<BoundArgs>()(sprout::detail::volget<Indexes>(bound_args_), args)...);
|
||||
}
|
||||
public:
|
||||
public:
|
||||
template<typename... Args>
|
||||
explicit SPROUT_CONSTEXPR binder(Functor const& f, Args&&... args)
|
||||
: f_(f)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace sprout {
|
|||
typedef T result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR T operator()(T const& x, T const& y) const {
|
||||
return x & y;
|
||||
return x & y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace sprout {
|
|||
typedef T result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR T operator()(T const& x) const {
|
||||
return !x;
|
||||
return !x;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace sprout {
|
|||
typedef T result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR T operator()(T const& x, T const& y) const {
|
||||
return x | y;
|
||||
return x | y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace sprout {
|
|||
typedef T result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR T operator()(T const& x, T const& y) const {
|
||||
return x ^ y;
|
||||
return x ^ y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace sprout {
|
|||
typedef T result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR T operator()(T const& x, T const& y) const {
|
||||
return x / y;
|
||||
return x / y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace sprout {
|
|||
typedef bool result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const {
|
||||
return x == y;
|
||||
return x == y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace sprout {
|
|||
typedef bool result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const {
|
||||
return x > y;
|
||||
return x > y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace sprout {
|
|||
typedef bool result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const {
|
||||
return x >= y;
|
||||
return x >= y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -5,4 +5,3 @@
|
|||
#include <sprout/functional/hash/hash.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_FUNCTIONAL_HASH_HPP
|
||||
|
||||
|
|
|
@ -14,4 +14,3 @@ namespace sprout {
|
|||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FUNCTIONAL_HASH_ARRAY_HPP
|
||||
|
||||
|
|
|
@ -270,4 +270,3 @@ namespace sprout {
|
|||
} //namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FUNCTIONAL_HASH_HASH_HPP
|
||||
|
||||
|
|
|
@ -33,4 +33,3 @@ namespace sprout {
|
|||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FUNCTIONAL_HASH_HASH_FWD_HPP
|
||||
|
||||
|
|
|
@ -14,4 +14,3 @@ namespace sprout {
|
|||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FUNCTIONAL_HASH_SSCRISK_CEL_ARRAY_HPP
|
||||
|
||||
|
|
|
@ -6,4 +6,3 @@
|
|||
#include <sprout/string/hash.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_FUNCTIONAL_HASH_STRING_HPP
|
||||
|
||||
|
|
|
@ -14,4 +14,3 @@ namespace sprout {
|
|||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FUNCTIONAL_HASH_SUB_ARRAY_HPP
|
||||
|
||||
|
|
|
@ -5,4 +5,3 @@
|
|||
#include <sprout/functional/hash/hash_fwd.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_FUNCTIONAL_HASH_FWD_HPP
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace sprout {
|
|||
typedef bool result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const {
|
||||
return x < y;
|
||||
return x < y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace sprout {
|
|||
typedef bool result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const {
|
||||
return x <= y;
|
||||
return x <= y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace sprout {
|
|||
typedef bool result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const {
|
||||
return x && y;
|
||||
return x && y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace sprout {
|
|||
typedef bool result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR bool operator()(T const& x) const {
|
||||
return !x;
|
||||
return !x;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace sprout {
|
|||
typedef bool result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const {
|
||||
return x || y;
|
||||
return x || y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace sprout {
|
|||
typedef T result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR T operator()(T const& x, T const& y) const {
|
||||
return x - y;
|
||||
return x - y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace sprout {
|
|||
typedef T result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR T operator()(T const& x, T const& y) const {
|
||||
return x % y;
|
||||
return x % y;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue