tables::table::aj, tables::table::aj0

1)

template <typename... Ts,is_primitive_type... Ps>
template<typename Tm,is_ktable KT>
requires (
  in<Tm,std::tuple<Ts...>> &&
  !in<Tm,typename KT::ks_t> &&
  is_kjoinable<table<std::pair<Ts,Ps>...>,KT>
)
inline
auto
table<std::pair<Ts,Ps>...>::aj(const KT& kt) const

2)

template <typename... Ts,is_primitive_type... Ps>
template<typename Tm,is_ktable KT>
requires (
  in<Tm,std::tuple<Ts...>> &&
  !in<Tm,typename KT::ks_t> &&
  is_kjoinable<table<std::pair<Ts,Ps>...>,KT>
)
inline
auto
table<std::pair<Ts,Ps>...>::aj0(const KT& kt) const

  1. Return table resulting from asof-join with kt.

  2. Same as aj, but with Tm column taken from right-hand side table.

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"; };

void table_aj()
{
  using table0_t = table<
    pair<c0,string_view>,
    pair<c1,unsigned>
  >;

  const table0_t t0(
      {"abc","def","ghi"},
      {0,5,10}
  );
  cout << "t0:\n" << t0 << "\n";

  using table1_t = table<
    pair<c0,string_view>,
    pair<c1,unsigned>,
    pair<c2,unsigned>
  >;

  const table1_t t1(
    {"abc","def","ghi","abc","def","ghi","abc","def","ghi"},
    {1,2,3,4,5,6,7,8,9},
    {100,200,300,400,500,600,700,800,900}
  );
  cout << "t1:\n" << t1 << "\n";

  const table1_t tres = t0.aj<c1>( t1.key_by<c0>() );
  cout << "tres:\n" << tres << "\n";
}

Output

0:
Col0 Col1
---------
 abc    0
 def    5
 ghi   10

t1:
Col0 Col1 Col2
--------------
 abc    1  100
 def    2  200
 ghi    3  300
 abc    4  400
 def    5  500
 ghi    6  600
 abc    7  700
 def    8  800
 ghi    9  900

tres:
Col0 Col1 Col2
--------------
 abc    0 none
 def    5  500
 ghi   10  900