From 2e836ead5c10f00917560e9a98d46b59b2f977d4 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sat, 7 Nov 2026 18:05:26 +0100 Subject: Fixing double bracketing --- modules/codec/c++/data.hpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'modules/codec/c++/data.hpp') diff --git a/modules/codec/c++/data.hpp b/modules/codec/c++/data.hpp index c43402e..a8b7836 100644 --- a/modules/codec/c++/data.hpp +++ b/modules/codec/c++/data.hpp @@ -330,13 +330,28 @@ public: { } - /* + /** + * Forwarding constructor, so the elements can be written without + * spelling out the inner array. + * + * data>{0,1,2} instead of {{0,1,2}} + * + * The guards keep it out of the way of the copy and the meta schema + * constructor in the single element case. + * + * Explicit for a single element, because a one dimensional index would + * otherwise be convertible to both data and this, which makes + * the two at overloads of data> ambiguous. + */ template - requires (sizeof...(Args) == ct_multiply::value) && - (std::constructible_from, Args> && ...) - constexpr data(Args&&... args): - value_{ { std::forward(args)... } } {} - */ + requires (sizeof...(Args) == ct_multiply::value) + && (sizeof...(Args) > 1u + || (!std::same_as, data> && ...)) + && (!std::same_as, data> && ...) + && (std::constructible_from, Args> && ...) + explicit(sizeof...(Args) == 1u) constexpr data(Args&&... args): + value_{ data{std::forward(args)}... } + {} SAW_DEFAULT_COPY(data); SAW_DEFAULT_MOVE(data); -- cgit v1.3.1