
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"? http://svn.boost.org/svn/boost/sandbox/assign_v2/libs/assign/v2/doc/html/boo...
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> BOOST_ASSIGN_V2_OPTION_STD_MODIFIER_TAG(my_push_back) BOOST_ASSIGN_V2_OPTION_STD_MODIFIER(my_push_back) 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 https://svn.boost.org/svn/boost/sandbox/assign_v2/boost/assign/v2/option/mod... 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> BOOST_ASSIGN_V2_TRAITS_CONTAINER_CATEGORY(SeqPar, IsCategory, Identifier, SeqArg) as shown here: https://svn.boost.org/svn/boost/sandbox/assign_v2/boost/assign/v2/support/tr... If you container does not fall into category 'associative', you would have to file in a feature request to override this file https://svn.boost.org/svn/boost/sandbox/assign_v2/boost/assign/v2/interprete... 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: http://boost.2283326.n4.nabble.com/review-assign-Formal-review-of-Assign-v2-... Sent from the Boost - Dev mailing list archive at Nabble.com. _______________________________________________ Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost