Re: List and Maps
Hi Tom,
I tried the example given in the Link provided by you,
#include <boost/assign/list_inserter.hpp> // for 'insert()'
using namespace boost::assign;
but it says cannot open include file.
Is this supported in .Net 2003?????????????
This is what i am looking for .......
const std::list<CString> AniList = {"Cat", "Dog"};
typedef std::map<CString,std::list> ANI_TYPE_MAP;
ANI_TYPE_MAP m_aniMap;
m_ aniMap [_T(???Animals???)] = AniList
But dont know , if this is possible.....
Please clarify
"Tom Widmer [VC++ MVP]" wrote:
Alamelu wrote:
Can we populate std::list and std::Map at the time of declaring?
You mean at initialization, I think.
If yes how do we populate?
Both have several constructors to choose from. For example:
std::list<int> l(func_that_returns_a_list()); //using copy constructor
std::list<int> l(othercont.begin(), othercont.end()); //it range
int array[] = {1, 5, 6};
std::list<int> l(array, array + 3); //pointer range
std::map needs an iterator range of objects that are convertible to
map::value_type (which is pair<const key, value>).
Finally, the boost assign library might be of interest to you:
http://www.boost.org/libs/assign/doc/index.html
http://www.boost.org/libs/assign/doc/index.html#map_list_of
Tom