Boost logo

Boost :

Subject: Re: [boost] De Bruijn Bind (alternate bind syntax) Interest?
From: David Sankel (camior_at_[hidden])
Date: 2010-09-20 10:57:56


On Sun, Sep 19, 2010 at 2:51 PM, Larry Evans <cppljevans_at_[hidden]>wrote:

> On 09/02/10 10:57, David Sankel wrote:
> > Hello all,
> >
> > I've been working on an alternate bind syntax based on De Bruijn
> indices[1].
> > The syntax is very simple, yet the terms are very powerful.
>
> David,
>
> I tried the problem on:
>
> http://en.wikipedia.org/wiki/De_Bruijn_index
>
> however, I'm getting the compile errors shown in the attachment which
> also shows the source via a cat command.
>
> Any ideas what may be wrong?
>

Larry,

Looks like you passed a template function, z, to another function. This
doesn't work work in C++. template functions are second class citizens.
There is a workaround by making a struct with a templated operator():

    struct Z
    {
        typedef int result_type;
        template < typename F >
        int operator()
        ( int x
        , F f
        ) const
        {
        return f(x);
        };

    } const z = Z();

Looks like there are more issues too. I'll continue digging.

-David

-- 
David Sankel
Sankel Software
www.sankelsoftware.com
585 617 4748 (Office)

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk