diff --git a/example/fizzbuzz/main.cpp b/example/fizzbuzz/main.cpp index 59c008ff..2ee7187d 100644 --- a/example/fizzbuzz/main.cpp +++ b/example/fizzbuzz/main.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 // @@ -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 >(), fizzbuzz() ); - + // // Check result // diff --git a/libs/algorithm/test/bogo_sort.cpp b/libs/algorithm/test/bogo_sort.cpp index fefecbca..5c5dfe39 100644 --- a/libs/algorithm/test/bogo_sort.cpp +++ b/libs/algorithm/test/bogo_sort.cpp @@ -135,4 +135,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_BOGO_SORT_CPP - diff --git a/libs/algorithm/test/bogo_sort_result.cpp b/libs/algorithm/test/bogo_sort_result.cpp index 6d3f37dc..5f4a5ce4 100644 --- a/libs/algorithm/test/bogo_sort_result.cpp +++ b/libs/algorithm/test/bogo_sort_result.cpp @@ -177,4 +177,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_BOGO_SORT_RESULT_CPP - diff --git a/libs/algorithm/test/copy.cpp b/libs/algorithm/test/copy.cpp index e4893c64..baa83b74 100644 --- a/libs/algorithm/test/copy.cpp +++ b/libs/algorithm/test/copy.cpp @@ -104,4 +104,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_COPY_CPP - diff --git a/libs/algorithm/test/copy_backward.cpp b/libs/algorithm/test/copy_backward.cpp index 656a765e..ab8e9250 100644 --- a/libs/algorithm/test/copy_backward.cpp +++ b/libs/algorithm/test/copy_backward.cpp @@ -104,4 +104,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_COPY_BACKWARD_CPP - diff --git a/libs/algorithm/test/copy_if.cpp b/libs/algorithm/test/copy_if.cpp index 89729789..059bc6b3 100644 --- a/libs/algorithm/test/copy_if.cpp +++ b/libs/algorithm/test/copy_if.cpp @@ -110,4 +110,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_COPY_IF_CPP - diff --git a/libs/algorithm/test/copy_n.cpp b/libs/algorithm/test/copy_n.cpp index c69439e4..bd19b285 100644 --- a/libs/algorithm/test/copy_n.cpp +++ b/libs/algorithm/test/copy_n.cpp @@ -104,4 +104,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_COPY_N_CPP - diff --git a/libs/algorithm/test/fill.cpp b/libs/algorithm/test/fill.cpp index e9a21512..ebf693e5 100644 --- a/libs/algorithm/test/fill.cpp +++ b/libs/algorithm/test/fill.cpp @@ -74,4 +74,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_FILL_CPP - diff --git a/libs/algorithm/test/fill_n.cpp b/libs/algorithm/test/fill_n.cpp index 075ce669..c682735b 100644 --- a/libs/algorithm/test/fill_n.cpp +++ b/libs/algorithm/test/fill_n.cpp @@ -78,4 +78,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_FILL_N_CPP - diff --git a/libs/algorithm/test/generate.cpp b/libs/algorithm/test/generate.cpp index a3d7f5f5..42288e40 100644 --- a/libs/algorithm/test/generate.cpp +++ b/libs/algorithm/test/generate.cpp @@ -78,4 +78,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_GENERATE_CPP - diff --git a/libs/algorithm/test/generate_n.cpp b/libs/algorithm/test/generate_n.cpp index 756e64bd..29c2ee12 100644 --- a/libs/algorithm/test/generate_n.cpp +++ b/libs/algorithm/test/generate_n.cpp @@ -82,4 +82,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_GENERATE_N_CPP - diff --git a/libs/algorithm/test/inplace_merge.cpp b/libs/algorithm/test/inplace_merge.cpp index 706b4320..ff33e589 100644 --- a/libs/algorithm/test/inplace_merge.cpp +++ b/libs/algorithm/test/inplace_merge.cpp @@ -133,4 +133,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_INPLACE_MERGE_CPP - diff --git a/libs/algorithm/test/make_heap.cpp b/libs/algorithm/test/make_heap.cpp index 179c94ea..bea25ad0 100644 --- a/libs/algorithm/test/make_heap.cpp +++ b/libs/algorithm/test/make_heap.cpp @@ -125,4 +125,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_MAKE_HEAP_CPP - diff --git a/libs/algorithm/test/make_partial_heap.cpp b/libs/algorithm/test/make_partial_heap.cpp index 88906c94..48e877e0 100644 --- a/libs/algorithm/test/make_partial_heap.cpp +++ b/libs/algorithm/test/make_partial_heap.cpp @@ -133,4 +133,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_MAKE_PARTIAL_HEAP_CPP - diff --git a/libs/algorithm/test/merge.cpp b/libs/algorithm/test/merge.cpp index e8e506bb..ca055ae5 100644 --- a/libs/algorithm/test/merge.cpp +++ b/libs/algorithm/test/merge.cpp @@ -221,4 +221,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_MERGE_CPP - diff --git a/libs/algorithm/test/nth_element.cpp b/libs/algorithm/test/nth_element.cpp index 91308100..8b51b622 100644 --- a/libs/algorithm/test/nth_element.cpp +++ b/libs/algorithm/test/nth_element.cpp @@ -133,4 +133,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_NTH_ELEMENT_CPP - diff --git a/libs/algorithm/test/partial_sort.cpp b/libs/algorithm/test/partial_sort.cpp index d22eaaaa..905711ed 100644 --- a/libs/algorithm/test/partial_sort.cpp +++ b/libs/algorithm/test/partial_sort.cpp @@ -133,4 +133,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_PARTIAL_SORT_CPP - diff --git a/libs/algorithm/test/partition.cpp b/libs/algorithm/test/partition.cpp index c556aa1d..b449ebc9 100644 --- a/libs/algorithm/test/partition.cpp +++ b/libs/algorithm/test/partition.cpp @@ -74,4 +74,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_PARTITION_CPP - diff --git a/libs/algorithm/test/partition_copy.cpp b/libs/algorithm/test/partition_copy.cpp index 53b1e75f..4d82b3ad 100644 --- a/libs/algorithm/test/partition_copy.cpp +++ b/libs/algorithm/test/partition_copy.cpp @@ -110,4 +110,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_PARTITION_COPY_CPP - diff --git a/libs/algorithm/test/pop_heap.cpp b/libs/algorithm/test/pop_heap.cpp index 0f7d7d36..6b9b0cc6 100644 --- a/libs/algorithm/test/pop_heap.cpp +++ b/libs/algorithm/test/pop_heap.cpp @@ -70,4 +70,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_POP_HEAP_CPP - diff --git a/libs/algorithm/test/push_heap.cpp b/libs/algorithm/test/push_heap.cpp index f86bc156..5d635eb2 100644 --- a/libs/algorithm/test/push_heap.cpp +++ b/libs/algorithm/test/push_heap.cpp @@ -125,4 +125,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_PUSH_HEAP_CPP - diff --git a/libs/algorithm/test/remove.cpp b/libs/algorithm/test/remove.cpp index 60c937ca..12cce8a4 100644 --- a/libs/algorithm/test/remove.cpp +++ b/libs/algorithm/test/remove.cpp @@ -74,4 +74,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REMOVE_CPP - diff --git a/libs/algorithm/test/remove_copy.cpp b/libs/algorithm/test/remove_copy.cpp index f2a0ddbc..46d8c2c0 100644 --- a/libs/algorithm/test/remove_copy.cpp +++ b/libs/algorithm/test/remove_copy.cpp @@ -110,4 +110,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REMOVE_COPY_CPP - diff --git a/libs/algorithm/test/remove_copy_if.cpp b/libs/algorithm/test/remove_copy_if.cpp index 727f2360..9e7911b1 100644 --- a/libs/algorithm/test/remove_copy_if.cpp +++ b/libs/algorithm/test/remove_copy_if.cpp @@ -110,4 +110,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REMOVE_COPY_IF_CPP - diff --git a/libs/algorithm/test/remove_if.cpp b/libs/algorithm/test/remove_if.cpp index 06da8f08..85a2621f 100644 --- a/libs/algorithm/test/remove_if.cpp +++ b/libs/algorithm/test/remove_if.cpp @@ -74,4 +74,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REMOVE_IF_CPP - diff --git a/libs/algorithm/test/replace.cpp b/libs/algorithm/test/replace.cpp index 5d8feb46..754ef1a8 100644 --- a/libs/algorithm/test/replace.cpp +++ b/libs/algorithm/test/replace.cpp @@ -78,4 +78,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REPLACE_CPP - diff --git a/libs/algorithm/test/replace_copy.cpp b/libs/algorithm/test/replace_copy.cpp index 8bc14179..124a430e 100644 --- a/libs/algorithm/test/replace_copy.cpp +++ b/libs/algorithm/test/replace_copy.cpp @@ -116,4 +116,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REPLACE_COPY_CPP - diff --git a/libs/algorithm/test/replace_copy_if.cpp b/libs/algorithm/test/replace_copy_if.cpp index bef898a8..4bec2320 100644 --- a/libs/algorithm/test/replace_copy_if.cpp +++ b/libs/algorithm/test/replace_copy_if.cpp @@ -116,4 +116,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REPLACE_COPY_IF_CPP - diff --git a/libs/algorithm/test/replace_if.cpp b/libs/algorithm/test/replace_if.cpp index 684ec4ee..81bc02ab 100644 --- a/libs/algorithm/test/replace_if.cpp +++ b/libs/algorithm/test/replace_if.cpp @@ -78,4 +78,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REPLACE_IF_CPP - diff --git a/libs/algorithm/test/reverse.cpp b/libs/algorithm/test/reverse.cpp index e9ca58c0..f2accd9b 100644 --- a/libs/algorithm/test/reverse.cpp +++ b/libs/algorithm/test/reverse.cpp @@ -70,4 +70,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REBERSE_CPP - diff --git a/libs/algorithm/test/reverse_copy.cpp b/libs/algorithm/test/reverse_copy.cpp index d2eca837..4dc164bf 100644 --- a/libs/algorithm/test/reverse_copy.cpp +++ b/libs/algorithm/test/reverse_copy.cpp @@ -104,4 +104,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_REBERSE_COPY_CPP - diff --git a/libs/algorithm/test/rotate.cpp b/libs/algorithm/test/rotate.cpp index 9ba1b09e..e1f1455c 100644 --- a/libs/algorithm/test/rotate.cpp +++ b/libs/algorithm/test/rotate.cpp @@ -74,4 +74,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_ROTATE_CPP - diff --git a/libs/algorithm/test/rotate_copy.cpp b/libs/algorithm/test/rotate_copy.cpp index 22d3f17b..97dc670a 100644 --- a/libs/algorithm/test/rotate_copy.cpp +++ b/libs/algorithm/test/rotate_copy.cpp @@ -110,4 +110,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_ROTATE_COPY_CPP - diff --git a/libs/algorithm/test/set_difference.cpp b/libs/algorithm/test/set_difference.cpp index 2ff84513..00952e3b 100644 --- a/libs/algorithm/test/set_difference.cpp +++ b/libs/algorithm/test/set_difference.cpp @@ -221,4 +221,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SET_DIFFERENCE_CPP - diff --git a/libs/algorithm/test/set_intersection.cpp b/libs/algorithm/test/set_intersection.cpp index 1bcfc9df..b8925cc7 100644 --- a/libs/algorithm/test/set_intersection.cpp +++ b/libs/algorithm/test/set_intersection.cpp @@ -221,4 +221,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SET_INTERSECTION_CPP - diff --git a/libs/algorithm/test/set_symmetric_difference.cpp b/libs/algorithm/test/set_symmetric_difference.cpp index 03b21a78..8181008d 100644 --- a/libs/algorithm/test/set_symmetric_difference.cpp +++ b/libs/algorithm/test/set_symmetric_difference.cpp @@ -221,4 +221,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SET_SYMMETRIC_DIFFERENCE_CPP - diff --git a/libs/algorithm/test/set_union.cpp b/libs/algorithm/test/set_union.cpp index 839cb868..358b3d0e 100644 --- a/libs/algorithm/test/set_union.cpp +++ b/libs/algorithm/test/set_union.cpp @@ -221,4 +221,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SET_UNION_CPP - diff --git a/libs/algorithm/test/shuffle.cpp b/libs/algorithm/test/shuffle.cpp index db1072cf..fb8a596b 100644 --- a/libs/algorithm/test/shuffle.cpp +++ b/libs/algorithm/test/shuffle.cpp @@ -76,4 +76,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SHUFFLE_CPP - diff --git a/libs/algorithm/test/shuffle_result.cpp b/libs/algorithm/test/shuffle_result.cpp index 38924421..872ccace 100644 --- a/libs/algorithm/test/shuffle_result.cpp +++ b/libs/algorithm/test/shuffle_result.cpp @@ -97,4 +97,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SHUFFLE_RESULT_CPP - diff --git a/libs/algorithm/test/sort.cpp b/libs/algorithm/test/sort.cpp index dfb2ebf0..0cd6efb0 100644 --- a/libs/algorithm/test/sort.cpp +++ b/libs/algorithm/test/sort.cpp @@ -125,4 +125,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SORT_CPP - diff --git a/libs/algorithm/test/sort_heap.cpp b/libs/algorithm/test/sort_heap.cpp index b5a29aae..f4751576 100644 --- a/libs/algorithm/test/sort_heap.cpp +++ b/libs/algorithm/test/sort_heap.cpp @@ -125,4 +125,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SORT_HEAP_CPP - diff --git a/libs/algorithm/test/stable_partition.cpp b/libs/algorithm/test/stable_partition.cpp index dc664436..695c54bb 100644 --- a/libs/algorithm/test/stable_partition.cpp +++ b/libs/algorithm/test/stable_partition.cpp @@ -74,4 +74,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_STABLE_PARTITION_CPP - diff --git a/libs/algorithm/test/stable_partition_copy.cpp b/libs/algorithm/test/stable_partition_copy.cpp index df39b986..a6c810f2 100644 --- a/libs/algorithm/test/stable_partition_copy.cpp +++ b/libs/algorithm/test/stable_partition_copy.cpp @@ -110,4 +110,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_STABLE_PARTITION_COPY_CPP - diff --git a/libs/algorithm/test/stable_sort.cpp b/libs/algorithm/test/stable_sort.cpp index 6362407f..4bbde664 100644 --- a/libs/algorithm/test/stable_sort.cpp +++ b/libs/algorithm/test/stable_sort.cpp @@ -125,4 +125,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_STABLE_SORT_CPP - diff --git a/libs/algorithm/test/swap_element.cpp b/libs/algorithm/test/swap_element.cpp index e3058e4f..1ecf74cb 100644 --- a/libs/algorithm/test/swap_element.cpp +++ b/libs/algorithm/test/swap_element.cpp @@ -78,4 +78,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SWAP_ELEMENT_CPP - diff --git a/libs/algorithm/test/swap_element_copy.cpp b/libs/algorithm/test/swap_element_copy.cpp index ab028c76..e397fb6a 100644 --- a/libs/algorithm/test/swap_element_copy.cpp +++ b/libs/algorithm/test/swap_element_copy.cpp @@ -116,4 +116,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_SWAP_ELEMENT_COPY_CPP - diff --git a/libs/algorithm/test/transform.cpp b/libs/algorithm/test/transform.cpp index 19ef461d..e4d40576 100644 --- a/libs/algorithm/test/transform.cpp +++ b/libs/algorithm/test/transform.cpp @@ -208,4 +208,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_TRANSFORM_CPP - diff --git a/libs/algorithm/test/unique.cpp b/libs/algorithm/test/unique.cpp index e39fad00..91206d86 100644 --- a/libs/algorithm/test/unique.cpp +++ b/libs/algorithm/test/unique.cpp @@ -125,4 +125,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_UNIQUE_CPP - diff --git a/libs/algorithm/test/unique_copy.cpp b/libs/algorithm/test/unique_copy.cpp index 04803793..61e2615c 100644 --- a/libs/algorithm/test/unique_copy.cpp +++ b/libs/algorithm/test/unique_copy.cpp @@ -195,4 +195,3 @@ namespace testspr { #endif #endif // #ifndef SPROUT_LIBS_ALGORITHM_TEST_UNIQUE_COPY_CPP - diff --git a/libs/string/example/literals_to_string.cpp b/libs/string/example/literals_to_string.cpp index 45f40bad..4d9fd40f 100644 --- a/libs/string/example/literals_to_string.cpp +++ b/libs/string/example/literals_to_string.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 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 // diff --git a/libs/string/example/simple.cpp b/libs/string/example/simple.cpp index 2496bee6..4d9a14e7 100644 --- a/libs/string/example/simple.cpp +++ b/libs/string/example/simple.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 // @@ -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 // diff --git a/libs/weed/example/__TIME__.cpp b/libs/weed/example/__TIME__.cpp index d287d440..fa569d4d 100644 --- a/libs/weed/example/__TIME__.cpp +++ b/libs/weed/example/__TIME__.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 // @@ -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 // diff --git a/libs/weed/example/remove_space.cpp b/libs/weed/example/remove_space.cpp index e155670b..8b90f9d7 100644 --- a/libs/weed/example/remove_space.cpp +++ b/libs/weed/example/remove_space.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 // @@ -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(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), diff --git a/sprout/algorithm/fixed/bogo_sort.hpp b/sprout/algorithm/fixed/bogo_sort.hpp index c946e15d..fada647e 100644 --- a/sprout/algorithm/fixed/bogo_sort.hpp +++ b/sprout/algorithm/fixed/bogo_sort.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sprout/algorithm/fixed/bogo_sort_result.hpp b/sprout/algorithm/fixed/bogo_sort_result.hpp index d57a9f58..ecb9b4c8 100644 --- a/sprout/algorithm/fixed/bogo_sort_result.hpp +++ b/sprout/algorithm/fixed/bogo_sort_result.hpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sprout/algorithm/fixed/copy_n.hpp b/sprout/algorithm/fixed/copy_n.hpp index 398eb728..92a756ff 100644 --- a/sprout/algorithm/fixed/copy_n.hpp +++ b/sprout/algorithm/fixed/copy_n.hpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sprout/algorithm/fixed/fill.hpp b/sprout/algorithm/fixed/fill.hpp index cc071a0d..1dfd59d2 100644 --- a/sprout/algorithm/fixed/fill.hpp +++ b/sprout/algorithm/fixed/fill.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include namespace sprout { diff --git a/sprout/algorithm/fixed/make_heap.hpp b/sprout/algorithm/fixed/make_heap.hpp index 471fc378..ec9afe56 100644 --- a/sprout/algorithm/fixed/make_heap.hpp +++ b/sprout/algorithm/fixed/make_heap.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT diff --git a/sprout/algorithm/fixed/make_partial_heap.hpp b/sprout/algorithm/fixed/make_partial_heap.hpp index 5003d1ec..be95b826 100644 --- a/sprout/algorithm/fixed/make_partial_heap.hpp +++ b/sprout/algorithm/fixed/make_partial_heap.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sprout/algorithm/fixed/nth_element.hpp b/sprout/algorithm/fixed/nth_element.hpp index 6f106ebf..9aaa0884 100644 --- a/sprout/algorithm/fixed/nth_element.hpp +++ b/sprout/algorithm/fixed/nth_element.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sprout/algorithm/fixed/push_heap.hpp b/sprout/algorithm/fixed/push_heap.hpp index e97c668b..67fb6896 100644 --- a/sprout/algorithm/fixed/push_heap.hpp +++ b/sprout/algorithm/fixed/push_heap.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT diff --git a/sprout/algorithm/fixed/sort_heap.hpp b/sprout/algorithm/fixed/sort_heap.hpp index fbf6f7b4..95973226 100644 --- a/sprout/algorithm/fixed/sort_heap.hpp +++ b/sprout/algorithm/fixed/sort_heap.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sprout/algorithm/string.hpp b/sprout/algorithm/string.hpp index 629a1d1d..44386251 100644 --- a/sprout/algorithm/string.hpp +++ b/sprout/algorithm/string.hpp @@ -3,6 +3,5 @@ #include #include -#include #endif // #ifndef SPROUT_ALGORITHM_STRING_HPP diff --git a/sprout/algorithm/string/join.hpp b/sprout/algorithm/string/join.hpp index 0f48b59a..acb665c5 100644 --- a/sprout/algorithm/string/join.hpp +++ b/sprout/algorithm/string/join.hpp @@ -1,22 +1,88 @@ #ifndef SPROUT_ALGORITHM_STRING_JOIN_HPP #define SPROUT_ALGORITHM_STRING_JOIN_HPP -#include -#include #include #include #include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include namespace sprout { namespace algorithm { + namespace detail { + template + struct string_size; + template + struct string_size< + String, + typename std::enable_if::value>::type + > + : public std::integral_constant< + typename sprout::container_traits::size_type, + sprout::container_traits::static_size - 1 + > + {}; + template + struct string_size< + String, + typename std::enable_if::value>::type + > + : public std::integral_constant< + typename sprout::container_traits::size_type, + sprout::container_traits::static_size + > + {}; + + template< + typename String, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CONSTEXPR typename sprout::container_traits::difference_type + str_size(String const& str) { + return sprout::size(str) - 1; + } + template< + typename String, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CONSTEXPR typename sprout::container_traits::difference_type + str_size(String const& str) { + return sprout::size(str); + } + } // namespace detail + namespace result_of { // // join // - template + template struct join { + public: + typedef typename sprout::container_transform_traits< + typename sprout::container_traits::value_type + >::template rebind_size< + sprout::container_traits< + typename sprout::container_traits::value_type + >::static_size + ? (sprout::container_traits< + typename sprout::container_traits::value_type + >::static_size + + sprout::algorithm::detail::string_size::value + ) + * sprout::container_traits::static_size + - sprout::algorithm::detail::string_size::value + : 0 + >::type type; + }; + template + struct join { public: typedef typename sprout::container_transform_traits< typename sprout::container_traits::value_type @@ -30,31 +96,80 @@ namespace sprout { } // namespace result_of namespace detail { - template + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::value_type + join_impl_ra_2( + ContIterator first_cont, + SizeIterator found, + Sizes const& sizes, + sprout::index_t idx + ) + { + typedef typename sprout::container_traits::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 + inline SPROUT_CONSTEXPR Result + join_impl_ra_1( + ContIterator first_cont, + sprout::index_tuple, + Sizes const& sizes + ) + { + return sprout::make( + sprout::algorithm::detail::join_impl_ra_2( + first_cont, + sprout::range::lower_bound(sizes, Indexes + 1), + sizes, + Indexes + )... + ); + } + template + inline SPROUT_CONSTEXPR Result + join_impl_ra(ContainerContainer const& cont_cont) { + typedef typename sprout::container_traits::difference_type size_type; + typedef sprout::array< + size_type, + sprout::container_traits::static_size + > sizes_type; + return sprout::algorithm::detail::join_impl_ra_1( + sprout::begin(cont_cont), + sprout::index_range<0, sprout::container_traits::static_size>::make(), + sprout::range::partial_sum( + cont_cont | sprout::adaptors::size_enumed, + sprout::pit() + ) + ); + } + + template inline SPROUT_CONSTEXPR typename std::enable_if< sprout::container_traits::static_size == sizeof...(Args), Result >::type join_impl( - ContainerInputIterator first_cont, - ContainerInputIterator last_cont, + ContIterator first_cont, + ContIterator last_cont, Args const&... args ); - template + template inline SPROUT_CONSTEXPR typename std::enable_if< sprout::container_traits::static_size != sizeof...(Args), Result >::type join_impl( - ContainerInputIterator first_cont, - ContainerInputIterator last_cont, + ContIterator first_cont, + ContIterator last_cont, Args const&... args ); - template + template inline SPROUT_CONSTEXPR typename std::enable_if< sprout::container_traits::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(args...); } - template + template inline SPROUT_CONSTEXPR typename std::enable_if< sprout::container_traits::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(first_cont, last_cont, sprout::next(first), last, args..., *first) + ? sprout::algorithm::detail::join_impl_1( + first_cont, last_cont, + sprout::next(first), last, + args..., *first + ) : sprout::algorithm::detail::join_impl(sprout::next(first_cont), last_cont, args...) ; } - template + template inline SPROUT_CONSTEXPR typename std::enable_if< sprout::container_traits::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(args...); } - template + template inline SPROUT_CONSTEXPR typename std::enable_if< sprout::container_traits::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(first_cont, last_cont, sprout::begin(*first_cont), sprout::end(*first_cont), args...) + ? sprout::algorithm::detail::join_impl_1( + first_cont, last_cont, + sprout::begin(*first_cont), sprout::end(*first_cont), + args... + ) : sprout::make(args...) ; } + + template< + typename ContainerContainer, + typename sprout::enabler_if< + sprout::is_random_access_iterator< + typename sprout::container_traits::iterator + >::value + && sprout::is_random_access_iterator< + typename sprout::container_traits< + typename sprout::container_traits::value_type + >::iterator + >::value + >::type = sprout::enabler + > + inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join::type + join(ContainerContainer const& cont_cont) { + typedef typename sprout::algorithm::result_of::join::type result_type; + return sprout::algorithm::detail::join_impl_ra(cont_cont); + } + template< + typename ContainerContainer, + typename sprout::enabler_if::iterator + >::value + && sprout::is_random_access_iterator< + typename sprout::container_traits< + typename sprout::container_traits::value_type + >::iterator + >::value + )>::type = sprout::enabler + > + inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join::type + join(ContainerContainer const& cont_cont) { + typedef typename sprout::algorithm::result_of::join::type result_type; + return sprout::algorithm::detail::join_impl( + sprout::begin(cont_cont), + sprout::end(cont_cont) + ); + } } // namespace detail // // join // template - inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join::type join( - ContainerContainer const& cont_cont - ) - { - return sprout::algorithm::detail::join_impl::type>( - sprout::begin(cont_cont), - sprout::end(cont_cont) + inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join::type + join(ContainerContainer const& cont_cont) { + return sprout::algorithm::detail::join(cont_cont); + } + + namespace detail { + template + inline SPROUT_CONSTEXPR typename sprout::container_traits::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::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 + inline SPROUT_CONSTEXPR Result + join_impl_ra_1( + ContIterator first_cont, + SepIterator first, + sprout::index_tuple, + Sizes const& sizes + ) + { + return sprout::make( + sprout::algorithm::detail::join_impl_ra_2( + first_cont, + first, + sprout::range::lower_bound(sizes, Indexes + 1), + sizes, + Indexes + )... + ); + } + template + inline SPROUT_CONSTEXPR Result + join_impl_ra(ContainerContainer const& cont_cont, Separator const& separator) { + typedef typename sprout::container_traits::difference_type size_type; + typedef sprout::array< + size_type, + sprout::container_traits::static_size + ? sprout::container_traits::static_size * 2 - 1 + : 0 + > sizes_type; + return sprout::algorithm::detail::join_impl_ra_1( + sprout::begin(cont_cont), + sprout::begin(separator), + sprout::index_range<0, sprout::container_traits::static_size>::make(), + sprout::range::partial_sum( + cont_cont | sprout::adaptors::size_enumed(sprout::algorithm::detail::str_size(separator), true), + sprout::pit() + ) + ); + } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::static_size == sizeof...(Args), + Result + >::type join_impl( + ContIterator first_cont, + ContIterator last_cont, + Args const&... args ); + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::static_size != sizeof...(Args), + Result + >::type join_impl( + ContIterator first_cont, + ContIterator last_cont, + Args const&... args + ); + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::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(args...); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::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( + first_cont, last_cont, + sep_first, sep_last, + sep, + sprout::next(first), last, + args..., *first + ) + : sep + ? sprout::algorithm::detail::join_impl( + sprout::next(first_cont), last_cont, + sep_first, sep_last, + false, + args... + ) + : sprout::algorithm::detail::join_impl( + first_cont, last_cont, + sep_first, sep_last, + true, + args... + ) + ; + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::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(args...); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::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( + first_cont, last_cont, + sep_first, sep_last, + sep, + sep_first, sep_last, + args... + ) + : sprout::algorithm::detail::join_impl_1( + first_cont, last_cont, + sep_first, sep_last, + sep, + sprout::begin(*first_cont), sprout::end(*first_cont), + args... + ) + : sprout::make(args...) + ; + } + + template< + typename ContainerContainer, + typename Separator, + typename sprout::enabler_if< + sprout::is_random_access_iterator< + typename sprout::container_traits::iterator + >::value + && sprout::is_random_access_iterator< + typename sprout::container_traits< + typename sprout::container_traits::value_type + >::iterator + >::value + && sprout::is_random_access_iterator< + typename sprout::container_traits::iterator + >::value + >::type = sprout::enabler + > + inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join::type + join(ContainerContainer const& cont_cont, Separator const& separator) { + typedef typename sprout::algorithm::result_of::join::type result_type; + return sprout::algorithm::detail::join_impl_ra(cont_cont, separator); + } + template< + typename ContainerContainer, + typename Separator, + typename sprout::enabler_if::iterator + >::value + && sprout::is_random_access_iterator< + typename sprout::container_traits< + typename sprout::container_traits::value_type + >::iterator + >::value + && sprout::is_random_access_iterator< + typename sprout::container_traits::iterator + >::value + )>::type = sprout::enabler + > + inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join::type + join(ContainerContainer const& cont_cont, Separator const& separator) { + typedef typename sprout::algorithm::result_of::join::type result_type; + return sprout::algorithm::detail::join_impl( + sprout::begin(cont_cont), + sprout::end(cont_cont), + sprout::begin(separator), + sprout::end(separator), + false + ); + } + } // namespace detail + // + // join + // + template + inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join::type + join(ContainerContainer const& cont_cont, Separator const& separator) { + return sprout::algorithm::detail::join(cont_cont, separator); } } // namespace algorithm } // namespace sprout diff --git a/sprout/algorithm/string/join2.hpp b/sprout/algorithm/string/join2.hpp deleted file mode 100644 index ceb0ff36..00000000 --- a/sprout/algorithm/string/join2.hpp +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef SPROUT_ALGORITHM_STRING_JOIN2_HPP -#define SPROUT_ALGORITHM_STRING_JOIN2_HPP - -#include -#include -#include -#include -#include -#include - -namespace sprout { - namespace algorithm { - namespace result_of { - // - // join2 - // - template - struct join2 { - public: - typedef typename sprout::container_transform_traits< - typename sprout::container_traits::value_type - >::template rebind_size< - sprout::container_traits::static_size != 0 - ? ( - sprout::container_traits< - typename sprout::container_traits::value_type - >::static_size - + (sprout::container_traits::static_size - 1) * ( - sprout::container_traits::static_size - + sprout::container_traits< - typename sprout::container_traits::value_type - >::static_size - ) - ) - : 0 - >::type type; - }; - } // namespace result_of - - namespace detail { - template - inline SPROUT_CONSTEXPR typename std::enable_if< - (sprout::container_traits::static_size == sprout::container_traits::static_size), - Result - >::type join2_impl_1( - ContainerIterator first, - ContainerIterator last, - Separator const& separator, - Container const& current - ) - { - return current; - } - template - inline SPROUT_CONSTEXPR typename std::enable_if< - (sprout::container_traits::static_size < sprout::container_traits::static_size), - Result - >::type join2_impl_1( - ContainerIterator first, - ContainerIterator last, - Separator const& separator, - Container const& current - ) - { - return sprout::algorithm::detail::join2_impl_1( - sprout::next(first), - last, - separator, - sprout::fixed::append_back(sprout::fixed::append_back(current, separator), *first) - ); - } - template - inline SPROUT_CONSTEXPR Result join2_impl( - ContainerIterator first, - ContainerIterator last, - Separator const& separator - ) - { - return first != last - ? sprout::algorithm::detail::join2_impl_1( - sprout::next(first), - last, - separator, - *first - ) - : sprout::make() - ; - } - } // namespace detail - // - // join2 - // - template - inline SPROUT_CONSTEXPR typename sprout::algorithm::result_of::join2::type join2( - ContainerContainer const& cont_cont, - Separator const& separator - ) - { - return sprout::algorithm::detail::join2_impl::type>( - sprout::begin(cont_cont), - sprout::end(cont_cont), - separator - ); - } - } // namespace algorithm -} // namespace sprout - -#endif // #ifndef SPROUT_ALGORITHM_STRING_JOIN2_HPP diff --git a/sprout/breed/expr.hpp b/sprout/breed/expr.hpp index a536e11f..b387bf18 100644 --- a/sprout/breed/expr.hpp +++ b/sprout/breed/expr.hpp @@ -17,7 +17,7 @@ namespace sprout { private: SPROUT_CONSTEXPR not_a_valid_type() {} }; - + template struct address_of_hack { public: @@ -317,12 +317,12 @@ namespace sprout { template 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 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...); } diff --git a/sprout/breed/generate.hpp b/sprout/breed/generate.hpp index 8a921356..6021feb0 100644 --- a/sprout/breed/generate.hpp +++ b/sprout/breed/generate.hpp @@ -122,7 +122,7 @@ namespace sprout { struct basic_default_generator : public sprout::breed::use_basic_expr {}; - + // // generator // @@ -146,7 +146,7 @@ namespace sprout { template struct result { - public: + public: typedef Extends type; }; public: diff --git a/sprout/breed/tags.hpp b/sprout/breed/tags.hpp index f5c6a4e6..e2a4691e 100644 --- a/sprout/breed/tags.hpp +++ b/sprout/breed/tags.hpp @@ -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 diff --git a/sprout/breed/traits.hpp b/sprout/breed/traits.hpp index e6ceb9fc..c6b47e69 100644 --- a/sprout/breed/traits.hpp +++ b/sprout/breed/traits.hpp @@ -481,7 +481,7 @@ namespace sprout { N < sizeof...(Args), sprout::tppack_at, sprout::breed::detail::if_vararg::type> - >::type::type + >::type::type }; template struct impl @@ -519,7 +519,7 @@ namespace sprout { N < sizeof...(Args), sprout::tppack_at, sprout::breed::detail::if_vararg::type> - >::type::type + >::type::type }; template struct impl diff --git a/sprout/breed/transform/pass_through.hpp b/sprout/breed/transform/pass_through.hpp index 33bb62d1..33eb084b 100644 --- a/sprout/breed/transform/pass_through.hpp +++ b/sprout/breed/transform/pass_through.hpp @@ -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::type::template impl< - typename sprout::breed::result_of::child_c::type, - State, - Data - >::result_type... + typename sprout::breed::result_of::child_c::type, + State, + Data + >::result_type... > type; }; public: diff --git a/sprout/breed/transform/when.hpp b/sprout/breed/transform/when.hpp index 91b980a7..f4496191 100644 --- a/sprout/breed/transform/when.hpp +++ b/sprout/breed/transform/when.hpp @@ -93,7 +93,7 @@ namespace sprout { struct otherwise : public sprout::breed::when {}; - // + // // external_transforms // template diff --git a/sprout/compressed_pair.hpp b/sprout/compressed_pair.hpp index a9b9a0c6..90be8bc5 100644 --- a/sprout/compressed_pair.hpp +++ b/sprout/compressed_pair.hpp @@ -292,7 +292,7 @@ namespace sprout { } }; } // namespace detail - + // // compressed_pair // diff --git a/sprout/container/empty.hpp b/sprout/container/empty.hpp index 83e21def..fd28a630 100644 --- a/sprout/container/empty.hpp +++ b/sprout/container/empty.hpp @@ -10,7 +10,8 @@ namespace sprout { // empty // template - 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 diff --git a/sprout/container/size.hpp b/sprout/container/size.hpp index 4dc569eb..46b0d394 100644 --- a/sprout/container/size.hpp +++ b/sprout/container/size.hpp @@ -12,7 +12,8 @@ namespace sprout { // size // template - inline SPROUT_CONSTEXPR typename sprout::container_traits::difference_type size(Container const& cont) { + inline SPROUT_CONSTEXPR typename sprout::container_traits::difference_type + size(Container const& cont) { return NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), sprout::end(cont)); } } // namespace sprout diff --git a/sprout/detail/integer.hpp b/sprout/detail/integer.hpp index 3ed939ac..8435dac6 100644 --- a/sprout/detail/integer.hpp +++ b/sprout/detail/integer.hpp @@ -179,4 +179,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_DETAIL_INTEGER_HPP - diff --git a/sprout/detail/integer/integer_mask.hpp b/sprout/detail/integer/integer_mask.hpp index cd222cf6..5d0a5988 100644 --- a/sprout/detail/integer/integer_mask.hpp +++ b/sprout/detail/integer/integer_mask.hpp @@ -63,4 +63,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_DETAIL_INTEGER_INTEGER_MASK_HPP - diff --git a/sprout/functional/bind/bind.hpp b/sprout/functional/bind/bind.hpp index e7675d94..349e32a3 100644 --- a/sprout/functional/bind/bind.hpp +++ b/sprout/functional/bind/bind.hpp @@ -297,7 +297,7 @@ namespace sprout { SPROUT_CONSTEXPR Result call_cv(sprout::tuples::tuple&& args, sprout::index_tuple) const volatile { return f_(sprout::detail::mu()(sprout::detail::volget(bound_args_), args)...); } - public: + public: template explicit SPROUT_CONSTEXPR binder(Functor const& f, Args&&... args) : f_(f) diff --git a/sprout/functional/bit_and.hpp b/sprout/functional/bit_and.hpp index 21226b87..195a8e6c 100644 --- a/sprout/functional/bit_and.hpp +++ b/sprout/functional/bit_and.hpp @@ -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 diff --git a/sprout/functional/bit_not.hpp b/sprout/functional/bit_not.hpp index a843bf5d..c3f39558 100644 --- a/sprout/functional/bit_not.hpp +++ b/sprout/functional/bit_not.hpp @@ -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 diff --git a/sprout/functional/bit_or.hpp b/sprout/functional/bit_or.hpp index 30b3b036..e9cf3161 100644 --- a/sprout/functional/bit_or.hpp +++ b/sprout/functional/bit_or.hpp @@ -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 diff --git a/sprout/functional/bit_xor.hpp b/sprout/functional/bit_xor.hpp index 230e7cab..27a289af 100644 --- a/sprout/functional/bit_xor.hpp +++ b/sprout/functional/bit_xor.hpp @@ -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 diff --git a/sprout/functional/divides.hpp b/sprout/functional/divides.hpp index 5e727b72..9a72a4d7 100644 --- a/sprout/functional/divides.hpp +++ b/sprout/functional/divides.hpp @@ -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 diff --git a/sprout/functional/equal_to.hpp b/sprout/functional/equal_to.hpp index 699faa42..7a32974e 100644 --- a/sprout/functional/equal_to.hpp +++ b/sprout/functional/equal_to.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 diff --git a/sprout/functional/greater.hpp b/sprout/functional/greater.hpp index ad5bd6c7..5afe7294 100644 --- a/sprout/functional/greater.hpp +++ b/sprout/functional/greater.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 diff --git a/sprout/functional/greater_equal.hpp b/sprout/functional/greater_equal.hpp index 6ab2013c..7e4b8cbe 100644 --- a/sprout/functional/greater_equal.hpp +++ b/sprout/functional/greater_equal.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 diff --git a/sprout/functional/hash.hpp b/sprout/functional/hash.hpp index 15e78c93..f7f3c8c3 100644 --- a/sprout/functional/hash.hpp +++ b/sprout/functional/hash.hpp @@ -5,4 +5,3 @@ #include #endif // #ifndef SPROUT_FUNCTIONAL_HASH_HPP - diff --git a/sprout/functional/hash/array.hpp b/sprout/functional/hash/array.hpp index 17455476..65d9cac3 100644 --- a/sprout/functional/hash/array.hpp +++ b/sprout/functional/hash/array.hpp @@ -14,4 +14,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_HASH_ARRAY_HPP - diff --git a/sprout/functional/hash/hash.hpp b/sprout/functional/hash/hash.hpp index 46c3ff75..abb3a5c6 100644 --- a/sprout/functional/hash/hash.hpp +++ b/sprout/functional/hash/hash.hpp @@ -270,4 +270,3 @@ namespace sprout { } //namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_HASH_HASH_HPP - diff --git a/sprout/functional/hash/hash_fwd.hpp b/sprout/functional/hash/hash_fwd.hpp index 2f54e6a2..b37aa6f1 100644 --- a/sprout/functional/hash/hash_fwd.hpp +++ b/sprout/functional/hash/hash_fwd.hpp @@ -33,4 +33,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_HASH_HASH_FWD_HPP - diff --git a/sprout/functional/hash/sscrisk/cel/array.hpp b/sprout/functional/hash/sscrisk/cel/array.hpp index f311c9c2..9c5aef11 100644 --- a/sprout/functional/hash/sscrisk/cel/array.hpp +++ b/sprout/functional/hash/sscrisk/cel/array.hpp @@ -14,4 +14,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_HASH_SSCRISK_CEL_ARRAY_HPP - diff --git a/sprout/functional/hash/string.hpp b/sprout/functional/hash/string.hpp index 9557e27e..81cd2ff9 100644 --- a/sprout/functional/hash/string.hpp +++ b/sprout/functional/hash/string.hpp @@ -6,4 +6,3 @@ #include #endif // #ifndef SPROUT_FUNCTIONAL_HASH_STRING_HPP - diff --git a/sprout/functional/hash/sub_array.hpp b/sprout/functional/hash/sub_array.hpp index 9ab3ac86..8a883261 100644 --- a/sprout/functional/hash/sub_array.hpp +++ b/sprout/functional/hash/sub_array.hpp @@ -14,4 +14,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_HASH_SUB_ARRAY_HPP - diff --git a/sprout/functional/hash_fwd.hpp b/sprout/functional/hash_fwd.hpp index 904d7dd2..67eff2b9 100644 --- a/sprout/functional/hash_fwd.hpp +++ b/sprout/functional/hash_fwd.hpp @@ -5,4 +5,3 @@ #include #endif // #ifndef SPROUT_FUNCTIONAL_HASH_FWD_HPP - diff --git a/sprout/functional/less.hpp b/sprout/functional/less.hpp index 2cc33c8b..aa45d7d3 100644 --- a/sprout/functional/less.hpp +++ b/sprout/functional/less.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 diff --git a/sprout/functional/less_equal.hpp b/sprout/functional/less_equal.hpp index c15c06a6..a29cb9de 100644 --- a/sprout/functional/less_equal.hpp +++ b/sprout/functional/less_equal.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 diff --git a/sprout/functional/logical_and.hpp b/sprout/functional/logical_and.hpp index 449d0df4..021c0682 100644 --- a/sprout/functional/logical_and.hpp +++ b/sprout/functional/logical_and.hpp @@ -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 diff --git a/sprout/functional/logical_not.hpp b/sprout/functional/logical_not.hpp index c802837d..5e717a02 100644 --- a/sprout/functional/logical_not.hpp +++ b/sprout/functional/logical_not.hpp @@ -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 diff --git a/sprout/functional/logical_or.hpp b/sprout/functional/logical_or.hpp index 79479b4e..f0e0045c 100644 --- a/sprout/functional/logical_or.hpp +++ b/sprout/functional/logical_or.hpp @@ -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 diff --git a/sprout/functional/minus.hpp b/sprout/functional/minus.hpp index a6a2d80d..8c219d60 100644 --- a/sprout/functional/minus.hpp +++ b/sprout/functional/minus.hpp @@ -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 diff --git a/sprout/functional/modulus.hpp b/sprout/functional/modulus.hpp index 1f36e9f9..5a6decb5 100644 --- a/sprout/functional/modulus.hpp +++ b/sprout/functional/modulus.hpp @@ -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 diff --git a/sprout/functional/multiplies.hpp b/sprout/functional/multiplies.hpp index ed58af1f..d91988cd 100644 --- a/sprout/functional/multiplies.hpp +++ b/sprout/functional/multiplies.hpp @@ -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 diff --git a/sprout/functional/negate.hpp b/sprout/functional/negate.hpp index 3eb59d2d..c0d59868 100644 --- a/sprout/functional/negate.hpp +++ b/sprout/functional/negate.hpp @@ -14,7 +14,7 @@ namespace sprout { typedef T result_type; public: SPROUT_CONSTEXPR T operator()(T const& x) const { - return -x; + return -x; } }; } // namespace sprout diff --git a/sprout/functional/not_equal_to.hpp b/sprout/functional/not_equal_to.hpp index 9263296b..bfb4ec6d 100644 --- a/sprout/functional/not_equal_to.hpp +++ b/sprout/functional/not_equal_to.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 diff --git a/sprout/functional/ref.hpp b/sprout/functional/ref.hpp index 5d221353..5e1be6e5 100644 --- a/sprout/functional/ref.hpp +++ b/sprout/functional/ref.hpp @@ -34,7 +34,7 @@ namespace sprout { typedef typename T::first_argument_type first_argument_type; typedef typename T::second_argument_type second_argument_type; }; - template + template struct reference_wrapper_base_impl : public sprout::weak_result_type { @@ -152,9 +152,9 @@ namespace sprout { SPROUT_CONSTEXPR T& get() const SPROUT_NOEXCEPT { return *t_; } - SPROUT_CONSTEXPR T* get_pointer() const SPROUT_NOEXCEPT { - return t_; - } + SPROUT_CONSTEXPR T* get_pointer() const SPROUT_NOEXCEPT { + return t_; + } // invocation template SPROUT_CONSTEXPR typename std::result_of::type diff --git a/sprout/integer/bit_length.hpp b/sprout/integer/bit_length.hpp index c415e818..87d95644 100644 --- a/sprout/integer/bit_length.hpp +++ b/sprout/integer/bit_length.hpp @@ -27,7 +27,7 @@ namespace sprout { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }; - template + template struct bit_len { private: SPROUT_STATIC_CONSTEXPR std::size_t next_size = Size - 1; diff --git a/sprout/integer/bit_reverse.hpp b/sprout/integer/bit_reverse.hpp index 2367cbe3..00cc0450 100644 --- a/sprout/integer/bit_reverse.hpp +++ b/sprout/integer/bit_reverse.hpp @@ -24,7 +24,7 @@ namespace sprout { 59, 187, 123, 251, 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255 }; - template + template struct bit_rev { private: SPROUT_STATIC_CONSTEXPR std::size_t next_size = Size / 2; diff --git a/sprout/io.hpp b/sprout/io.hpp index 0ca5d572..97d5e5f8 100644 --- a/sprout/io.hpp +++ b/sprout/io.hpp @@ -24,7 +24,7 @@ namespace sprout { // // fmtflags // - enum fmtflags { + enum fmtflags { boolalpha = 1L << 0, showbase = 1L << 1, showpoint = 1L << 2, diff --git a/sprout/iterator/size_enum_iterator.hpp b/sprout/iterator/size_enum_iterator.hpp new file mode 100644 index 00000000..93713566 --- /dev/null +++ b/sprout/iterator/size_enum_iterator.hpp @@ -0,0 +1,447 @@ +#ifndef SPROUT_ITERATOR_SIZE_ENUM_ITERATOR_HPP +#define SPROUT_ITERATOR_SIZE_ENUM_ITERATOR_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sprout { + // + // size_enum_iterator + // + template + class size_enum_iterator + : public std::iterator< + typename std::iterator_traits::iterator_category, + typename sprout::container_traits< + typename std::iterator_traits::value_type + >::difference_type, + typename std::iterator_traits::difference_type, + typename sprout::container_traits< + typename std::iterator_traits::value_type + >::difference_type*, + typename sprout::container_traits< + typename std::iterator_traits::value_type + >::difference_type + > + { + public: + typedef Iterator iterator_type; + typedef typename std::iterator_traits::iterator_category iterator_category; + typedef typename sprout::container_traits< + typename std::iterator_traits::value_type + >::difference_type value_type; + typedef value_type reference; + typedef typename std::iterator_traits::difference_type difference_type; + typedef value_type* pointer; + protected: + iterator_type current; + public: + size_enum_iterator() = default; + size_enum_iterator(size_enum_iterator const&) = default; + explicit SPROUT_CONSTEXPR size_enum_iterator(iterator_type it) + : current(it) + {} + template + SPROUT_CONSTEXPR size_enum_iterator(size_enum_iterator const& it) + : current(it.current) + {} + template + size_enum_iterator& operator=(size_enum_iterator const& it) { + size_enum_iterator temp(it); + temp.swap(*this); + return *this; + } + SPROUT_CONSTEXPR iterator_type base() const { + return current; + } + SPROUT_CONSTEXPR bool is_separator() const { + return false; + } + SPROUT_CONSTEXPR reference operator*() const { + return sprout::size(*current); + } + SPROUT_CONSTEXPR pointer operator->() const { + return &sprout::size(*current); + } + size_enum_iterator& operator++() { + ++current; + return *this; + } + size_enum_iterator operator++(int) { + size_enum_iterator result(*this); + ++current; + return result; + } + size_enum_iterator& operator--() { + --current; + return *this; + } + size_enum_iterator operator--(int) { + size_enum_iterator temp(*this); + --current; + return temp; + } + SPROUT_CONSTEXPR size_enum_iterator operator+(difference_type n) const { + return size_enum_iterator(current + n); + } + SPROUT_CONSTEXPR size_enum_iterator operator-(difference_type n) const { + return size_enum_iterator(current - n); + } + size_enum_iterator& operator+=(difference_type n) { + size_enum_iterator temp(current + n); + temp.swap(*this); + return *this; + } + size_enum_iterator& operator-=(difference_type n) { + size_enum_iterator temp(current - n); + temp.swap(*this); + return *this; + } + SPROUT_CONSTEXPR reference operator[](difference_type n) const { + return sprout::size(current[n]); + } + SPROUT_CONSTEXPR size_enum_iterator next() const { + return size_enum_iterator(sprout::next(current)); + } + SPROUT_CONSTEXPR size_enum_iterator prev() const { + return size_enum_iterator(sprout::prev(current)); + } + void swap(size_enum_iterator& other) { + using std::swap; + swap(current, other.current); + } + }; + + // + // size_enum_iterator + // + template + class size_enum_iterator + : public std::iterator< + typename std::iterator_traits::iterator_category, + typename sprout::container_traits< + typename std::iterator_traits::value_type + >::difference_type, + typename std::iterator_traits::difference_type, + typename sprout::container_traits< + typename std::iterator_traits::value_type + >::difference_type*, + typename sprout::container_traits< + typename std::iterator_traits::value_type + >::difference_type + > + { + public: + typedef Iterator iterator_type; + typedef typename std::iterator_traits::iterator_category iterator_category; + typedef typename sprout::container_traits< + typename std::iterator_traits::value_type + >::difference_type value_type; + typedef value_type reference; + typedef typename std::iterator_traits::difference_type difference_type; + typedef value_type* pointer; + protected: + iterator_type current; + value_type sep_size; + bool is_sep; + public: + size_enum_iterator() = default; + size_enum_iterator(size_enum_iterator const&) = default; + explicit SPROUT_CONSTEXPR size_enum_iterator(iterator_type it, value_type size = 0, bool sep = false) + : current(it) + , sep_size(size) + , is_sep(sep) + {} + template + SPROUT_CONSTEXPR size_enum_iterator(size_enum_iterator const& it) + : current(it.current) + , sep_size(it.sep_size) + , is_sep(it.is_sep) + {} + template + size_enum_iterator& operator=(size_enum_iterator const& it) { + size_enum_iterator temp(it); + temp.swap(*this); + return *this; + } + SPROUT_CONSTEXPR iterator_type base() const { + return current; + } + SPROUT_CONSTEXPR value_type separator_size() const { + return sep_size; + } + SPROUT_CONSTEXPR bool is_separator() const { + return is_sep; + } + SPROUT_CONSTEXPR reference operator*() const { + return is_sep ? sep_size : sprout::size(*current); + } + SPROUT_CONSTEXPR pointer operator->() const { + return &(is_sep ? sep_size : sprout::size(*current)); + } + size_enum_iterator& operator++() { + if (is_sep) { + ++current; + is_sep = false; + } else { + is_sep = true; + } + return *this; + } + size_enum_iterator operator++(int) { + size_enum_iterator result(*this); + if (is_sep) { + ++current; + is_sep = false; + } else { + is_sep = true; + } + return result; + } + size_enum_iterator& operator--() { + if (is_sep) { + is_sep = false; + } else { + --current; + is_sep = true; + } + return *this; + } + size_enum_iterator operator--(int) { + size_enum_iterator temp(*this); + if (is_sep) { + is_sep = false; + } else { + --current; + is_sep = true; + } + return temp; + } + SPROUT_CONSTEXPR size_enum_iterator operator+(difference_type n) const { + return size_enum_iterator(current + (n + is_sep) / 2, sep_size, (n + is_sep) % 2); + } + SPROUT_CONSTEXPR size_enum_iterator operator-(difference_type n) const { + return size_enum_iterator(current - (n - is_sep) / 2, sep_size, (n - is_sep) % 2); + } + size_enum_iterator& operator+=(difference_type n) { + size_enum_iterator temp(current + (n + is_sep) / 2, sep_size, (n + is_sep) % 2); + temp.swap(*this); + return *this; + } + size_enum_iterator& operator-=(difference_type n) { + size_enum_iterator temp(current - (n - is_sep) / 2, sep_size, (n - is_sep) % 2); + temp.swap(*this); + return *this; + } + SPROUT_CONSTEXPR reference operator[](difference_type n) const { + return sprout::size(current[(n + is_sep) / 2]); + } + SPROUT_CONSTEXPR size_enum_iterator next() const { + return is_sep + ? size_enum_iterator(sprout::next(current), sep_size, false) + : size_enum_iterator(current, sep_size, true) + ; + } + SPROUT_CONSTEXPR size_enum_iterator prev() const { + return is_sep + ? size_enum_iterator(current, sep_size, false) + : size_enum_iterator(sprout::prev(current), sep_size, true) + ; + } + void swap(size_enum_iterator& other) { + using std::swap; + swap(current, other.current); + swap(sep_size, other.sep_size); + swap(is_sep, other.is_sep); + } + }; + + template< + typename Iterator1, bool Separated1, + typename Iterator2, bool Separated2 + > + SPROUT_CONSTEXPR bool operator==( + sprout::size_enum_iterator const& lhs, + sprout::size_enum_iterator const& rhs + ) + { + return lhs.base() == rhs.base() && lhs.is_separator() == rhs.is_separator(); + } + template< + typename Iterator1, bool Separated1, + typename Iterator2, bool Separated2 + > + SPROUT_CONSTEXPR bool operator!=( + sprout::size_enum_iterator const& lhs, + sprout::size_enum_iterator const& rhs + ) + { + return !(lhs == rhs); + } + template< + typename Iterator1, bool Separated1, + typename Iterator2, bool Separated2 + > + SPROUT_CONSTEXPR bool operator<( + sprout::size_enum_iterator const& lhs, + sprout::size_enum_iterator const& rhs + ) + { + return lhs.base() < rhs.base() + || (lhs.base() == rhs.base() && !lhs.is_separator() && rhs.is_separator()) + ; + } + template< + typename Iterator1, bool Separated1, + typename Iterator2, bool Separated2 + > + SPROUT_CONSTEXPR bool operator>( + sprout::size_enum_iterator const& lhs, + sprout::size_enum_iterator const& rhs + ) + { + return rhs < lhs; + } + template< + typename Iterator1, bool Separated1, + typename Iterator2, bool Separated2 + > + SPROUT_CONSTEXPR bool operator<=( + sprout::size_enum_iterator const& lhs, + sprout::size_enum_iterator const& rhs + ) + { + return !(rhs < lhs); + } + template< + typename Iterator1, bool Separated1, + typename Iterator2, bool Separated2 + > + SPROUT_CONSTEXPR bool operator>=( + sprout::size_enum_iterator const& lhs, + sprout::size_enum_iterator const& rhs + ) + { + return !(lhs < rhs); + } + template + SPROUT_CONSTEXPR decltype(std::declval() - std::declval()) operator-( + sprout::size_enum_iterator const& lhs, + sprout::size_enum_iterator const& rhs + ) + { + return lhs.base() - rhs.base(); + } + template + SPROUT_CONSTEXPR decltype(std::declval() - std::declval()) operator-( + sprout::size_enum_iterator const& lhs, + sprout::size_enum_iterator const& rhs + ) + { + return lhs.base() - rhs.base() + ( + lhs.is_separator() + ? rhs.is_separator() ? 0 : -1 + : rhs.is_separator() ? 1 : 0 + ) + ; + } + template + SPROUT_CONSTEXPR sprout::size_enum_iterator operator+( + typename sprout::size_enum_iterator::difference_type n, + sprout::size_enum_iterator const& it + ) + { + return it + n; + } + + // + // make_size_enum_iterator + // + template + SPROUT_CONSTEXPR sprout::size_enum_iterator + make_size_enum_iterator(Iterator it) { + return sprout::size_enum_iterator(it); + } + template + SPROUT_CONSTEXPR sprout::size_enum_iterator + make_size_enum_iterator( + Iterator it, + typename sprout::size_enum_iterator::value_type sep_size, + bool sep = false + ) + { + return sprout::size_enum_iterator(it, sep_size, sep); + } + + // + // swap + // + template + void swap( + sprout::size_enum_iterator& lhs, + sprout::size_enum_iterator& rhs + ) + SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) + { + lhs.swap(rhs); + } + + // + // next + // + template + SPROUT_CONSTEXPR sprout::size_enum_iterator next( + sprout::size_enum_iterator const& it + ) + { + return it.next(); + } + template + SPROUT_CONSTEXPR sprout::size_enum_iterator next( + sprout::size_enum_iterator const& it, + typename sprout::size_enum_iterator::difference_type n + ) + { + return it + n; + } + + // + // prev + // + template + SPROUT_CONSTEXPR sprout::size_enum_iterator prev( + sprout::size_enum_iterator const& it + ) + { + return it.prev(); + } + template + SPROUT_CONSTEXPR sprout::size_enum_iterator prev( + sprout::size_enum_iterator const& it, + typename sprout::size_enum_iterator::difference_type n + ) + { + return it - n; + } + + // + // distance + // + template + SPROUT_CONSTEXPR typename std::iterator_traits >::difference_type + distance( + sprout::size_enum_iterator first, + sprout::size_enum_iterator last + ) + { + return last - first; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ITERATOR_SIZE_ENUM_ITERATOR_HPP diff --git a/sprout/iterator/traits.hpp b/sprout/iterator/traits.hpp new file mode 100644 index 00000000..2227d856 --- /dev/null +++ b/sprout/iterator/traits.hpp @@ -0,0 +1,143 @@ +#ifndef SPROUT_ITERATOR_TRAITS_HPP +#define SPROUT_ITERATOR_TRAITS_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace detail { + // has_iterator_category + SPROUT_HAS_XXX_TYPE_DEF_LAZY(iterator_category); + } // namespace detail + // + // is_iterator + // + template + struct is_iterator + : sprout::detail::has_iterator_category > + {}; + + namespace detail { + template + struct is_input_iterator_impl + : std::false_type + {}; + template + struct is_input_iterator_impl< + Iterator, + typename std::enable_if::value>::type + > + : std::is_convertible< + typename std::iterator_traits::iterator_category, + std::input_iterator_tag + > + {}; + } // namespace detail + // + // is_input_iterator + // + template + struct is_input_iterator + : sprout::detail::is_input_iterator_impl + {}; + + namespace detail { + template + struct is_output_iterator_impl + : std::false_type + {}; + template + struct is_output_iterator_impl< + Iterator, + typename std::enable_if::value>::type + > + : std::is_convertible< + typename std::iterator_traits::iterator_category, + std::output_iterator_tag + > + {}; + } // namespace detail + // + // is_output_iterator + // + template + struct is_output_iterator + : sprout::detail::is_output_iterator_impl + {}; + + namespace detail { + template + struct is_forward_iterator_impl + : std::false_type + {}; + template + struct is_forward_iterator_impl< + Iterator, + typename std::enable_if::value>::type + > + : std::is_convertible< + typename std::iterator_traits::iterator_category, + std::forward_iterator_tag + > + {}; + } // namespace detail + // + // is_forward_iterator + // + template + struct is_forward_iterator + : sprout::detail::is_forward_iterator_impl + {}; + + namespace detail { + template + struct is_bidirectional_iterator_impl + : std::false_type + {}; + template + struct is_bidirectional_iterator_impl< + Iterator, + typename std::enable_if::value>::type + > + : std::is_convertible< + typename std::iterator_traits::iterator_category, + std::bidirectional_iterator_tag + > + {}; + } // namespace detail + // + // is_bidirectional_iterator + // + template + struct is_bidirectional_iterator + : sprout::detail::is_bidirectional_iterator_impl + {}; + + namespace detail { + template + struct is_random_access_iterator_impl + : std::false_type + {}; + template + struct is_random_access_iterator_impl< + Iterator, + typename std::enable_if::value>::type + > + : std::is_convertible< + typename std::iterator_traits::iterator_category, + std::random_access_iterator_tag + > + {}; + } // namespace detail + // + // is_random_access_iterator + // + template + struct is_random_access_iterator + : sprout::detail::is_random_access_iterator_impl + {}; +} // namespace sprout + +#endif // #ifndef SPROUT_ITERATOR_TRAITS_HPP diff --git a/sprout/numeric/fft.hpp b/sprout/numeric/fft.hpp index 1ca74e43..41d6565b 100644 --- a/sprout/numeric/fft.hpp +++ b/sprout/numeric/fft.hpp @@ -5,4 +5,3 @@ #include #endif // #ifndef SPROUT_NUMERIC_FFT_HPP - diff --git a/sprout/numeric/fft/fixed/bitrev_table.hpp b/sprout/numeric/fft/fixed/bitrev_table.hpp index c8c1d138..7cd7a755 100644 --- a/sprout/numeric/fft/fixed/bitrev_table.hpp +++ b/sprout/numeric/fft/fixed/bitrev_table.hpp @@ -13,8 +13,8 @@ #include namespace sprout { - namespace fixed { - namespace detail { + namespace fixed { + namespace detail { template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type bitrev_table_impl( Container const& cont, diff --git a/sprout/preprocessor/cat.hpp b/sprout/preprocessor/cat.hpp index 5407673c..6f014441 100644 --- a/sprout/preprocessor/cat.hpp +++ b/sprout/preprocessor/cat.hpp @@ -10,4 +10,3 @@ #define SPROUT_PP_CAT_I(a, b) a ## b #endif // #ifndef SPROUT_PREPROCESSOR_CAT_HPP - diff --git a/sprout/preprocessor/empty.hpp b/sprout/preprocessor/empty.hpp index 5a2b87e1..4de96c19 100644 --- a/sprout/preprocessor/empty.hpp +++ b/sprout/preprocessor/empty.hpp @@ -9,4 +9,3 @@ #define SPROUT_PP_EMPTY() #endif // #ifndef SPROUT_PREPROCESSOR_EMPTY_HPP - diff --git a/sprout/preprocessor/str_all.hpp b/sprout/preprocessor/str_all.hpp index f1df72d9..fc149f8f 100644 --- a/sprout/preprocessor/str_all.hpp +++ b/sprout/preprocessor/str_all.hpp @@ -7,4 +7,3 @@ #include #endif // #ifndef SPROUT_PREPROCESSOR_STR_ALL_HPP - diff --git a/sprout/preprocessor/stringize.hpp b/sprout/preprocessor/stringize.hpp index aaf2baf6..e59d1635 100644 --- a/sprout/preprocessor/stringize.hpp +++ b/sprout/preprocessor/stringize.hpp @@ -10,4 +10,3 @@ #define SPROUT_PP_STRINGIZE_I(text) #text #endif // #ifndef SPROUT_PREPROCESSOR_STRINGIZE_HPP - diff --git a/sprout/preprocessor/stringize_all.hpp b/sprout/preprocessor/stringize_all.hpp index fec94629..e911b9f8 100644 --- a/sprout/preprocessor/stringize_all.hpp +++ b/sprout/preprocessor/stringize_all.hpp @@ -8,4 +8,3 @@ #include #endif // #ifndef SPROUT_PREPROCESSOR_STRINGIZE_ALL_HPP - diff --git a/sprout/preprocessor/u16str.hpp b/sprout/preprocessor/u16str.hpp index b0993355..e2d34150 100644 --- a/sprout/preprocessor/u16str.hpp +++ b/sprout/preprocessor/u16str.hpp @@ -10,4 +10,3 @@ #define SPROUT_PP_U16STR_I(str) u ## str #endif // #ifndef SPROUT_PREPROCESSOR_U16STR_HPP - diff --git a/sprout/preprocessor/u16stringize.hpp b/sprout/preprocessor/u16stringize.hpp index 74bcd29f..ce611557 100644 --- a/sprout/preprocessor/u16stringize.hpp +++ b/sprout/preprocessor/u16stringize.hpp @@ -11,4 +11,3 @@ #define SPROUT_PP_U16STRINGIZE_II(str) u ## str #endif // #ifndef SPROUT_PREPROCESSOR_U16STRINGIZE_HPP - diff --git a/sprout/preprocessor/u32str.hpp b/sprout/preprocessor/u32str.hpp index 6b1f651c..7203ab23 100644 --- a/sprout/preprocessor/u32str.hpp +++ b/sprout/preprocessor/u32str.hpp @@ -10,4 +10,3 @@ #define SPROUT_PP_U32STR_I(str) U ## str #endif // #ifndef SPROUT_PREPROCESSOR_U32STR_HPP - diff --git a/sprout/preprocessor/u32stringize.hpp b/sprout/preprocessor/u32stringize.hpp index 45ca28c8..124fe5a4 100644 --- a/sprout/preprocessor/u32stringize.hpp +++ b/sprout/preprocessor/u32stringize.hpp @@ -11,4 +11,3 @@ #define SPROUT_PP_U32STRINGIZE_II(str) U ## str #endif // #ifndef SPROUT_PREPROCESSOR_U32STRINGIZE_HPP - diff --git a/sprout/preprocessor/unique_string.hpp b/sprout/preprocessor/unique_string.hpp index 0fd16a65..0ab52e21 100644 --- a/sprout/preprocessor/unique_string.hpp +++ b/sprout/preprocessor/unique_string.hpp @@ -20,4 +20,3 @@ SPROUT_PP_U32STR(" : ") SPROUT_PP_U32STR(__FILE__) SPROUT_PP_U32STR(":") SPROUT_PP_U32STRINGIZE(__LINE__) #endif // #ifndef SPROUT_PREPROCESSOR_UNIQUE_STRING_HPP - diff --git a/sprout/preprocessor/wstr.hpp b/sprout/preprocessor/wstr.hpp index e51f1ac6..dc238996 100644 --- a/sprout/preprocessor/wstr.hpp +++ b/sprout/preprocessor/wstr.hpp @@ -10,4 +10,3 @@ #define SPROUT_PP_WSTR_I(str) L ## str #endif // #ifndef SPROUT_PREPROCESSOR_WSTR_HPP - diff --git a/sprout/preprocessor/wstringize.hpp b/sprout/preprocessor/wstringize.hpp index 6fb48039..a66115a9 100644 --- a/sprout/preprocessor/wstringize.hpp +++ b/sprout/preprocessor/wstringize.hpp @@ -11,4 +11,3 @@ #define SPROUT_PP_WSTRINGIZE_II(str) L ## str #endif // #ifndef SPROUT_PREPROCESSOR_WSTRINGIZE_HPP - diff --git a/sprout/random/bernoulli_distribution.hpp b/sprout/random/bernoulli_distribution.hpp index a082d57e..998fc85b 100644 --- a/sprout/random/bernoulli_distribution.hpp +++ b/sprout/random/bernoulli_distribution.hpp @@ -159,4 +159,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_BERNOULLI_DISTRIBUTION_HPP - diff --git a/sprout/random/binomial_distribution.hpp b/sprout/random/binomial_distribution.hpp index 33cbe33d..3a9553d9 100644 --- a/sprout/random/binomial_distribution.hpp +++ b/sprout/random/binomial_distribution.hpp @@ -447,4 +447,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_BINOMIAL_DISTRIBUTION_HPP - diff --git a/sprout/random/detail/const_mod.hpp b/sprout/random/detail/const_mod.hpp index e807fbf7..5fff6c19 100644 --- a/sprout/random/detail/const_mod.hpp +++ b/sprout/random/detail/const_mod.hpp @@ -131,4 +131,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_DETAIL_CONST_MOD_HPP - diff --git a/sprout/random/detail/generator_bits.hpp b/sprout/random/detail/generator_bits.hpp index 1c2a4058..15feebdd 100644 --- a/sprout/random/detail/generator_bits.hpp +++ b/sprout/random/detail/generator_bits.hpp @@ -20,4 +20,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_DETAIL_GENERATOR_BITS_HPP - diff --git a/sprout/random/detail/ptr_helper.hpp b/sprout/random/detail/ptr_helper.hpp index 16436bb9..45e7c6fa 100644 --- a/sprout/random/detail/ptr_helper.hpp +++ b/sprout/random/detail/ptr_helper.hpp @@ -70,4 +70,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_DETAIL_PTR_HELPER_HPP - diff --git a/sprout/random/detail/signed_unsigned_tools.hpp b/sprout/random/detail/signed_unsigned_tools.hpp index 85b16f7d..71a030dc 100644 --- a/sprout/random/detail/signed_unsigned_tools.hpp +++ b/sprout/random/detail/signed_unsigned_tools.hpp @@ -60,4 +60,3 @@ namespace sprout { } // namespace sprout #endif // SPROUT_RANDOM_DETAIL_SIGNED_UNSIGNED_TOOLS_HPP - diff --git a/sprout/random/detail/uniform_int_float.hpp b/sprout/random/detail/uniform_int_float.hpp index 6670ff51..687d3422 100644 --- a/sprout/random/detail/uniform_int_float.hpp +++ b/sprout/random/detail/uniform_int_float.hpp @@ -71,4 +71,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP - diff --git a/sprout/random/mersenne_twister.hpp b/sprout/random/mersenne_twister.hpp index 53f55d61..14302e18 100644 --- a/sprout/random/mersenne_twister.hpp +++ b/sprout/random/mersenne_twister.hpp @@ -466,4 +466,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_MERSENNE_TWISTER_HPP - diff --git a/sprout/random/random_iterator.hpp b/sprout/random/random_iterator.hpp index 88c010ab..3f12e784 100644 --- a/sprout/random/random_iterator.hpp +++ b/sprout/random/random_iterator.hpp @@ -323,4 +323,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_RANDOM_ITERATOR_HPP - diff --git a/sprout/random/random_result.hpp b/sprout/random/random_result.hpp index f2814ae4..68effe59 100644 --- a/sprout/random/random_result.hpp +++ b/sprout/random/random_result.hpp @@ -260,4 +260,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_RANDOM_RESULT_HPP - diff --git a/sprout/random/uniform_01.hpp b/sprout/random/uniform_01.hpp index a43447bd..8d7a7108 100644 --- a/sprout/random/uniform_01.hpp +++ b/sprout/random/uniform_01.hpp @@ -129,4 +129,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_UNIFORM_01_HPP - diff --git a/sprout/random/uniform_int_distribution.hpp b/sprout/random/uniform_int_distribution.hpp index 954ae0f5..74334442 100644 --- a/sprout/random/uniform_int_distribution.hpp +++ b/sprout/random/uniform_int_distribution.hpp @@ -543,4 +543,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP - diff --git a/sprout/random/uniform_real_distribution.hpp b/sprout/random/uniform_real_distribution.hpp index 35e1e95d..9c685d12 100644 --- a/sprout/random/uniform_real_distribution.hpp +++ b/sprout/random/uniform_real_distribution.hpp @@ -335,4 +335,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_UNIFORM_REAL_DISTRIBUTION_HPP - diff --git a/sprout/random/uniform_smallint.hpp b/sprout/random/uniform_smallint.hpp index 18db9f36..ad631c67 100644 --- a/sprout/random/uniform_smallint.hpp +++ b/sprout/random/uniform_smallint.hpp @@ -271,4 +271,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_UNIFORM_SMALLINT_HPP - diff --git a/sprout/random/unique_seed.hpp b/sprout/random/unique_seed.hpp index 5d9956c1..74f13429 100644 --- a/sprout/random/unique_seed.hpp +++ b/sprout/random/unique_seed.hpp @@ -53,4 +53,3 @@ namespace sprout { #define SPROUT_UNIQUE_SEED_SEQ(N) (::sprout::make_seed_seq(SPROUT_PP_UNIQUE_STRING)) #endif // #ifndef SPROUT_RANDOM_UNIQUE_SEED_HPP - diff --git a/sprout/random/variate_generator.hpp b/sprout/random/variate_generator.hpp index 8929486c..23dc9f8b 100644 --- a/sprout/random/variate_generator.hpp +++ b/sprout/random/variate_generator.hpp @@ -80,4 +80,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_RANDOM_VARIATE_GENERATOR_HPP - diff --git a/sprout/range/adaptor/copied.hpp b/sprout/range/adaptor/copied.hpp index f38af518..c36342c0 100644 --- a/sprout/range/adaptor/copied.hpp +++ b/sprout/range/adaptor/copied.hpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -33,7 +32,6 @@ namespace sprout { typedef sprout::range::range_container< typename sprout::container_traits::iterator > base_type; - typedef typename base_type::iterator iterator; public: copied_range() = default; copied_range(copied_range const&) = default; @@ -92,7 +90,7 @@ namespace sprout { // operator| // template - SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm >::type + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm >::type operator|(Range&& lhs, sprout::adaptors::copy_holder const& rhs) { return sprout::range::fixed::copy(sprout::lvalue_forward(lhs), sprout::pit()); } diff --git a/sprout/range/adaptor/size_enumed.hpp b/sprout/range/adaptor/size_enumed.hpp new file mode 100644 index 00000000..db0c2054 --- /dev/null +++ b/sprout/range/adaptor/size_enumed.hpp @@ -0,0 +1,191 @@ +#ifndef SPROUT_RANGE_ADAPTOR_SIZE_ENUMED_HPP +#define SPROUT_RANGE_ADAPTOR_SIZE_ENUMED_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace adaptors { + // + // size_enumed_range + // + template + class size_enumed_range + : public sprout::range::range_container< + sprout::size_enum_iterator< + typename sprout::container_traits::iterator + > + > + , public sprout::detail::container_nosy_static_size + , public sprout::detail::container_nosy_fixed_size + { + public: + typedef Range range_type; + typedef sprout::range::range_container< + sprout::size_enum_iterator< + typename sprout::container_traits::iterator + > + > base_type; + typedef typename base_type::iterator iterator; + public: + size_enumed_range() = default; + size_enumed_range(size_enumed_range const&) = default; + explicit SPROUT_CONSTEXPR size_enumed_range(range_type& range) + : base_type( + iterator(sprout::begin(range)), + iterator(sprout::end(range)) + ) + {} + }; + + template + class size_enumed_range + : public sprout::range::range_container< + sprout::size_enum_iterator< + typename sprout::container_traits::iterator, true + > + > + , public sprout::detail::container_nosy_static_size + , public sprout::detail::container_nosy_fixed_size + { + public: + typedef Range range_type; + typedef sprout::range::range_container< + sprout::size_enum_iterator< + typename sprout::container_traits::iterator, true + > + > base_type; + typedef typename base_type::iterator iterator; + typedef typename base_type::value_type value_type; + public: + size_enumed_range() = default; + size_enumed_range(size_enumed_range const&) = default; + explicit SPROUT_CONSTEXPR size_enumed_range( + range_type& range, + value_type sep_size = 0, + bool omit_last = false + ) + : base_type( + iterator(sprout::begin(range), sep_size), + omit_last + ? sprout::empty(range) + ? iterator(sprout::end(range), sep_size) + : iterator(sprout::prev(sprout::end(range)), sep_size, true) + : iterator(sprout::end(range), sep_size) + ) + {} + }; + + // + // size_enum_holder + // + template + class size_enum_holder { + public: + typedef Size size_type; + private: + size_type sep_size_; + bool omit_last_; + public: + size_enum_holder() = default; + size_enum_holder(size_enum_holder const&) = default; + explicit SPROUT_CONSTEXPR size_enum_holder(size_type size, bool omit_last = false) + : sep_size_(size) + , omit_last_(omit_last) + {} + SPROUT_CONSTEXPR size_type separator_size() const { + return sep_size_; + } + SPROUT_CONSTEXPR bool omit_last() const { + return omit_last_; + } + }; + + // + // size_enumed_forwarder + // + class size_enumed_forwarder { + public: + template + SPROUT_CONSTEXPR typename sprout::adaptors::size_enum_holder + operator()(Size size, bool omit_last = false) { + return typename sprout::adaptors::size_enum_holder(size, omit_last); + } + }; + + // + // size_enumed + // + namespace { + SPROUT_STATIC_CONSTEXPR sprout::adaptors::size_enumed_forwarder size_enumed{}; + } // anonymous-namespace + + // + // operator| + // + template + inline SPROUT_CONSTEXPR sprout::adaptors::size_enumed_range< + typename std::remove_reference::type>::type, + true + > + operator|(Range&& lhs, sprout::adaptors::size_enum_holder const& rhs) { + return sprout::adaptors::size_enumed_range< + typename std::remove_reference::type>::type, + true + >( + sprout::lvalue_forward(lhs), + rhs.separator_size(), + rhs.omit_last() + ); + } + template + inline SPROUT_CONSTEXPR sprout::adaptors::size_enumed_range< + typename std::remove_reference::type>::type + > + operator|(Range&& lhs, sprout::adaptors::size_enumed_forwarder const& rhs) { + return sprout::adaptors::size_enumed_range< + typename std::remove_reference::type>::type + >( + sprout::lvalue_forward(lhs) + ); + } + } // namespace adaptors + + // + // container_construct_traits + // + template + struct container_construct_traits > { + public: + typedef typename sprout::container_construct_traits::copied_type copied_type; + public: + template + static SPROUT_CONSTEXPR copied_type deep_copy(Cont&& cont) { + return sprout::range::fixed::copy(sprout::forward(cont), sprout::pit()); + } + template + static SPROUT_CONSTEXPR copied_type make(Args&&... args) { + return sprout::make(sprout::forward(args)...); + } + template + static SPROUT_CONSTEXPR copied_type remake( + Cont&& cont, + typename sprout::container_traits >::difference_type size, + Args&&... args + ) + { + return sprout::remake(sprout::forward(cont), size, sprout::forward(args)...); + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ADAPTOR_SIZE_ENUMED_HPP diff --git a/sprout/range/adaptor/transformed.hpp b/sprout/range/adaptor/transformed.hpp index 310a7530..d984a5fb 100644 --- a/sprout/range/adaptor/transformed.hpp +++ b/sprout/range/adaptor/transformed.hpp @@ -23,7 +23,7 @@ namespace sprout { class transformed_range : public sprout::range::range_container< sprout::transform_iterator< - BinaryFunction, + BinaryFunction, typename sprout::container_traits::iterator, typename sprout::container_traits::iterator > @@ -37,7 +37,7 @@ namespace sprout { typedef RRange range2_type; typedef sprout::range::range_container< sprout::transform_iterator< - BinaryFunction, + BinaryFunction, typename sprout::container_traits::iterator, typename sprout::container_traits::iterator > @@ -45,8 +45,8 @@ namespace sprout { typedef typename base_type::iterator iterator; typedef typename base_type::size_type size_type; public: - transformed_range() = default; - transformed_range(transformed_range const&) = default; + SPROUT_CONSTEXPR transformed_range() = default; + SPROUT_CONSTEXPR transformed_range(transformed_range const&) = default; SPROUT_CONSTEXPR transformed_range(functor_type func, range_type& range1, range2_type& range2) : base_type( iterator(sprout::begin(range1), sprout::begin(range2), func), @@ -59,7 +59,7 @@ namespace sprout { class transformed_range : public sprout::range::range_container< sprout::transform_iterator< - UnaryFunction, + UnaryFunction, typename sprout::container_traits::iterator > > @@ -71,14 +71,14 @@ namespace sprout { typedef Range range_type; typedef sprout::range::range_container< sprout::transform_iterator< - UnaryFunction, + UnaryFunction, typename sprout::container_traits::iterator > > base_type; typedef typename base_type::iterator iterator; public: - transformed_range() = default; - transformed_range(transformed_range const&) = default; + SPROUT_CONSTEXPR transformed_range() = default; + SPROUT_CONSTEXPR transformed_range(transformed_range const&) = default; SPROUT_CONSTEXPR transformed_range(functor_type func, range_type& range) : base_type( iterator(sprout::begin(range), func), diff --git a/sprout/weed/parser/numeric/int_p.hpp b/sprout/weed/parser/numeric/int_p.hpp index aa6524b4..f82e17a9 100644 --- a/sprout/weed/parser/numeric/int_p.hpp +++ b/sprout/weed/parser/numeric/int_p.hpp @@ -225,4 +225,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_WEED_PARSER_NUMERIC_INT_P_HPP - diff --git a/sprout/weed/parser/numeric/uint_p.hpp b/sprout/weed/parser/numeric/uint_p.hpp index 2d3d6fb8..820f544c 100644 --- a/sprout/weed/parser/numeric/uint_p.hpp +++ b/sprout/weed/parser/numeric/uint_p.hpp @@ -201,4 +201,3 @@ namespace sprout { } // namespace sprout #endif // #ifndef SPROUT_WEED_PARSER_NUMERIC_UINT_P_HPP - diff --git a/sprout/weed/traits/type/is_c_str.hpp b/sprout/weed/traits/type/is_c_str.hpp index f52a9858..24bbf5f7 100644 --- a/sprout/weed/traits/type/is_c_str.hpp +++ b/sprout/weed/traits/type/is_c_str.hpp @@ -27,6 +27,22 @@ namespace sprout { : public sprout::weed::traits::is_c_str {}; template + struct is_c_str + : public std::true_type + {}; + template + struct is_c_str + : public std::true_type + {}; + template + struct is_c_str + : public std::true_type + {}; + template + struct is_c_str + : public std::true_type + {}; + template struct is_c_str : public std::true_type {};