Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2003-10-25 23:49:47


"Jeremy Maitin-Shepard" <jbms_at_[hidden]> wrote in message
news:87ad7o7pxd.fsf_at_jay.local.invalid...
> [...]
> (This post is rather off topic, but I thought I would post it
> anyway)
> [...]
> Imagine if C++ supported syntax like this:
>
> typedef typename {
> type x = mpl::vector<int, bool, short, double>;
> type y = mpl::vector<float, unsigned int>;
> for(type it = begin<y>; it != end<y>; it = next<it>)
> x = push_back<x, deref<it> >;
> return x;
> } my_vector;
> [...]

What if it looked like this instead:

mpl::vector append_vector(mpl::vector x, mpl::vector y)
{
    for (mpl::vector::iterator i = begin(y); i != end(y); ++i)
    {
        x.push_back(*i);
    }
    return x;
}

mpl::vector my_vector = append_vector(
        mpl::vector(int, bool, short, double),
        mpl::vector(float, unsigned int)
    );

Of course, it will never look like that in C++, but what if there
were a language that *did* support that kind of syntax? That's
something I've been thinking about quite a bit lately. ;)

Dave

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 9/23/2003

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