Re: List and Maps

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Alamelu wrote:
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?????????????

Yes. However, you need to download and install boost first. See http://www.boost.org/more/getting_started.html

Note, you don't need to build boost to use the assign library, you just need to download boost, and add the boost directory to your include paths.

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

Using non-boost code, that should be:

char const* const AniArray[2] = {"Cat", "Dog"};
std::list<CString> const AniList(AniArray, AniArray + 2);
typedef std::map<CString,std::list> ANI_TYPE_MAP;
ANI_TYPE_MAP m_aniMap;
m_aniMap [_T("Animals")] = AniList;

Using boost, the first 2 lines become:

std::list<CString> const AniList(boost::assign::list_of("Cat")("Dog"));

Tom
.



Relevant Pages

  • Re: List and Maps
    ... How do i iterate through List in this case and the values in it. ... you need to download and install boost first. ... need to download boost, and add the boost directory to your include paths. ...
    (microsoft.public.vc.stl)
  • Re: python , Boost and straight (but complex) C code
    ... I write the following C source file: ... namespace {// Avoid cluttering the global namespace. ... Boost should not complain... ... Not all C code can be compiled by a C++ compiler. ...
    (comp.lang.python)
  • Re: python , Boost and straight (but complex) C code
    ... namespace {// Avoid cluttering the global namespace. ... yes, but C can be compiled with a C++ compiler, One can put C code in ... Boost should not complain... ...
    (comp.lang.python)
  • Re: python , Boost and straight (but complex) C code
    ... I write the following C source file: ... namespace {// Avoid cluttering the global namespace. ... Boost should not complain... ... Not all C code can be compiled by a C++ compiler. ...
    (comp.lang.python)
  • Re: using declarations and operator overloading?
    ... > Suppose I overload an operator in namespace A. How can I introduce it ... > int main{ ... I removed the Boost stuff. ...
    (comp.lang.cpp)