tables::table::append,_append

1)

template <typename... Ts,is_primitive_type... Ps>
table<std::pair<Ts,Ps>...>
table<std::pair<Ts,Ps>...>::append(const row_t& row) const

2)

template <typename... Ts,is_primitive_type... Ps>
inline
void
table<std::pair<Ts,Ps>...>::_append(const row_t& row)

3)

template <typename... Ts,is_primitive_type... Ps>
inline
table<std::pair<Ts,Ps>...>
table<std::pair<Ts,Ps>...>::append(const table_t& other) const

  1. Returns a table with row row appended to end of table.

  2. Appends row row to existing table.

  3. Returns a table with t appended to end of table.

Example

Code

#include <iostream>
#include <cpptables/table.hh>

using namespace tables;
using namespace std;

struct c0{ constexpr static string_view name =  "Col0"; };
struct c1{ constexpr static string_view name =  "Col1"; };

using table_t = table<
  pair<c0,string_view>,
  pair<c1,double>
>;

void table_append()
{
  const table_t t(
      {"abc","def","ghi"},
      {10.0, 20.0, 30.0}
    );

  // Append row
  const table_t::row_t row("xyz", 123.0);

  const table_t t0 = t.append(row);
  cout << t0 << "\n";

  // Append table
  const table_t t1(
      {"foo", "bar"},
      {-100.0, 100.0}
    );

  const table_t t2 = t.append(t1);
  cout << t2 << "\n";
}

Output

Col0 Col1
---------
 abc   10
 def   20
 ghi   30
 xyz  123

Col0 Col1
---------
 abc   10
 def   20
 ghi   30
 foo -100
 bar  100