f



Parameter type deduction with constructors

Previously I had this line:
::std::unique_ptr<cmw_request> request(::new cmw_request(localbuf));

After getting C++ 2014 compilers, I wrote it like this:
auto request=::std::make_unique<cmw_request>(localbuf);

I was watching Mark Isaacson's talk here:
https://www.youtube.com/watch?v=-ctgSbEfRxU
..  (You can watch it from https://duckduckgo.com if you want.)
He talks about parameter type deduction for constructors
shortly after the two minute mark.

So I'm wondering if this is going to be valid C++ 2017 code:

::std::unique_ptr<cmw_request> request(localbuf);

It doesn't compile with clang++ 3.8.1. 

And I was trying to find an online C++ compiler that has
support for C++ 2017, but only found support for C++ 2014
and earlier.  Could someone point me to a site that has that?
Thanks in advance.


Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
1
woodbrian77
12/25/2016 12:54:42 AM
comp.lang.c++ 49423 articles. 2 followers. Post Follow

3 Replies
278 Views

Similar Articles

[PageSpeed] 47

On Saturday, December 24, 2016 at 6:55:02 PM UTC-6, woodb...@gmail.com wrote:
> Previously I had this line:
> ::std::unique_ptr<cmw_request> request(::new cmw_request(localbuf));
> 
> After getting C++ 2014 compilers, I wrote it like this:
> auto request=::std::make_unique<cmw_request>(localbuf);
> 
> I was watching Mark Isaacson's talk here:
> https://www.youtube.com/watch?v=-ctgSbEfRxU
> .  (You can watch it from https://duckduckgo.com if you want.)
> He talks about parameter type deduction for constructors
> shortly after the two minute mark.
> 
> So I'm wondering if this is going to be valid C++ 2017 code:
> 
> ::std::unique_ptr<cmw_request> request(localbuf);
> 

Or maybe it should be:

::std::unique_ptr request(cmw_request(localbuf));

or

::std::unique_ptr request(::new cmw_request(localbuf));

?

Those don't compile here either.
::std::unique_ptr request(::new cmw_request(localbuf));
> It doesn't compile with clang++ 3.8.1. 
> 
> 
> Brian
> Ebenezer Enterprises - In G-d we trust.
> http://webEbenezer.net

0
woodbrian77
12/25/2016 1:34:03 AM
On Saturday, December 24, 2016 at 6:55:02 PM UTC-6, woodb...@gmail.com wrote:
> Previously I had this line:
> ::std::unique_ptr<cmw_request> request(::new cmw_request(localbuf));
> 
> After getting C++ 2014 compilers, I wrote it like this:
> auto request=::std::make_unique<cmw_request>(localbuf);
> 
> I was watching Mark Isaacson's talk here:
> https://www.youtube.com/watch?v=-ctgSbEfRxU
> .  (You can watch it from https://duckduckgo.com if you want.)
> He talks about parameter type deduction for constructors
> shortly after the two minute mark.
> 
> So I'm wondering if this is going to be valid C++ 2017 code:
> 
> ::std::unique_ptr<cmw_request> request(localbuf);
> 
> It doesn't compile with clang++ 3.8.1. 
> 
> And I was trying to find an online C++ compiler that has
> support for C++ 2017, but only found support for C++ 2014
> and earlier.  Could someone point me to a site that has that?
> Thanks in advance.
> 

I checked Compiler Explorer now and it has more up to date
compilers.



> 
> Brian
> Ebenezer Enterprises - In G-d we trust.
> http://webEbenezer.net

0
woodbrian77
12/25/2016 3:03:16 AM
On 12/25/16 01:54 PM, woodbrian77@gmail.com wrote:
> Previously I had this line:
> ::std::unique_ptr<cmw_request> request(::new cmw_request(localbuf));

I can see some (very week) justification for the superfluous colons 
before std, but new?

-- 
Ian
0
Ian
12/25/2016 3:48:24 AM
Reply: