У меня есть 2 структуры, первая - обертка массива, вторая - данные что будут положены в массив.
Конструктор первой с std::initializer_list:
static_array(std::initializer_list<type> il)
requires std::is_copy_constructible_v<type> {
if (il.size() != N) {
throw invalid_range();
}
pointer iter = begin();
for (const_type& val : il) {
place_at(iter, val);
++iter;
}
}
Конструкторы второй:
c_function(func* body, const metadata& meta, destructor* args_destructor = nullptr);
c_function(func* body, metadata&& meta, destructor* args_destructor = nullptr);
c_function(const c_function& other) : _meta(other.get_meta()), _body(other.get_body()), _args_destructor(other.get_args_destructor()) {};
c_function(c_function&& other) noexcept;
Почему в записи:
c_function s1(nullptr, {});
c_function s2(nullptr, {});
static_array<c_function, 2> sa = static_array<c_function, 2>{ abc };
У меня возникает ошибка C2512. Я ведь нигде ничего по умолчанию не создаю. Откуда она?
При этом создание просто std::initializer_list с c_function не вызывает никаких ошибок!
std::initializer_list<c_function> abc = { c_function(nullptr, {}) };