tables::table::lj
1)
template <typename... Ts,is_primitive_type... Ps>
template<is_ktable KT>
requires ( is_kjoinable<table<std::pair<Ts,Ps>...>,KT> )
inline
auto
table<std::pair<Ts,Ps>...>::lj(const KT& kt) const
2)
template <typename... Ts,is_primitive_type... Ps>
template<is_ktable KT>
requires ( is_kjoinable<table<std::pair<Ts,Ps>...>,KT> )
inline
auto
table<std::pair<Ts,Ps>...>::ljf(const KT& kt) const
-
Return table resulting from left-join with kt.
-
Same as lj, but fills lhs nones with rhs values.
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"; };
struct c2{ constexpr static string_view name = "Col2"; };
using table0_t = table<
pair<c0,string_view>,
pair<c1,unsigned>
>;
using table1_t = table<
pair<c0,string_view>,
pair<c1,unsigned>,
pair<c2,double>
>;
void table_lj()
{
const table0_t t0(
{"abc", "def", "ghi", "jkl", "abc", "def", "ghi", "jkl"},
{1,2,3,4,5,6,7,8}
);
constexpr unsigned uint_none = prim_traits<unsigned>::none;
const table1_t t1(
{"abc", "def","ghi"},
{uint_none, 20, 30},
{1.0, 2.0, 3.0}
);
const auto r0 = t0.lj( t1.key_by<c0>() );
cout << "lj:\n" << r0 << "\n";
const auto r1 = t0.ljf( t1.key_by<c0>() );
cout << "ljf:\n" << r1 << "\n";
}