Boost logo

Boost Users :

Subject: [Boost-users] Boost.Bimap vector_of element access VS 9 compilation errors
From: John Eddy (johneddy101_at_[hidden])
Date: 2011-08-17 17:14:17


Hello,

I’m having difficulty figuring out how to access elements from a vector_of
view in a bimap. The following code does not compile in VS 2008.

#include <string>
#include <iostream>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/vector_of.hpp>

using namespace std;
using namespace boost::bimaps;

int main()
{
    typedef bimap< string, vector_of<int> > bimap_type;
    bimap_type bm;

    bm.insert(bimap_type::value_type("zero", 0));
    bm.insert(bimap_type::value_type("one", 1));

    const bimap_type::right_map& right = bm.right;

    // Both of the lines below cause compilation failure with vc++ 9.0.
    bm.right[0];
    //bm.right.at(0);

    return 0;
}

Can anyone see what I’m doing wrong or is there some other means of accessing
the elements of the map via the vector?

Thanks,
John


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