220 5537 <1ba31ea2-e3a1-4c3f-9e46-e6150c1377cc@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: tomaszkam@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Grouping placeholders for bind
Date: Tue, 23 Jul 2013 22:47:30 -0700 (PDT)
Lines: 129
Approved: news@gmane.org
Message-ID: <1ba31ea2-e3a1-4c3f-9e46-e6150c1377cc@isocpp.org>
References: <81385547-bb12-4ae6-9d12-82aaeb4b5ba0@isocpp.org>
 <e41b791b-eaa1-4156-9116-f2f7036ae4ae@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_376_302164.1374644850981"
X-Trace: ger.gmane.org 1374644853 779 80.91.229.3 (24 Jul 2013 05:47:33 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 24 Jul 2013 05:47:33 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDNPVXXG6IGBB46UXWHQKGQEJPEFZNY@isocpp.org Wed Jul 24 07:47:36 2013
Return-path: <std-proposals+bncBDNPVXXG6IGBB46UXWHQKGQEJPEFZNY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yh0-f72.google.com ([209.85.213.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDNPVXXG6IGBB46UXWHQKGQEJPEFZNY@isocpp.org>)
	id 1V1rvB-0003eJ-V0
	for gclcip-std-proposals@m.gmane.org; Wed, 24 Jul 2013 07:47:34 +0200
Original-Received: by mail-yh0-f72.google.com with SMTP id z20sf2982518yhz.11
        for <gclcip-std-proposals@m.gmane.org>; Tue, 23 Jul 2013 22:47:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-beenthere:date:from:to:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-google-group-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=jMlv2Bt9mbxFhA2aBUPEsHG5L8U+G7KjOC48JtHklXM=;
        b=hZFAlpFyotWQhYsPF8P/MtEt95UA88A4r/Sz2eRRHf9yqawCK3HKNubcIp5cTT+zZi
         70fH0l7/BniaZTNc6HJxFcyoXXsQ6M9Xcobgw81cEfOxaoRyemzuPoYa+5WbxMsyROkn
         8C+iXoDPFGnITEKZwy6P220c27LkhLUtHnR9fSVxUV4TU48FnMZBQECbRNs7Y3l8oN18
         7bo0YBx4L5FuFbrzW3bkNLSbg6jzvXiShPFpGXjWo3l69GEm/aDfVuIr5AhIqQrsqAxI
         5scbAg9/b+aRK0AFVNx8bf280RwfiVjkp5nN/xf7HVzxzD0w0af3582rtJfUvomrXoHa
         qX7w==
X-Received: by 10.224.86.200 with SMTP id t8mr49163735qal.0.1374644852814;
        Tue, 23 Jul 2013 22:47:32 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.48.170 with SMTP id m10ls90656qen.41.gmail; Tue, 23 Jul
 2013 22:47:31 -0700 (PDT)
X-Received: by 10.49.99.65 with SMTP id eo1mr254956qeb.3.1374644851489;
        Tue, 23 Jul 2013 22:47:31 -0700 (PDT)
In-Reply-To: <e41b791b-eaa1-4156-9116-f2f7036ae4ae@isocpp.org>
X-Original-Sender: tomaszkam@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:5537
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/5537>

------=_Part_376_302164.1374644850981
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable



W dniu wtorek, 23 lipca 2013 23:22:39 UTC+2 u=BFytkownik Xeo napisa=B3:
>
> I have played around with implementing such an `easy_bind` (as I call it)=
=20
> before, which can be found here<http://stackoverflow.com/a/15025170/50010=
4>and is really easy (especially in C++14 when you can just use=20
> `decltype(auto)` for the return type).
>
> You will notice that I used `std::function<R(FArgs...)>` instead of a=20
> generic `class F` in the public interface - the reason is that not all=20
> function objects can have the number of their parameters determined. The=
=20
> `operator()` may be either overloaded, templated, or both, rendering any=
=20
> attempt to get a specific signature moot.
>
> Of course, the overhead (if actually there) of `std::function` is likely=
=20
> unwanted in such a general purpose function. However, there are really on=
ly=20
> two callable entities where the signature can be inspected:=20
> function-pointers and member-function-pointers. As such, with the interfa=
ce=20
> of `std::bind` today, you can't really do better than that.
>
> The second argument N would mean actual number of argument provided to=20
>> invocation of the bind (so we cane genereate index of all arguments)
>>
> Here is the problem. First, the number of (bound) arguments passed to=20
> `std::bind` is irrelevant for the placeholders that are needed; these nee=
d,=20
> if anything, to be determined from the passed callable object. Second,=20
> notice that Jonathan specifically did *not* mention any indices. This=20
> `std::placeholders::all` form requires a very different implementation th=
at=20
> simply forwards all arguments that are passed at the invocation of the=20
> returned bind object. It cannot be done with the current interface and=20
> numbered placeholders, simply because some functions don't even *have* an=
=20
> upper bound on the number of arguments - variadic templates say hello.
>
The sentence should look like (I ommited it part while writing):
  The second argument N would mean actual number of argument provided to=20
the operator() of functor created as a result of bind.
The expansion of the group placeholder is only done with the context when=
=20
bind result is invoked so the number of arguments that was passed to it=20
would be enough to generate indicies that will forward alll of the and=20
placeholders::all can be implemented.

--=20

---=20
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 e=
mail 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-proposa=
ls/.



------=_Part_376_302164.1374644850981
Content-Type: text/html; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable

<br><br>W dniu wtorek, 23 lipca 2013 23:22:39 UTC+2 u=BFytkownik Xeo napisa=
=B3:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex=
;border-left: 1px #ccc solid;padding-left: 1ex;">I have played around with =
implementing such an `easy_bind` (as I call it) before, which can be found =
<a href=3D"http://stackoverflow.com/a/15025170/500104" target=3D"_blank">he=
re</a> and is really easy (especially in C++14 when you can just use `declt=
ype(auto)` for the return type).<br><br>You
 will notice that I used `std::function&lt;R(FArgs...)&gt;` instead of a
 generic `class F` in the public interface - the reason is that not all=20
function objects can have the number of their parameters determined. The
 `operator()` may be either overloaded, templated, or both, rendering=20
any attempt to get a specific signature moot.<br><br>Of course, the=20
overhead (if actually there) of `std::function` is likely unwanted in=20
such a general purpose function. However, there are really only two callabl=
e entities where the signature can be inspected:=20
function-pointers and member-function-pointers. As such, with the interface=
 of `std::bind` today, you can't really do better than that.<br><br><blockq=
uote style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex" class=3D"gmail_quote"><span><span style=3D"color:rgb(3=
4,34,34)">The second argument N would mean actual number of argument provid=
ed to invocation of the bind (so we cane genereate index of all arguments)<=
/span></span><br></blockquote><div>Here is the problem. First, the number o=
f (bound) arguments passed to `std::bind` is irrelevant for the placeholder=
s that are needed; these need, if anything, to be determined from the passe=
d callable object. Second, notice that Jonathan specifically did <i>not</i>=
 mention any indices. This `std::placeholders::all` form requires a very di=
fferent implementation that simply forwards all arguments that are passed a=
t the invocation of the returned bind object. It cannot be done with the cu=
rrent interface and numbered placeholders, simply because some functions do=
n't even *have* an upper bound on the number of arguments - variadic templa=
tes say hello.</div></blockquote><div>The sentence should look like (I ommi=
ted it part while writing):<br>&nbsp; The second argument N would mean actu=
al number of argument provided to the operator() of functor created as a re=
sult of bind.<br>The expansion of the group placeholder is only done with t=
he context when bind result is invoked so the number of arguments that was =
passed to it would be enough to generate indicies that will forward alll of=
 the and placeholders::all can be implemented.<br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_376_302164.1374644850981--

.
