On 2015–07–29, at 2:44 PM, Filip Konvička <filip.k...@logis.cz> wrote:int main() {
Map m;
m.emplace(1, true);
return 0;
}
Could you please confirm that this is valid?
On 2015–07–29, at 3:09 PM, Ville Voutilainen <ville.vo...@gmail.com> wrote:I would expect the signature used to be this one:
template<class U, class V> EXPLICIT constexpr pair(U&& x, V&& y);
On 2015–07–29, at 3:19 PM, Filip Konvička <filip.k...@logis.cz> wrote:I understand a STL implementation could be doing this internally, but my expectation as a user is that the first argument to emplace be forwarded to the key object constructor, and the rest to the value object constructor. I would definitely not expect that X is copied or moved - that is the purpose of emplace after all, isn't it?
Or are you saying that the standard says that a map value needs to be a std::pair?
On 2015–07–29, at 5:12 PM, Ville Voutilainen <ville.vo...@gmail.com> wrote:
Now you've lost me. What defect are you talking about, wrt pair constructors and
explicit?
On Jul 29, 2015 4:22 AM, "Filip Konvička" <filip.k...@logis.cz> wrote:
>
> > The std::piecewise_construct is acceptable workaround for me at this
> > point (thanks David). I assume that we would still have issues with
> > tuples, though.
> >
> > typedef std::tuple<int, noncopyable> T;
> > typedef std::list<T> List;
> >
> > In this case emplace_back would also fail, and there is probably no
> > simple cure for this similar to piecewise_construct (or is there?)
>
> Interestingly, clang accepts this, as does gcc 6 and Visual Studio 2013. GCC 5.2 and older reject it.
This is most likely a library issue rather than a compiler issue, and (unlike gcc and msvc) clang is often used with several different standard library implementations. It would be useful to identify which one you are using when comparing behavior across implementations.
> I wonder what differences there are in the implementations that lead to this behavior. (I'm not asking anyone to go ahead and investigate, I'm just curious...)
>
>
> #include <tuple>
> #include <list>
>
>
> struct X {
> X(bool) {}
> X(X const&) = delete;
> const X& operator=(X const&) = delete;
> };
>
> typedef std::tuple<int,X> T;
>
> typedef std::list<T> List;
>
> int main() {
> List l;
> l.emplace_back(1, true);
> return 0;
>
> }
>
>
>
> --
>
> --- You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to std-discussio...@isocpp.org.
> To post to this group, send email to std-dis...@isocpp.org.
> Visit this group at http://groups.google.com/a/isocpp.org/group/std-discussion/.
On 2015–07–29, at 7:00 PM, Filip Konvička <filip.k...@logis.cz> wrote:typedef std::tuple<int, noncopyable> T;
typedef std::list<T> List;
In this case emplace_back would also fail, and there is probably no simple cure for this similar to piecewise_construct (or is there?)
On 2015–07–30, at 3:05 PM, David Krauss <pot...@mac.com> wrote:Yes, piecewise_construct works on tuples as well as pairs. Did you try?
On 2015–07–30, at 3:10 PM, David Krauss <pot...@gmail.com> wrote:Why doesn’t this work? Was piecewise_construct only introduced to support scoped allocation?