Skip to content

File include/brisk/core/internal/Functional.hpp


generate function

template <typename Functor>
inline auto generate(size_t count, Functor functor)
    -> std::vector<decltype(functor())>

Generates a vector by applying a functor a specified number of times.

This function creates a vector of a given size and fills it with values generated by invoking the provided functor.
Template param Functor The type of the functor used for generating values.
Param count The number of elements to generate.
Param functor The functor that produces the values.
Returns A vector containing the generated values.


map function

template <typename ValueType, typename Alloc,
          typename Functor>
inline auto
map(const std::vector<ValueType, Alloc> &container,
    Functor &&functor)
    -> std::vector<
        decltype(functor(std::declval<ValueType>()))>

Transforms the elements of a vector using a functor.

This function applies the provided functor to each element of the input vector and returns a new vector containing the transformed values.
Template param ValueType The type of the elements in the input vector.
Template param Alloc The allocator type used by the input vector.
Template param Functor The type of the functor used for transformation.
Param container The input vector to transform.
Param functor The functor to apply to each element of the vector.
Returns A vector containing the transformed values.


Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/