tables::gtable

template <is_table,tuple_ext::is_tuple G>
requires ( std::tuple_size_v<G> > 0 )
struct gtable;

Group of tables

A gtable of type gtable<table<pair<Ts,Ps>…​>,std::tuple<Gs…​>> is obtained by grouping a table of type table<pair<Ts,Ps>…​> by Gs where Gs is a subset of Ts,

It is not recommended to construct a gtable directly, but to use table::group_by. See Grouping for examples.

The implementation stores a map of row<pair<Gs,PGs>…​> to a table<pair<NGs,NPGs>…​> where NGs are the lookup-types obtained after removing Gs form Ts i.e.Ts / Gs, and the PGs are the corresponding primitive-types.

Member types.

Member type Definition

ts_t

Tuple of lookup-types of original table.

ps_t

Tuple of primitive-types matching ts_t.

table_t

Original table type.

gs_t

Tuple of group lookup-types.

pgs_t

Tuple of primitive-types matching gs_t.

gtable_t

gtable type.

grow_t

row type for gtable_t.

ngs_t

Tuple of lookup-types obtained by removing gs_t from ts_t.

ng_table_t

table-type for lookup-types ngs_t.

ngrow_t

row type for ng_table_t.

map_t

map of grow_t to ng_table_t.

Member functions

Constructors / Assignment

Member type Definition

Constructors

Constructos the gtable.

Assignment operator

Assigns values to a gtable.

Capacity

Member type Definition

n_groups

Returns number of groups.

Accessors

Member type Definition

m

Returns underlying map.

Elements

Member type Definition

contains

Return true if gtable contains a row.

get

Return ng_table_t for given grow_t.

take

Return gtable with take applied to each grouped table.

drop

Return gtable with drop applied to each grouped table.

rtake

Return gtable with rtake applied to each grouped table.

rdrop

Return gtable with rdrop applied to each grouped table.

Ungrouping

Member type Definition

ungroup

Ungroups the table.

Transform

Member type Definition

reverse

Returns gtable with stored tables' columns reversed.

fills,fill_with,zfill

Returns gtable with stored tables' nones replaced.

deltas

Returns gtable with stored tables' column replaced with differences of each item with its predecessor.

distinct

Returns gtable with stored tables having unique rows.

sort

Returns gtable with stored tables sorted in ascending order using values in selected columns.

sort_by

Returns gtable with stored tables sorted in ascending order using values in selected columns.

rsort_by

Returns gtable with stored tables sorted in descending order using values in selected columns.

Aggregate

Member type Definition

min,max

Returns a table where each row is the minimum/maximum of each stored table.

sum

Returns a table where each row is the summation of each stored table.

avg

Returns a table where each row is the arithmetic mean of each stored table.