[v3] plus<void>

Marc Glisse marc.glisse@inria.fr
Wed Sep 25 05:41:00 GMT 2013


On Wed, 25 Sep 2013, Jonathan Wakely wrote:

> I've had this sitting in my tree waiting to do something with,

I did ask last week if someone had done it already...

> I'm about to go to sleep so didn't check if the test covers anything 
> yours doesn't.

In the test you have basic cover for all functors, and I cover only 2 
cases (more specifically though, since I look at the return type cv-qual).

In my patch, I added constexpr and noexcept, I couldn't see any reason not 
to for such basic utilities. Yes, I did read the wiki and noticed the vote 
yesterday about constexpr, but imho that's wrong.

> It looks like your patch adds the default template argument even in
> C++98 mode, I avoided that by putting forward declarations at the top
> of the file, in a #if block.

This only lets me write:
std::plus<> *p;
in C++98 mode (std::plus<> p; gives an error), doesn't seem that bad.

And I also add the void specializations in C++11 mode, as an extension.

Well, let's forget my patch and go with yours, though at least adding 
noexcept seems like a good idea.

(too bad we don't have noexcept(auto) here)
(too bad we can't use decltype(auto) for the return type, as that would 
disable sfinae, it is a bad sign when the standard turns its nose up at 
its own dog food...)

-- 
Marc Glisse



More information about the Libstdc++ mailing list