Talk:cpp/error/make exception ptr

The example looks incorrect as no argument is given to std::current_exception
 * That function does not take an argument. T. Canens (talk) 21:06, 21 August 2019 (PDT)

Misleading?
The article says: "The parameter is passed by value and is subject to slicing."

That's true, but I think misleading, because it makes it sound as if slicing happens normally.

In fact, if you call std::make_exception without specifying the type to specialize on, then it will not slice.

auto ex = std::make_exception_ptr(std::runtime_error("No slicing here"));

That's because this is equivalent to:

auto ex = std::make_exception_ptr(std::runtime_error("No slicing here"));

It will only slice if you do something like this:

auto ex = std::make_exception_ptr(std::runtime_error("I am a runtime error!"));

68.197.116.79 20:03, 23 February 2020 (PST)
 * The way slicing usually happens is if you have a reference-to-base-class and call on that. T. Canens (talk) 07:21, 24 February 2020 (PST)