|
Boost Users : |
Subject: Re: [Boost-users] [mpl] defaults with associative sequence
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2010-03-05 12:38:15
El 05/03/2010 06:31 a.m., Manfred Doudar escribió:
>
> Hi,
>
> Maybe I am misreading the documentation, but if I have an mpl::map and
> try and get an element associated with a key all's good, while if I
> assign a default - I get an error that mpl::at only takes 2 and
> not 3 template parameters.
>
> Am I doing something blatantly wrong?
>
No. The mpl::at version that takes a default parameter does not exist.
Documentation and source code are out of synch. When I need it I use
this implementation:
typename boost::mpl::eval_if<
typename boost::mpl::has_key< Map, Key >::type
, boost::mpl::at< Map, Key >
, boost::mpl::identity< Default >
>::type
Agustín K-ballo Bergé.-
http://talesofcpp.blogspot.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net