www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - allocators and the vc6-stl

reply "Marc Kamradt" <marc spieleentwickler.org> writes:
Hi!

I was just trying to use the stlsoft::malloc_allocator with the std::map
from the Visual C++ 6.0 compiler. This brought up a compile error and I was
wondering if anyone has an idea if that is an error on my side or maybe an
incompability issue.

Here is the error:

c:\programme\microsoft visual studio\vc98\include\xtree(587) : error C2664:
'void __thiscall stlsoft::new_allocator<struct
gtl::CMemoryTracker::SMemoryInfo>::deallocate(struct
gtl::CMemoryTracker::SMemoryInfo *,unsigned int)' : Konvertierung des Par
ameters 1 von 'struct std::_Tree<int,struct std::pair<int const ,struct
gtl::CMemoryTracker::SMemoryInfo>,struct std::map<int,struct
gtl::CMemoryTracker::SMemoryInfo,struct std::less<int>,class
stlsoft::new_allocator<struct gtl::CMemoryTracker::SMem
oryInfo> >::_Kfn,struct std::less<int>,class stlsoft::new_allocator<struct
gtl::CMemoryTracker::SMemoryInfo> >::_Node *' in 'struct
gtl::CMemoryTracker::SMemoryInfo *' nicht moeglich
        Die Typen, auf die verwiesen wird, sind nicht verwandt; die
Konvertierung erfordert einen reinterpret_cast-Operator oder eine
Typumwandlung im C- oder Funktionsformat
        c:\programme\microsoft visual studio\vc98\include\xtree(587) : Bei
der Kompilierung der Member-Funktion 'void __thiscall std::_Tree<int,struct
std::pair<int const ,struct gtl::CMemoryTracker::SMemoryInfo>,struct
std::map<int,struct gtl::CMem
oryTracker::SMemoryInfo,struct std::less<int>,class
stlsoft::new_allocator<struct gtl::CMemoryTracker::SMemoryInfo>
::_Kfn,struct std::less<int>,class stlsoft::new_allocator<struct

t,struct std::pair<int const ,struct gtl::CMemoryTracker::SMemoryInfo>,struct std::map<int,struct gtl::CMemoryTracker::SMemoryInfo,struct std::less<int>,class stlsoft::new_allocator<struct gtl::CMemoryTracker::SMemoryInfo>
::_Kfn,struct std::less<i

::_Node *)' der Klassenvorlage

Here is the code line from the Visual C++ 6.0 _Tree implementation that causes the problem: void _Freenode(_Nodeptr _S) {allocator.deallocate(_S, 1); } Regards, Marc Kamradt
Aug 15 2003
next sibling parent "Marc Kamradt" <marc spieleentwickler.org> writes:
In case you are wondering. I was trying to see if the error also occurs when
I use the new_allocator. The error is the same with the new_allocator and
the malloc_allocator.

Regards,

Marc Kamradt




"Marc Kamradt" <marc spieleentwickler.org> schrieb im Newsbeitrag
news:bhjeb3$77f$1 digitaldaemon.com...
 Hi!

 I was just trying to use the stlsoft::malloc_allocator with the std::map
 from the Visual C++ 6.0 compiler. This brought up a compile error and I

 wondering if anyone has an idea if that is an error on my side or maybe an
 incompability issue.

 Here is the error:

 c:\programme\microsoft visual studio\vc98\include\xtree(587) : error

 'void __thiscall stlsoft::new_allocator<struct
 gtl::CMemoryTracker::SMemoryInfo>::deallocate(struct
 gtl::CMemoryTracker::SMemoryInfo *,unsigned int)' : Konvertierung des Par
 ameters 1 von 'struct std::_Tree<int,struct std::pair<int const ,struct
 gtl::CMemoryTracker::SMemoryInfo>,struct std::map<int,struct
 gtl::CMemoryTracker::SMemoryInfo,struct std::less<int>,class
 stlsoft::new_allocator<struct gtl::CMemoryTracker::SMem
 oryInfo> >::_Kfn,struct std::less<int>,class stlsoft::new_allocator<struct
 gtl::CMemoryTracker::SMemoryInfo> >::_Node *' in 'struct
 gtl::CMemoryTracker::SMemoryInfo *' nicht moeglich
         Die Typen, auf die verwiesen wird, sind nicht verwandt; die
 Konvertierung erfordert einen reinterpret_cast-Operator oder eine
 Typumwandlung im C- oder Funktionsformat
         c:\programme\microsoft visual studio\vc98\include\xtree(587) : Bei
 der Kompilierung der Member-Funktion 'void __thiscall

 std::pair<int const ,struct gtl::CMemoryTracker::SMemoryInfo>,struct
 std::map<int,struct gtl::CMem
 oryTracker::SMemoryInfo,struct std::less<int>,class
 stlsoft::new_allocator<struct gtl::CMemoryTracker::SMemoryInfo>
