c++ - Writing a series of std::conditional with the same condition -
is there more compact way write following?
typedef typename std::conditional< condition, type_a1, type_b1 > type_c1; typedef typename std::conditional< condition, type_a2, type_b2 > type_c2; typedef typename std::conditional< condition, type_a3, type_b3 > type_c3; ...
where condition same, , type_ax
, type_bx
, type_cx
different lines different.
template<class a, class b> using select = std::conditional_t<condition, a, b>; using c1 = select<a1, b1>; // or typedef if syntax // etc.
Comments
Post a Comment