|
Boost : |
From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2003-10-01 19:42:45
"David Abrahams" <dave_at_[hidden]> wrote in message
news:u65j9chi7.fsf_at_boost-consulting.com...
> > Also, sometimes it's convenient to brake the loop on certain condition.
> > Like, when comparing relational tuples in our library, we go through the
> > field list, which is a type list. Once 2 fields don't compare equal, we
> > have to stop.
>
> Are you comparing their runtime values or their compile-time values?
We are comparing runtime values. In our system tuple fields are denoted by
class names (we use our own tuple -- not the boost::tuple). Therefore list
of tuple fields is a typelist. To compare two tuples we go through this
typelist, extract corresponding values from both tuples, and compare them.
Once they don't compare equal, there is no reason to continue.
Right now we are using our own analog of mpl::for_each, which does allow us
to brake the loop. We are trying to get rid of our own meta-programming
code, and hoped to find similar facilities in MPL. Of course, if
mpl::for_each doesn't allow to brake the loop, we can leave our own
algorithm for now -- just change it to work with an MPL sequence.
Arkadiy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk