Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #715

Re: Semantics of std::function's constructors

From Daniel Krügler <daniel.kruegler@googlemail.com>
Newsgroups comp.std.c++
Subject Re: Semantics of std::function's constructors
Date 2014-03-21 13:11 -0700
Organization A noiseless patient Spider
Message-ID <lgfdo3$bki$1@dont-email.me> (permalink)
References <c27a0fad-a26d-4deb-bfd3-7d6de995d4b8@googlegroups.com>

Show all headers | View raw


Am 20.03.2014 07:13, schrieb Roman Perepelitsa:
>
> Both C++11 and the C++14 draft seem to be missing semantics
> of several std::function's constructors.
>
> [func.wrap.func]:
>
> // 20.9.11.2.1, construct/copy/destroy:
> function() noexcept;
> function(nullptr_t) noexcept;
> function(const function&);
> function(function&&);
> template<class F> function(F);
> template<class A> function(allocator_arg_t, const A&) noexcept;
> ...
>
> 20.9.11.2.1 function construct/copy/destroy [func.wrap.func.con]
> defines semantics for the constructors with allocator_arg_t as
> the first parameter but not, for example, template<class F> function(F).
>
> Is that an oversight or am I missing something?


As of acceptance of LWG 2132

http://cplusplus.github.io/LWG/lwg-defects.html#2132

this has been clarified. We have now for

template<class F> function(F f);
template <class F, class A> function(allocator_arg_t, const A& a, F f);

the following normative wording in [func.wrap.func.con] p8:

Remarks: These constructors shall not participate in overload
resolution unless f is Callable (20.9.11.2) for argument types
ArgTypes... and return type R.

> I'm trying to understand whether template<class F> function(F) is
> required to participate in overload resolution if and only if F is
> Callable for argument types ArgTypes and return type R.


It is now, but wasn't before.

HTH & Greetings from Bremen,

Daniel Krügler



--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextPrevious in thread | Find similar


Thread

Semantics of std::function's constructors Roman Perepelitsa <Roman.Perepelitsa@googlemail.com> - 2014-03-19 23:13 -0700
  Re: Semantics of std::function's constructors Daniel Krügler <daniel.kruegler@googlemail.com> - 2014-03-21 13:11 -0700

csiph-web