Boost logo

Boost :

From: Daveus, Fredrik (Fredrik.Daveus_at_[hidden])
Date: 2007-06-13 06:32:04

I want to pass the result of a map_list_of call as an argument to a
class ctor, but the
only way I've managed to do this is by using some stuff from the
assign_detail namespace.
Is there any other (more elegant) way of achieving this?
See example code below.

class A {
    typedef map<int, int> map_type;
// Simply using the container iterator type doesn't seem to work since
one needs the
// iterator of the impl_type defined in assign_detail::generic_list
which is
// publicly exposed as generic_list<T>::const_iterator.
    typedef boost::assign_detail::generic_list<std::pair<int, int>
>::const_iterator c_it;

    A(c_it _first, c_it _last)
        : m_map(_first, _last) { }
    map<int, int> m_map;

void test()
    A a(map_list_of(1,1)(2,2));
This e-mail, its content and any files transmitted with it are intended solely for the addressee(s) and may be legally privileged and/or confidential. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message and any attachments which arise as a result of e-mail transmission.
If verification is required please request a hard-copy version. This message is provided for information purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments.
Canadian Imperial Bank of Commerce is a bank incorporated in Canada pursuant to the Bank Act(Canada)with its Head office at Toronto ,Canada,registered UK branch: Cottons Centre,Cottons Lane,London SE1 2QL.UK ,registration number FC001165,branch number BR000397; CIBC World Markets plc is incorporated and registered in England &Wales,registration number 2733036,registered office: Cottons Centre,aforesaid.

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