Boost logo

Boost :

Subject: Re: [boost] Assign V2 - first impression
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2011-06-24 09:08:51

er wrote:
> > I am sure that it is a powerful library, but I really have no
> > idea at all what is going on. I can't even parse the first
> > line as valid C++ in any way. You need better examples, and
> > also is that really the best way you could find to express
> > repeating?
> If I try to imagine what the interface would look like after
> taking into account some of the suggestions that were made, this
> sentence:
> "Create data elements by mapping 1, 10, 100, 1000 by function
> f, and insert each result in cont by invoking modifier
> push_front."

If I interpret that correctly, it would be clearer as:

"Create elements in cont, using push_front(), by calling f() 1, 10, 100, and 1000 times."

> translates to
> (
> push_front<1>( cont ) % ( _data = f ) % ( _repeat = n )
> )( 1, 10, 100, 1000 );

Why the leading underscores on "_data" and "_repeat?"

> Questions :
> - is it more readable, now?
> - What if each example was preceded by its English equivalent.

Preceding each by a clear English equivalent is necessary.

Could that code be spelled like the following instead?

   push_front<1>(cont).from(f).repeated(1, 10, 100, 1000);

That is, instead of operator overloading, member functions would make things clearer and more succinct. Is there more to the operator overloading than I know making the member function approach too restrictive? What happens to your operator overloading approach when a using directive is not in force? Does "_data" become "boost::assign::_data," for example?

Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

Boost list run by bdawes at, gregod at, cpdaniel at, john at