M
mergaite_lietuvaite
Hi,
I try to use map. My code is very easy, but there are some errors....
(by compiling). Plaese, could you say, what I do wrong..
struct less_array
{
bool operator()(const FArray p1, const FArray p2) const
{
return p1 < p2 ;
}
};
int main(){
....
map<const FArray, vector<FArray>, less_array> my_map;
const vector<FArray>& vert1 = .....getVert1(); // a vector of.
vector<FArray>::const_iterator vert = vert1.begin();
if(my_map.find(vert) == my_map.end()) // line 172 in code
cout<<"map is empty"<<endl;
my_map[vert]= new FArray(); // line 194 in code
.....
}
Compiler gets error-message because of my_map-find and my_map[vert].
Compiler message is:
....
FDualMarchingCubesAlgorithm.cc:176: error: no matching function for
call to `
std::map<const FArray, std::vector<FArray, std::allocator<FArray> >,
FDualMarchingCubesAlgorithm::less_array,
std::allocator<std:
air<const FArray,
std::vector<FArray, std::allocator<FArray> > > > >::find(
__gnu_cxx::__normal_iterator<const FArray*, std::vector<FArray,
std::allocator<FArray> > >&)'
/usr/include/g++/bits/stl_map.h:468: error: candidates are: typename
std::_Rb_tree<_Key, std:
air<const _Key, _Tp>,
std::_Select1st<std:
air<const _Key, _Tp> >, _Compare,
_Alloc>::iterator
std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Key&) [with _Key
= const
FArray, _Tp = std::vector<FArray, std::allocator<FArray> >, _Compare
=
FDualMarchingCubesAlgorithm::eqpos, _Alloc =
std::allocator<std:
air<const
FArray, std::vector<FArray, std::allocator<FArray> > > >]
.....
DualMarchingCubesAlgorithm.cc:194: error: no match for 'operator[]' in
'
my_map[vert]'
......
thank you on advance!
Joana
I try to use map. My code is very easy, but there are some errors....
(by compiling). Plaese, could you say, what I do wrong..
struct less_array
{
bool operator()(const FArray p1, const FArray p2) const
{
return p1 < p2 ;
}
};
int main(){
....
map<const FArray, vector<FArray>, less_array> my_map;
const vector<FArray>& vert1 = .....getVert1(); // a vector of.
vector<FArray>::const_iterator vert = vert1.begin();
if(my_map.find(vert) == my_map.end()) // line 172 in code
cout<<"map is empty"<<endl;
my_map[vert]= new FArray(); // line 194 in code
.....
}
Compiler gets error-message because of my_map-find and my_map[vert].
Compiler message is:
....
FDualMarchingCubesAlgorithm.cc:176: error: no matching function for
call to `
std::map<const FArray, std::vector<FArray, std::allocator<FArray> >,
FDualMarchingCubesAlgorithm::less_array,
std::allocator<std:
std::vector<FArray, std::allocator<FArray> > > > >::find(
__gnu_cxx::__normal_iterator<const FArray*, std::vector<FArray,
std::allocator<FArray> > >&)'
/usr/include/g++/bits/stl_map.h:468: error: candidates are: typename
std::_Rb_tree<_Key, std:
std::_Select1st<std:
_Alloc>::iterator
std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Key&) [with _Key
= const
FArray, _Tp = std::vector<FArray, std::allocator<FArray> >, _Compare
=
FDualMarchingCubesAlgorithm::eqpos, _Alloc =
std::allocator<std:
FArray, std::vector<FArray, std::allocator<FArray> > > >]
.....
DualMarchingCubesAlgorithm.cc:194: error: no match for 'operator[]' in
'
my_map[vert]'
......
thank you on advance!
Joana