Конструктор Copy определяется как:
Код: Выделить всё
std::function_ref(std::function_ref const&) = default;, в то время как оператор назначения определяется как:
Код: Выделить всё
constexpr std::function_ref& operator=(std::function_ref const&) noexcept = default;Оригинальный вопрос: почему последний ** contexpr и noexcept , но первое не так?
--- Определяет ctors of std :: function_ref следующим образом:
Код: Выделить всё
template function_ref(F*) noexcept;
template constexpr function_ref(F&&) noexcept;
template constexpr function_ref(nontype_t) noexcept;
template constexpr function_ref(nontype_t, U&&) noexcept;
template constexpr function_ref(nontype_t, cv T*) noexcept;
constexpr function_ref(const function_ref&) noexcept = default;
constexpr function_ref& operator=(const function_ref&) noexcept = default;
template function_ref& operator=(T) = delete;
Почему [/b] template function_ref (f*) не contexpr , в то время как другие ctors все , а другие CTOR ?>
Подробнее здесь: https://stackoverflow.com/questions/796 ... -constexpr
Мобильная версия