VCCC  2024.05
VisualCamp Common C++ library
sum.hpp File Reference
#include <numeric>
#include "vccc/type_traits.hpp"

Go to the source code of this file.

Namespaces

 vccc
 
 vccc::impl
 

Functions

template<typename T >
constexpr T sumImpl (const T &arg)
 
template<typename Arg1 , typename Arg2 >
constexpr auto sumImpl (const Arg1 &arg1, const Arg2 &arg2) -> decltype(arg1+arg2)
 
template<typename Arg , typename ... Args>
constexpr auto sumImpl (const Arg &arg, const Args &... args) -> decltype(arg+sumImpl(args...))
 
template<typename T , std::enable_if_t< std::is_class< std::decay_t< T >>::value, int > = 0>
constexpr std::decay_t< T > default_value ()
 
template<typename InputIterator , std::enable_if_t< is_iterable< InputIterator >::value, int > = 0>
constexpr auto sum (InputIterator first, InputIterator last)
 sum of iterator [first, last) More...
 
template<typename InputIterator , typename UnaryOperation , std::enable_if_t< is_iterable< InputIterator >::value, int > = 0>
constexpr auto sum (InputIterator first, InputIterator last, UnaryOperation unary_op)
 sum of iterator [first, last) with custom unary operator More...
 
template<typename ... Args, std::enable_if_t< negation< disjunction< is_iterable< Args >... >>::value, int > = 0>
constexpr auto sum (const Args &... args)
 sum of variadic More...
 
template<typename UnaryOperation , typename Arg >
constexpr auto sum_custom (const UnaryOperation &unary_op, const Arg &arg)
 sum of variadic with custom operator More...
 
template<typename UnaryOperation , typename Arg , typename ... Args>
constexpr auto sum_custom (const UnaryOperation &unary_op, const Arg &arg, const Args &... args)
 
template<typename T >
constexpr T square (const T &val)
 get squared value More...
 
template<typename InputIterator , std::enable_if_t< is_iterable< InputIterator >::value, int > = 0>
constexpr auto square_sum (InputIterator first, InputIterator last)
 square sum of iterator [first, last) More...
 
template<typename Arg >
constexpr auto square_sum (const Arg &arg)
 
template<typename Arg1 , typename Arg2 , std::enable_if_t< negation< disjunction< is_iterator< Arg1 >, is_iterable< Arg2 > > >::value, int > = 0>
constexpr auto square_sum (const Arg1 &arg1, const Arg2 &arg2)
 
template<typename Arg , typename ... Args, std::enable_if_t<!is_iterable< Arg >::value, int > = 0>
constexpr auto square_sum (const Arg &arg, const Args &... args)
 square sum of variadic More...