|
Boost : |
From: shunsuke (pstade.mb_at_[hidden])
Date: 2007-03-22 04:55:58
Daniel Walker wrote:
> On 3/21/07, shunsuke <pstade.mb_at_[hidden]> wrote:
>> Daniel Walker wrote:
>>> If/when lambda standardizes on
>>> result<>, the lambda related special cases in result_of can be
>>> removed.
>> It will break a code using not result_of but sig compatible functors?
>
> Yes. That's the reason lambda would support both for a time with sig<>
> being deprecated. After a release or two (giving users plenty of time
> to update their code) sig<> would be removed. This gives them a fair
> warning and time to adapt.
I think users don't want to spend the time.
Smart users will protect themselves right now by using something like..
struct sig_compatible_fun
: enable_result_of_sig // added
{
// ...
};
Hmm, patch is no longer required. :-)
>> Can the patch support a sig compatible functor
>> which is "nullary-callable" (e.g. lambda::constructor<>) ?
>
> Yes. I just tested it with lambda::constructor<>, and it does work.
I tried this:
#include <boost/utility/result_of.hpp>
#include <boost/lambda/construct.hpp>
int main()
{
using boost::lambda::constructor;
using boost::result_of;
int i = 1;
result_of<constructor<int>(int&)>::type
r = constructor<int>()(i); // (1) GCC compiles.
result_of<constructor<int>()>::type
r = constructor<int>()(); // (2) GCC fails.
}
I guess a sig-compatible functor which is nullary-callable must be
ported to result_of, even if the patch is applied.
Note that nullary instantiation of 'result_of' must always succeed.
(See the rationale at
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1454.html)
Well, I have bad news. VC++7.1 and VC8 can't compile (1) nor (2). :-(
>> I introduce <boost/detail/functionN.hpp> at Boost.Accumulators,
>> which seems very cool.
>
> I looked for your file in the boost-sandbox cvs repository and
> couldn't find it. Could you send a link?
See the accumulators.zip in "Math - Numerics" directory at Boost Vault.
Regards,
-- Shunsuke Sogame
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk