rewrite sprout::algorithm::join performance

This commit is contained in:
bolero-MURAKAMI 2012-05-22 01:06:13 +09:00
parent 0ceabb5b9b
commit 1ea9d30e2a
145 changed files with 1359 additions and 364 deletions

View file

@ -4,7 +4,7 @@
// Copyright (c) 2012
// bolero-MURAKAMI : http://d.hatena.ne.jp/boleros/
// osyo-manga : http://d.hatena.ne.jp/osyo-manga/
//
//
// Readme:
// https://github.com/osyo-manga/cpp-half/blob/master/README
//
@ -26,9 +26,9 @@ struct fizzbuzz{
constexpr result_type
operator ()(int n) const{
return n % 15 == 0 ? sprout::to_string("FizzBuzz")
: n % 3 == 0 ? sprout::to_string("Fizz")
: n % 5 == 0 ? sprout::to_string("Buzz")
: sprout::to_string(n);
: n % 3 == 0 ? sprout::to_string("Fizz")
: n % 5 == 0 ? sprout::to_string("Buzz")
: sprout::to_string(n);
}
};
@ -45,7 +45,7 @@ main(){
static_assert(fizzbuzz()( 3) == "Fizz", "");
static_assert(fizzbuzz()( 5) == "Buzz", "");
static_assert(fizzbuzz()(15) == "FizzBuzz", "");
//
// Sequence [1..15]
//
@ -63,7 +63,7 @@ main(){
sprout::pit<sprout::array<string, 15> >(),
fizzbuzz()
);
//
// Check result
//