Topic: [std-discussion] An implementation of enhanced
Author: Thiago Macieira <thiago@macieira.org>
Date: Thu, 05 Mar 2015 17:03:38 -0800
Raw View
On Tuesday 03 March 2015 20:39:47 Faisal Vali wrote:
> 1) Enhanced-Auto Deduction:
>
> pair<auto...> f() { return make_pair([] { }, [] { }); }
> vector<auto> v = vector<int>();
What's the value of this syntax? Is it only to make it a compiler error if the
RHS isn't the type I had on the left?
That is, is it to make the following a compilation error:
std::vector<auto> v = someFunction();
if someFunction() returned QVector<int> instead of std::vector<int>?
Or is this syntax going to deduce the template parameters for the LHS from the
template parameters from the RHS, then convert? In other words, is the
following meant to be allowed?
template <typename T> struct S1 {};
template <typename T> struct S2
{
S2() = default;
S2(X<T>) {}
};
S1<int> someFunction();
....
S2<auto> v = someFunction();
// v is S2<int>
If that is the case, what are the rules for when the RHS has more template
parameters than the LHS? Just silently drop? (example: converting from
std::vector<T, Allocator> to QVector<T>).
And if the LHS has more parameters but those have default values, will it also
be allowed (from QVector<T> to std::vector<T, Allocator = allocator<T>>)?
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
.