I created a struct
type which contains two variables. I use this data type within a vector
, that is again stored in a map
, as following:
struct A {
int x;
Y y;
A() {};
A(int _x, Y _y) { x=_x, y=_y; };
};
typedef std::vector<A> LA;
typedef std::map<uint,LA> MB;
MB b;
When I try to use an iterator, such as
std::vector<LA>::iterator it = b[x].begin();
the compiler gives this error:
error: no viable conversion from '__wrap_iter< A *>' to '__wrap_iter< std::__1::vector < A, std::__1::allocator< A> > *>' std::vector< LA>::iterator it = b[x].begin();
candidate constructor (the implicit copy constructor) not viable: no known conversion from 'iterator' (aka '__wrap_iter< pointer>') to 'const std::__1::__wrap_iter< std::__1::vector< A, > std::__1::allocator< A> > *> &' for 1st argument class__wrap_iter
candidate constructor (the implicit move constructor) not viable: no known conversion from 'iterator' (aka > '__wrap_iter< pointer>') to 'std::__1::__wrap_iter< std::__1::vector< A, > std::__1::allocator< A> > *> &&' for 1st argument class__wrap_iter
candidate template ignored: disabled by 'enable_if'
What is the reason for this error? Although I tried several things like operator overloading, I could not solve this. Any help is appreciated.
LA::iterator it = b[x].begin();
β paulsm4