fix algorithm implementation

This commit is contained in:
bolero-MURAKAMI 2017-10-18 14:42:38 +09:00
parent 23408e46c4
commit fb9770ce34
23 changed files with 46 additions and 41 deletions

View file

@ -75,7 +75,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
clamp_range_copy_impl(
InputIterator, InputIterator, Result const& result,
InputIterator const&, InputIterator const&, Result const& result,
typename std::iterator_traits<InputIterator>::value_type const&,
typename std::iterator_traits<InputIterator>::value_type const&,
Compare,

View file

@ -66,7 +66,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
copy_impl(
InputIterator, InputIterator, Result const& result,
InputIterator const&, InputIterator const&, Result const& result,
typename sprout::container_traits<Result>::size_type,
Args const&... args
)

View file

@ -43,7 +43,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
copy_until_impl(
InputIterator, InputIterator, Result const& result, Predicate,
InputIterator const&, InputIterator const&, Result const& result, Predicate,
typename sprout::container_traits<Result>::size_type,
Args const&... args
)

View file

@ -42,7 +42,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
copy_while_impl(
InputIterator, InputIterator, Result const& result, Predicate,
InputIterator const&, InputIterator const&, Result const& result, Predicate,
typename sprout::container_traits<Result>::size_type,
Args const&... args
)

View file

@ -69,7 +69,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
replace_copy_impl(
InputIterator, InputIterator,
InputIterator const&, InputIterator const&,
Result const& result, T const&, T const&,
typename sprout::container_traits<Result>::size_type,
Args const&... args

View file

@ -68,7 +68,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
replace_copy_if_impl(
InputIterator, InputIterator,
InputIterator const&, InputIterator const&,
Result const& result, Predicate, T const&,
typename sprout::container_traits<Result>::size_type,
Args const&... args

View file

@ -75,7 +75,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
rotate_copy_impl_1(
ForwardIterator, ForwardIterator,
ForwardIterator const&, ForwardIterator const&,
Result const& result,
typename sprout::container_traits<Result>::size_type,
Args const&... args
@ -106,8 +106,8 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
rotate_copy_impl(
ForwardIterator, ForwardIterator,
ForwardIterator, ForwardIterator,
ForwardIterator const&, ForwardIterator const&,
ForwardIterator const&, ForwardIterator const&,
Result const& result,
typename sprout::container_traits<Result>::size_type,
Args const&... args

View file

@ -76,9 +76,9 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
swap_element_copy_impl(
ForwardIterator, ForwardIterator,
ForwardIterator const&, ForwardIterator const&,
Result const& result,
ForwardIterator, ForwardIterator,
ForwardIterator const&, ForwardIterator const&,
typename sprout::container_traits<Result>::size_type,
Args const&... args
)

View file

@ -70,7 +70,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
transform_impl(
InputIterator, InputIterator,
InputIterator const&, InputIterator const&,
Result const& result, UnaryOperation,
typename sprout::container_traits<Result>::size_type,
Args const&... args

View file

@ -173,7 +173,7 @@ namespace sprout {
Result
>::type join_impl_1(
ContIterator, ContIterator,
InputIterator, InputIterator,
InputIterator const&, InputIterator const&,
Args const&... args
)
{
@ -355,7 +355,7 @@ namespace sprout {
ContIterator, ContIterator,
SepIterator, SepIterator,
bool,
InputIterator, InputIterator,
InputIterator const&, InputIterator const&,
Args const&... args
)
{

View file

@ -309,7 +309,7 @@ namespace sprout {
);
}
template<typename InputIterator>
SPROUT_CONSTEXPR md5 const process_block_impl(InputIterator first, InputIterator last) const {
SPROUT_CONSTEXPR md5 const process_block_impl(InputIterator const& first, InputIterator const& last) const {
return first == last ? *this
: c_process_byte(*first).process_block_impl(sprout::next(first), last)
;
@ -362,7 +362,7 @@ namespace sprout {
block_.assign(0);
}
template<typename InputIterator>
SPROUT_CXX14_CONSTEXPR void process_block_impl(InputIterator first, InputIterator last) {
SPROUT_CXX14_CONSTEXPR void process_block_impl(InputIterator const& first, InputIterator const& last) {
for (; first != last; ++first) {
process_byte(*first);
}

View file

@ -163,7 +163,7 @@ namespace sprout {
}
template<int D = 16, typename InputIterator, typename... Args, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_CONTINUE(D)>
SPROUT_CONSTEXPR typename std::enable_if<sizeof...(Args) == 64, sha1 const>::type
process_block_impl(InputIterator first, InputIterator last, Args... args) const {
process_block_impl(InputIterator const& first, InputIterator const& last, Args... args) const {
return first == last ? process<D + 1>(
h_,
sprout::make_array<std::uint8_t>(args...),
@ -182,12 +182,12 @@ namespace sprout {
}
template<int D = 16, typename InputIterator, typename... Args, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_BREAK(D)>
SPROUT_CONSTEXPR typename std::enable_if<sizeof...(Args) == 64, sha1 const>::type
process_block_impl(InputIterator, InputIterator, Args...) const {
process_block_impl(InputIterator const&, InputIterator const&, Args...) const {
return sprout::throw_recursive_function_template_instantiation_exeeded();
}
template<int D = 16, typename InputIterator, typename... Args, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_CONTINUE(D)>
SPROUT_CONSTEXPR typename std::enable_if<sizeof...(Args) != 64, sha1 const>::type
process_block_impl(InputIterator first, InputIterator last, Args... args) const {
process_block_impl(InputIterator const& first, InputIterator const& last, Args... args) const {
return first == last ? process<D + 1>(
h_,
sprout::get_internal(sprout::range::fixed::copy(sprout::make_array<std::uint8_t>(args...), sprout::sub(block_, block_byte_index_))),
@ -208,7 +208,7 @@ namespace sprout {
}
template<int D = 16, typename InputIterator, typename... Args, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_BREAK(D)>
SPROUT_CONSTEXPR typename std::enable_if<sizeof...(Args) != 64, sha1 const>::type
process_block_impl(InputIterator, InputIterator, Args...) const {
process_block_impl(InputIterator const&, InputIterator const&, Args...) const {
return sprout::throw_recursive_function_template_instantiation_exeeded();
}
#else
@ -273,7 +273,7 @@ namespace sprout {
}
template<typename InputIterator, typename... Args>
SPROUT_CONSTEXPR typename std::enable_if<sizeof...(Args) == 64, sha1 const>::type
process_block_impl(InputIterator first, InputIterator last, Args... args) const {
process_block_impl(InputIterator const& first, InputIterator const& last, Args... args) const {
return first == last ? process(
h_,
sprout::make_array<std::uint8_t>(args...),
@ -290,7 +290,7 @@ namespace sprout {
}
template<typename InputIterator, typename... Args>
SPROUT_CONSTEXPR typename std::enable_if<sizeof...(Args) != 64, sha1 const>::type
process_block_impl(InputIterator first, InputIterator last, Args... args) const {
process_block_impl(InputIterator const& first, InputIterator const& last, Args... args) const {
return first == last ? process(
h_,
sprout::get_internal(sprout::range::fixed::copy(sprout::make_array<std::uint8_t>(args...), sprout::sub(block_, block_byte_index_))),

View file

@ -44,7 +44,7 @@ namespace sprout {
sum_type sum_;
private:
template<typename InputIterator>
SPROUT_CONSTEXPR sum_type calc_sum(InputIterator first, InputIterator last) const {
SPROUT_CONSTEXPR sum_type calc_sum(InputIterator const& first, InputIterator const& last) const {
return sprout::accumulate(
sprout::make_bytes_iterator(first),
sprout::make_bytes_iterator(last),

View file

@ -33,7 +33,7 @@ namespace sprout {
sum_type sum_;
private:
template<typename InputIterator>
SPROUT_CONSTEXPR sum_type calc_sum(InputIterator first, InputIterator last) const {
SPROUT_CONSTEXPR sum_type calc_sum(InputIterator const& first, InputIterator const& last) const {
return sprout::accumulate(
sprout::make_bytes_iterator(first),
sprout::make_bytes_iterator(last),

View file

@ -68,7 +68,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
amplitude_spectrum_impl(
InputIterator, InputIterator, Result const& result,
InputIterator const&, InputIterator const&, Result const& result,
typename sprout::container_traits<Result>::size_type,
Args const&... args
)

View file

@ -68,7 +68,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
phase_spectrum_impl(
InputIterator, InputIterator, Result const& result,
InputIterator const&, InputIterator const&, Result const& result,
typename sprout::container_traits<Result>::size_type,
Args const&... args
)

View file

@ -59,7 +59,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
adjacent_difference_impl(
InputIterator, InputIterator, Result const& result,
InputIterator const&, InputIterator const&, Result const& result,
typename sprout::container_traits<Result>::size_type
)
{
@ -133,7 +133,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
adjacent_difference_impl(
InputIterator, InputIterator, Result const& result, BinaryOperation,
InputIterator const&, InputIterator const&, Result const& result, BinaryOperation,
typename sprout::container_traits<Result>::size_type
)
{

View file

@ -59,7 +59,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
exclusive_scan_impl(
InputIterator, InputIterator, Result const& result, T,
InputIterator const&, InputIterator const&, Result const& result, T,
typename sprout::container_traits<Result>::size_type
)
{
@ -71,7 +71,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
exclusive_scan_impl(
InputIterator, InputIterator, Result const& result, T init,
InputIterator const&, InputIterator const&, Result const& result, T init,
typename sprout::container_traits<Result>::size_type
)
{
@ -147,7 +147,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
exclusive_scan_impl(
InputIterator, InputIterator, Result const& result, T, BinaryOperation,
InputIterator const&, InputIterator const&, Result const& result, T, BinaryOperation,
typename sprout::container_traits<Result>::size_type
)
{
@ -159,7 +159,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
exclusive_scan_impl(
InputIterator, InputIterator, Result const& result, T init, BinaryOperation,
InputIterator const&, InputIterator const&, Result const& result, T init, BinaryOperation,
typename sprout::container_traits<Result>::size_type
)
{

View file

@ -53,7 +53,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
inclusive_scan_impl(
InputIterator, InputIterator, Result const& result, BinaryOperation, T,
InputIterator const&, InputIterator const&, Result const& result, BinaryOperation, T,
typename sprout::container_traits<Result>::size_type
)
{
@ -65,7 +65,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
inclusive_scan_impl(
InputIterator, InputIterator, Result const& result, BinaryOperation, T init,
InputIterator const&, InputIterator const&, Result const& result, BinaryOperation, T init,
typename sprout::container_traits<Result>::size_type
)
{

View file

@ -59,7 +59,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
partial_sum_impl(
InputIterator, InputIterator, Result const& result,
InputIterator const&, InputIterator const&, Result const& result,
typename sprout::container_traits<Result>::size_type
)
{
@ -133,7 +133,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
partial_sum_impl(
InputIterator, InputIterator, Result const& result, BinaryOperation,
InputIterator const&, InputIterator const&, Result const& result, BinaryOperation,
typename sprout::container_traits<Result>::size_type
)
{

View file

@ -59,7 +59,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
transform_exclusive_scan_impl(
InputIterator, InputIterator, Result const& result, T, BinaryOperation, UnaryOperation,
InputIterator const&, InputIterator const&, Result const& result, T, BinaryOperation, UnaryOperation,
typename sprout::container_traits<Result>::size_type
)
{
@ -71,7 +71,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
transform_exclusive_scan_impl(
InputIterator, InputIterator, Result const& result, T init, BinaryOperation, UnaryOperation,
InputIterator const&, InputIterator const&, Result const& result, T init, BinaryOperation, UnaryOperation,
typename sprout::container_traits<Result>::size_type
)
{

View file

@ -59,7 +59,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
transform_inclusive_scan_impl(
InputIterator, InputIterator, Result const& result, BinaryOperation, UnaryOperation,
InputIterator const&, InputIterator const&, Result const& result, BinaryOperation, UnaryOperation,
typename sprout::container_traits<Result>::size_type
)
{
@ -102,7 +102,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
transform_inclusive_scan_impl(
InputIterator, InputIterator, Result const& result, BinaryOperation, T,
InputIterator const&, InputIterator const&, Result const& result, BinaryOperation, T,
typename sprout::container_traits<Result>::size_type
)
{
@ -114,7 +114,7 @@ namespace sprout {
typename sprout::fixed::results::algorithm<Result>::type
>::type
transform_inclusive_scan_impl(
InputIterator, InputIterator, Result const& result, BinaryOperation, T init,
InputIterator const&, InputIterator const&, Result const& result, BinaryOperation, T init,
typename sprout::container_traits<Result>::size_type
)
{

View file

@ -138,6 +138,11 @@ namespace testspr {
print_typename() {
testspr::print_ln(testspr::typename_of<T>());
}
template<typename T>
inline SPROUT_NON_CONSTEXPR void
print_typename(T&& t) {
testspr::print_ln(testspr::typename_of(std::forward<T>(t)));
}
//
// print_type