#include #include #include "multi.h" using namespace std; //POLICY template struct Policy { Type d_type; Policy(Type &&type) : d_type(std::forward(type)) {} }; //= int main() { //ONE Multi ms{ Policy{ "hello" } }; Multi ms2s{ Policy{ "hello" }, Policy{ "world" } }; using MPSI = Multi; MPSI mpsi{ string{ "hello" }, 4 }; //= //TWO cout << "There are " << MPSI::size << " types in MPSI\n" "There are " << mpsi.size << " types in mpsi\n"; //= //THREE plainTypeAt<0, MPSI>::Type sx = "String type"; plainTypeAt<1, MPSI>::Type ix = 12; //= //FIVE cout << static_cast &>(mpsi).d_type << '\n' << static_cast &>(mpsi).d_type << '\n'; //= //SIX using MPII = Multi; MPII mpii{ 4, 18 }; cout << get<0>(mpii).d_type << ' ' << get<1>(mpii).d_type << '\n'; //= get<0>(mpii).d_type = get<1>(mpii).d_type; cout << get<0>(mpii).d_type << ' ' << get<1>(mpii).d_type << '\n'; //SEVEN using MVID = Multi; MVID mi{ {1, 2, 3}, {1.2, 3.4, 5.6, 7.8} }; //= //EIGHT typeAt<0, Multi>::Type vi = {1, 2, 3}; //= //NINE cout << get<0>(mi)[2] << '\n'; get<1>(mi)[3] = get<0>(mi)[0]; cout << get<1>(mi)[3] << '\n'; //= // cout << "Using get<0>(mpsi): " << get<0>(mpsi).d_type << '\n'; // cout << "Using get<1>(mpsi): " << get<1>(mpsi).d_type << '\n'; // Policy pi = get<1>(mpsi); // cout << static_cast &>(mi)[2] << '\n'; // static_cast &>(mi)[2] = 18; // cout << static_cast &>(mi)[2] << '\n'; }