I'm working on a simple data structure and some functions that take various shapes and perform calculations on them. The shapes will be constructed out of real physical materials, and I need a way to count each segment length. The count and lengths are arbitrary, as are the number of lengths.
I know this code isn't complete, I'm just showing an outline of what I'm trying to accomplish.
When I try to refer to the .first or .second elements of segCounts.segment I get this compilation error:
unsigned int thickness;
struct SEG_PROPERTIES segProperties;
// For total length of all segments with same properties
unsigned int totalLength;
// first = length of segment
// second = count of segments with length
map <unsigned int, unsigned int> segment;
vector <SEG_COUNTS> segCounts;
// Misc code...
// Line in question
segCounts.segment.first = 5;
So I thought that maybe for some reason I need to specify using a pair in the declaration of segment...
error C2039: 'first' : is not a member of std::map<_Kty,_Ty>
But that gives me different errors, and I really don't think that's the way I'm supposed to declare a map. It's obvious I'm doing something wrong, maybe the syntax is eluding me. Anyone care to enlighten me?
map <pair<unsigned int, unsigned int> > segment;