Boost logo

Boost :

Subject: Re: [boost] [review][assign] Formal review of Assign v2 ongoing
From: er ([hidden])
Date: 2011-06-22 16:17:51

On 6/22/11 11:47 AM, lcaminiti wrote:
> lcaminiti wrote:
>> One question: How do users extend the library to make it work with
>> user-defined containers different from the ones supported "out of the
>> box"?
> Can anyone comment also on the question above? (Maybe it's trivial but still
> I'd like to know...)

If you want to use a container with a modifier that is already known to
the library, such as insert(), you can already do:

csv_put<insert_, I>( my_cont, a1,...aI, ..., z1, ...,zI); //(*)

although remember I have already made the point that this interface

insert<I>( my_cont )( a1,...aI, ..., z1, ...,zI)

is probably quite easy to implement as well, if requested.

If your container is of the same flavor as push_back but with a special
name, such as my_push_back(), you need to expand these macros:

#include <boost/assign/v2/option/modifier/std.hpp>

There are modifiers that are not standard (STD). For example, iterate
depends on a state, n, which is the starting index (By the way, this
index is restricted to zero in v1, I think). You might be able to guess
how to proceed by following this example

If not, let me know, and I'll try to elaborate. Finally, if you want,
say, insert() to be your default i.e. (*) is same as

csv_put<I>( my_cont, a1,...aI, ..., z1, ...,zI);

there are two cases. If your container falls into the category
'associative', for which insert is used by default, you need to put at
the top of your headers, a header that expands this macro:

#include <boost/assign/v2/support/traits/aux_/value_container.hpp>
Identifier, SeqArg)

as shown here:

If you container does not fall into category 'associative', you would
have to file in a feature request to override this file

with a new switch statement. Unfortunately, this file is not open for
extension. Someone with a good grasp of macros might be able to suggest
a remedy.

> Thanks a lot!

My pleasure, thanks for your interest.

> --Lorenzo
> --
> View this message in context:
> Sent from the Boost - Dev mailing list archive at
> _______________________________________________
> Unsubscribe& other changes:

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