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