::_Kfn,struct std::less<int>,class stlsoft::new_allocator<struct

t,struct std::pair<int const ,struct gtl::CMemoryTracker::SMemoryInfo>,struct std::map<int,struct gtl::CMemoryTracker::SMemoryInfo,struct std::less<int>,class stlsoft::new_allocator<struct gtl::CMemoryTracker::SMemoryInfo>
::_Kfn,struct std::less<i

::_Node *)' der Klassenvorlage

Here is the code line from the Visual C++ 6.0 _Tree implementation that causes the problem: void _Freenode(_Nodeptr _S) {allocator.deallocate(_S, 1); } Regards, Marc Kamradt

Aug 15 2003
prev sibling next sibling parent reply "Matthew Wilson" <matthew stlsoft.org> writes:
Marc

Hmm ... surprised but not shocked.

I'm planning to release 1.6.5 next week, so will have it sorted by then.

Sorry for the inconvenience.

Cheers

Matthew


-- 
Matthew Wilson

STLSoft moderator and C++ monomaniac

mailto:matthew stlsoft.org
http://www.stlsoft.org
news://news.digitalmars.com/c++.stlsoft

"I can't sleep nights till I found out who hurled what ball through what
apparatus" -- Dr Niles Crane

----------------------------------------------------------------------------
---

"Marc Kamradt" <marc spieleentwickler.org> wrote in message
news:bhjeb3$77f$1 digitaldaemon.com...
 Hi!

 I was just trying to use the stlsoft::malloc_allocator with the std::map
 from the Visual C++ 6.0 compiler. This brought up a compile error and I

 wondering if anyone has an idea if that is an error on my side or maybe an
 incompability issue.

 Here is the error:

 c:\programme\microsoft visual studio\vc98\include\xtree(587) : error

 'void __thiscall stlsoft::new_allocator<struct
 gtl::CMemoryTracker::SMemoryInfo>::deallocate(struct
 gtl::CMemoryTracker::SMemoryInfo *,unsigned int)' : Konvertierung des Par
 ameters 1 von 'struct std::_Tree<int,struct std::pair<int const ,struct
 gtl::CMemoryTracker::SMemoryInfo>,struct std::map<int,struct
 gtl::CMemoryTracker::SMemoryInfo,struct std::less<int>,class
 stlsoft::new_allocator<struct gtl::CMemoryTracker::SMem
 oryInfo> >::_Kfn,struct std::less<int>,class stlsoft::new_allocator<struct
 gtl::CMemoryTracker::SMemoryInfo> >::_Node *' in 'struct
 gtl::CMemoryTracker::SMemoryInfo *' nicht moeglich
         Die Typen, auf die verwiesen wird, sind nicht verwandt; die
 Konvertierung erfordert einen reinterpret_cast-Operator oder eine
 Typumwandlung im C- oder Funktionsformat
         c:\programme\microsoft visual studio\vc98\include\xtree(587) : Bei
 der Kompilierung der Member-Funktion 'void __thiscall

 std::pair<int const ,struct gtl::CMemoryTracker::SMemoryInfo>,struct
 std::map<int,struct gtl::CMem
 oryTracker::SMemoryInfo,struct std::less<int>,class
 stlsoft::new_allocator<struct gtl::CMemoryTracker::SMemoryInfo>
::_Kfn,struct std::less<int>,class stlsoft::new_allocator<struct

