tables::table::ncols,nrows

1)

template <typename... Ts,is_primitive_type... Ps>
inline static constexpr std::size_t
table<std::pair<Ts,Ps>...>::ncols()

2)

template <typename... Ts,is_primitive_type... Ps>
std::size_t
table<std::pair<Ts,Ps>...>::nrows() const

  1. Returns number of columns.

  2. Returns number of rows.

Example

Code

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

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_ncols_nrows()
{
  const table_t t(
      {"abc","def","ghi", "abc","def","ghi"},
      {10.0, 20.0, 30.0, 40.0, 50.0, 60.0}
    );

  cout << t.nrows() * t.ncols() << "\n";
}

Output

4