tables::table::updatef
1)
template <typename... Ts,is_primitive_type... Ps>
template<typename... TUs,is_primitive_type... PUs>
requires (
(in<TUs,std::tuple<Ts...>> && ... ) &&
is_tuple_unique<std::tuple<TUs...>> &&
( sizeof...(TUs) == sizeof...(PUs) )
)
inline
auto
table<std::pair<Ts,Ps>...>::updatef(const column<PUs>&... cs) const
2)
template <typename... Ts,is_primitive_type... Ps>
template<typename... TUs,is_primitive_type... PUs>
requires (
(in<TUs,std::tuple<Ts...>> && ... ) &&
is_tuple_unique<std::tuple<TUs...>> &&
( sizeof...(TUs) == sizeof...(PUs) )
)
inline
auto
table<std::pair<Ts,Ps>...>::updatef(
const table<std::pair<TUs,PUs>...>& t
) const
-
Returns a new table obtained by updating columns TUs with columns cs. Nones in cs are ignored.
-
Returns a new table obtained by updating columns TUs with columns from table
t
. Nones int
are ignored.
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 table_t = table<
pair<c0,string_view>,
pair<c1,unsigned>,
pair<c2,unsigned>
>;
void table_updatef()
{
constexpr unsigned none_uint = prim_traits<unsigned>::none;
const table_t t(
{"abc", "def", "ghi"},
{1,2,3},
{10,20,30}
);
const column<unsigned> col({100,none_uint,300});
const table_t t1 = t.updatef<c1,c2>(col,col);
cout << t1 << "\n";
}