// // Created by jedi on 23.07.21. // #ifdef __cplusplus template using size=std::integral_constant; template constexpr size length( T const(&)[N] ) { return {}; } template constexpr size length( std::array const& ) { return {}; } template using length_t = decltype(length(std::declval())); constexpr size_t string_size() { return 0; } template constexpr size_t string_size( size_t i, Ts... ts ) { return (i?i-1:0) + string_size(ts...); } template using string_length=size< string_size( length_t{}... )>; template using combined_string = std::array{}+1>; template constexpr const combined_string concat_impl( Lhs const& lhs, Rhs const& rhs, seq, seq) { // the '\0' adds to symmetry: return {{ lhs[I1]..., rhs[I2]..., '\0' }}; } template constexpr const combined_string concat(Lhs const& lhs, Rhs const& rhs) { return concat_impl( lhs, rhs, gen_seq{}>{}, gen_seq{}>{} ); } template constexpr const combined_string concat(T0 const&t0, T1 const&t1, Ts const&...ts) { return concat(t0, concat(t1, ts...)); } template constexpr const combined_string concat(T const&t) { return concat(t, ""); } constexpr const combined_string<> concat() { return concat(""); } #endif