M
Manzanita
Hi.
VC++ 7.0 issues this error when i try to make a container out of two
std::map, i want this container to provide me with o(log(n)) searches in
both types: key_type and mapped_type, and some further features. The code
and the error are like follows. Any workaround will be very helpful.
Thank you very much in advance.
David.
-------- mapa.h ---------
#include<map>
namespace David{
using namespace std;
template<class T1, class T2, class Cmp1 = less<T1>,
class Cmp2 = less<T2>, class A1 = allocator<pair<const T1, T2> >,
class A2 = allocator<pair<const T2, T1> > > class mapa{
private:
map<const T1, T2, Cmp1, A1> map1;
map<const T2, T1, Cmp2, A2> map2;
typedef const T1 key_type;
typedef T2 mapped_type;
};
----------- end of mapa.h ---
----------- main.cpp --------
int main(){
David::mapa<int, char> gMap;
}
-----------------------------
C:\Archivos de programa\Microsoft Visual Studio .NET\Vc7\include\xmemory
(87): error C2535: 'std::allocator<_Ty>:ointer std::allocator
<_Ty>::address(std::allocator<_Ty>::reference) const' : member function
already declared or defined
with
[
_Ty=const std::_Tree<std::_Tmap_traits<const
char,int,std::less<char>,std::allocator<std:air<const
char,int>>,false>>::key_type
]
VC++ 7.0 issues this error when i try to make a container out of two
std::map, i want this container to provide me with o(log(n)) searches in
both types: key_type and mapped_type, and some further features. The code
and the error are like follows. Any workaround will be very helpful.
Thank you very much in advance.
David.
-------- mapa.h ---------
#include<map>
namespace David{
using namespace std;
template<class T1, class T2, class Cmp1 = less<T1>,
class Cmp2 = less<T2>, class A1 = allocator<pair<const T1, T2> >,
class A2 = allocator<pair<const T2, T1> > > class mapa{
private:
map<const T1, T2, Cmp1, A1> map1;
map<const T2, T1, Cmp2, A2> map2;
typedef const T1 key_type;
typedef T2 mapped_type;
};
----------- end of mapa.h ---
----------- main.cpp --------
int main(){
David::mapa<int, char> gMap;
}
-----------------------------
C:\Archivos de programa\Microsoft Visual Studio .NET\Vc7\include\xmemory
(87): error C2535: 'std::allocator<_Ty>:ointer std::allocator
<_Ty>::address(std::allocator<_Ty>::reference) const' : member function
already declared or defined
with
[
_Ty=const std::_Tree<std::_Tmap_traits<const
char,int,std::less<char>,std::allocator<std:air<const
char,int>>,false>>::key_type
]