Signature Description Parameters
#include <DataFrame/DataFrameStatsVisitors.h>

template<typename F, typename T, typename I = unsigned long>
struct ExpandingRollAdopter;
        
This is a “single action visitor”, meaning it is passed the whole data vector in one call and you must use the single_act_visit() interface.

This functor applies functor F to the data in an expanding rolling progression. The roll count and the step increment count are given to the constructor.
The result is a vector of T type values. The first roll_count items, in the result, will be NAN.
    ExpandingRollAdopter(F &&functor,
                         size_t roll_count,
                         size_t increment_count = 1);
        
F: Functor type
T: Column data type
I: Index type
static void test_ExpandingRollAdopter()  {

    std::cout << "\nTesting ExpandingRollAdopter{ } ..." << std::endl;

    std::vector<unsigned long>  idx =
        { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
          21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 };
    std::vector<double> d1 =
        { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
          21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 };
    MyDataFrame         df;

    df.load_data(std::move(idx), std::make_pair("col_1", d1));

    ExpandingRollAdopter<MeanVisitor<double>, double> expand_roller(MeanVisitor<double>(), 2);
    const auto  &result = df.single_act_visit<double>("col_1", expand_roller).get_result();

    assert(result.size() == 21);
    assert(std::isnan(result[0]));
    assert(result[8] == 12);
    assert(result[13] == 19.5);
    assert(result[15] == 22.5);
    assert(result[20] == 30);
}