t,struct std::pair<int const ,struct gtl::CMemoryTracker::SMemoryInfo>,struct std::map<int,struct gtl::CMemoryTracker::SMemoryInfo,struct std::less<int>,class stlsoft::new_allocator<struct gtl::CMemoryTracker::SMemoryInfo>
::_Kfn,struct std::less<i

::_Node *)' der Klassenvorlage

Here is the code line from the Visual C++ 6.0 _Tree implementation that causes the problem: void _Freenode(_Nodeptr _S) {allocator.deallocate(_S, 1); } Regards, Marc Kamradt

Aug 16 2003
parent "Marc Kamradt" <marc spieleentwickler.org> writes:
Great! I'll give it another try with the next release.

Regards,

Marc



"Matthew Wilson" <matthew stlsoft.org> schrieb im Newsbeitrag
news:bhl012$23kp$1 digitaldaemon.com...
 Marc

 Hmm ... surprised but not shocked.

 I'm planning to release 1.6.5 next week, so will have it sorted by then.

 Sorry for the inconvenience.

 Cheers

 Matthew


 -- 
 Matthew Wilson

 STLSoft moderator and C++ monomaniac

 mailto:matthew stlsoft.org
 http://www.stlsoft.org
 news://news.digitalmars.com/c++.stlsoft

 "I can't sleep nights till I found out who hurled what ball through what
 apparatus" -- Dr Niles Crane

 --------------------------------------------------------------------------

 ---

 "Marc Kamradt" <marc spieleentwickler.org> wrote in message
 news:bhjeb3$77f$1 digitaldaemon.com...
 Hi!

 I was just trying to use the stlsoft::malloc_allocator with the std::map
 from the Visual C++ 6.0 compiler. This brought up a compile error and I

 wondering if anyone has an idea if that is an error on my side or maybe


 incompability issue.

 Here is the error:

 c:\programme\microsoft visual studio\vc98\include\xtree(587) : error

 'void __thiscall stlsoft::new_allocator<struct
 gtl::CMemoryTracker::SMemoryInfo>::deallocate(struct
 gtl::CMemoryTracker::SMemoryInfo *,unsigned int)' : Konvertierung des


 ameters 1 von 'struct std::_Tree<int,struct std::pair<int const ,struct
 gtl::CMemoryTracker::SMemoryInfo>,struct std::map<int,struct
 gtl::CMemoryTracker::SMemoryInfo,struct std::less<int>,class
 stlsoft::new_allocator<struct gtl::CMemoryTracker::SMem
 oryInfo> >::_Kfn,struct std::less<int>,class


 gtl::CMemoryTracker::SMemoryInfo> >::_Node *' in 'struct
 gtl::CMemoryTracker::SMemoryInfo *' nicht moeglich
         Die Typen, auf die verwiesen wird, sind nicht verwandt; die
 Konvertierung erfordert einen reinterpret_cast-Operator oder eine
 Typumwandlung im C- oder Funktionsformat
         c:\programme\microsoft visual studio\vc98\include\xtree(587) :


 der Kompilierung der Member-Funktion 'void __thiscall

 std::pair<int const ,struct gtl::CMemoryTracker::SMemoryInfo>,struct
 std::map<int,struct gtl::CMem
 oryTracker::SMemoryInfo,struct std::less<int>,class
 stlsoft::new_allocator<struct gtl::CMemoryTracker::SMemoryInfo>
::_Kfn,struct std::less<int>,class stlsoft::new_allocator<struct

t,struct std::pair<int const ,struct gtl::CMemoryTracker::SMemoryInfo>,struct std::map<int,struct gtl::CMemoryTracker::SMemoryInfo,struct std::less<int>,class stlsoft::new_allocator<struct gtl::CMemoryTracker::SMemoryInfo>
::_Kfn,struct std::less<i



::_Node *)' der Klassenvorlage

Here is the code line from the Visual C++ 6.0 _Tree implementation that causes the problem: void _Freenode(_Nodeptr _S) {allocator.deallocate(_S, 1); } Regards, Marc Kamradt


