Showing posts with label cpp17_noexcept. Show all posts
Showing posts with label cpp17_noexcept. Show all posts

Apr 12, 2022

[C++] noexcept constructor

Reference:

Using noexcept as operator and making constructor as noexcept.

e.g.
template<typename T>
struct Holder
{
    T value;

template<typename... Args>
    Holder(Args&&... args)
        noexcept(noexcept(T(std::forward<Args>(args)...))) :
        value(std::forward<Args>(args)...) {}
};