Aug 17 2003
prev sibling parent "Matthew Wilson" <matthew stlsoft.org> writes:
Ok, here're the problems:

- The VC++ 6 (and prev) STLs need for the first parameter to an allocator's
deallocate() to be void *, not T*. So I've fixed that by having it be of
type deallocate_pointer, which is defined appropriately in all allocator
classes.

- The VC++ 6 (and prev) STLs assume the presence of a _Charalloc() member,
which has the semantics of a single-parameter allocate(), and which returns
char *. I've added a conditionally compiled function into all allocator
classes.

- As it transpires, the DMC/SGI requires that the allocate() and
deallocate() methods are static, so I've added that into all classes as
well, except winstl::shell_allocator as it has a member pointer to the shell
allocator (even though this has been the COM task allocator since about
Win98 / NT4 sp ??).

These changes will be in 1.6.5, which I'm hoping to release this week.
There's a lot of repeated crufty stuff here, and so I plan to factor all but
the mem-api-specific stuff into a base template, which all specific classes
will share, for 1.7.1

btw, please note that VC6 and prior do not implement the fourth template
param of map correcty. It should be

  new_allocator<pair<const int, int> > (substitute your allocator type here)

but is

 new_allocator<int>

There's nothing I can do to help here, I'm afraid, but there's a simple
example in ./test/stlsoft/allocator_test2/allocator_test2.cpp in the next
release which shows the ifdef-ing necessary to get a portable solution.

Cheers

Matthew

"Marc Kamradt" <marc spieleentwickler.org> wrote in message
news:bhjeb3$77f$1 digitaldaemon.com...
 Hi!

 I was just trying to use the stlsoft::malloc_allocator with the std::map
 from the Visual C++ 6.0 compiler. This brought up a compile error and I

 wondering if anyone has an idea if that is an error on my side or maybe an
 incompability issue.

 Here is the error:

 c:\programme\microsoft visual studio\vc98\include\xtree(587) : error

 'void __thiscall stlsoft::new_allocator<struct
 gtl::CMemoryTracker::SMemoryInfo>::deallocate(struct
 gtl::CMemoryTracker::SMemoryInfo *,unsigned int)' : Konvertierung des Par
 ameters 1 von 'struct std::_Tree<int,struct std::pair<int const ,struct
 gtl::CMemoryTracker::SMemoryInfo>,struct std::map<int,struct
 gtl::CMemoryTracker::SMemoryInfo,struct std::less<int>,class
 stlsoft::new_allocator<struct gtl::CMemoryTracker::SMem
 oryInfo> >::_Kfn,struct std::less<int>,class stlsoft::new_allocator<struct
 gtl::CMemoryTracker::SMemoryInfo> >::_Node *' in 'struct
 gtl::CMemoryTracker::SMemoryInfo *' nicht moeglich
         Die Typen, auf die verwiesen wird, sind nicht verwandt; die
 Konvertierung erfordert einen reinterpret_cast-Operator oder eine
 Typumwandlung im C- oder Funktionsformat
         c:\programme\microsoft visual studio\vc98\include\xtree(587) : Bei
 der Kompilierung der Member-Funktion 'void __thiscall

 std::pair<int const ,struct gtl::CMemoryTracker::SMemoryInfo>,struct
 std::map<int,struct gtl::CMem
 oryTracker::SMemoryInfo,struct std::less<int>,class
 stlsoft::new_allocator<struct gtl::CMemoryTracker::SMemoryInfo>
::_Kfn,struct std::less<int>,class stlsoft::new_allocator<struct

t,struct std::pair<int const ,struct gtl::CMemoryTracker::SMemoryInfo>,struct std::map<int,struct gtl::CMemoryTracker::SMemoryInfo,struct std::less<int>,class stlsoft::new_allocator<struct gtl::CMemoryTracker::SMemoryInfo>
::_Kfn,struct std::less<i

::_Node *)' der Klassenvorlage

Here is the code line from the Visual C++ 6.0 _Tree implementation that causes the problem: void _Freenode(_Nodeptr _S) {allocator.deallocate(_S, 1); } Regards, Marc Kamradt

Aug 19 2003