Click here to Skip to main content
15,914,165 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralClickety Police Pin
John M. Drescher18-Feb-04 16:45
John M. Drescher18-Feb-04 16:45 
GeneralMDI - Access to Doc From MainFrame Pin
jerry1211a18-Feb-04 13:23
jerry1211a18-Feb-04 13:23 
GeneralRe: MDI - Access to Doc From MainFrame Pin
krithika_Ramanujam18-Feb-04 19:28
krithika_Ramanujam18-Feb-04 19:28 
GeneralSetFieldDirty Question Pin
ElizabethC18-Feb-04 12:59
ElizabethC18-Feb-04 12:59 
GeneralVariables in my own dialog box Pin
satcat18-Feb-04 12:56
satcat18-Feb-04 12:56 
GeneralRe: Variables in my own dialog box Pin
Prakash Nadar18-Feb-04 13:18
Prakash Nadar18-Feb-04 13:18 
GeneralRe: Variables in my own dialog box Pin
satcat18-Feb-04 13:56
satcat18-Feb-04 13:56 
Generalstd::allocator inheritance problem (please help) Pin
Jon McClure18-Feb-04 12:02
Jon McClure18-Feb-04 12:02 
I recently upgraded to Visual Studio 2003 from a version of Visual Studio .Net that is a few years old. After doing so, I converted an old (working) project file to the new version and tried to build.

I'm getting various versions of the same error, and I have no idea what's wrong. My only guess is that it has something to do with the inheritance from std::allocator in class_allocator. I realize its a rather long mess, but this is the first error straight from the build log.

Here's the error, which is basically repeated in various ways about 2000 times:

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\map(25) : error C2248: 'class_allocator<type,blockCount,alignment>::rebind<U>::other' : cannot access inaccessible typedef declared in class 'class_allocator<type,blockCount,alignment>'
with
[
type=std::_Tmap_traits<UString,ResObject *,std::less<UString>,class_allocator<std::pair<UString,ResObject *>>,false>::value_type,
blockCount=256,
alignment=8,
U=std::_Tmap_traits<UString,ResObject *,std::less<UString>,class_allocator<std::pair<UString,ResObject *>>,false>::value_type
]
and
[
type=std::_Tmap_traits<UString,ResObject *,std::less<UString>,class_allocator<std::pair<UString,ResObject *>>,false>::value_type,
blockCount=256,
alignment=8
]
..\clientCommon\Allocator.h(76) : see declaration of 'class_allocator<type,blockCount,alignment>::rebind<U>::other'
with
[
type=std::_Tmap_traits<UString,ResObject *,std::less<UString>,class_allocator<std::pair<UString,ResObject *>>,false>::value_type,
blockCount=256,
alignment=8,
U=std::_Tmap_traits<UString,ResObject *,std::less<UString>,class_allocator<std::pair<UString,ResObject *>>,false>::value_type
]
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xtree(23) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
with
[
_Kty=UString,
_Ty=ResObject *,
_Pr=std::less<UString>,
_Alloc=class_allocator<std::pair<UString,ResObject *>>,
_Mfl=false
]
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xtree(65) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
with
[
_Traits=std::_Tmap_traits<UString,ResObject *,std::less<UString>,class_allocator<std::pair<UString,ResObject *>>,false>
]
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xtree(87) : see reference to class template instantiation 'std::_Tree_ptr<_Traits>' being compiled
with
[
_Traits=std::_Tmap_traits<UString,ResObject *,std::less<UString>,class_allocator<std::pair<UString,ResObject *>>,false>
]
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xtree(105) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
with
[
_Traits=std::_Tmap_traits<UString,ResObject *,std::less<UString>,class_allocator<std::pair<UString,ResObject *>>,false>
]
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\map(77) : see reference to class template instantiation 'std::_Tree<_Traits>
' being compiled
with
[
_Traits=std::_Tmap_traits<UString,ResObject *,std::less<UString>,class_allocator<std::pair<UString,ResObject *>>,false>
]
Shell\ResPool.h(71) : see reference to class template instantiation 'std::map<_Kty,_Ty,_Pr,_Alloc>' being compiled
with
[
_Kty=UString,
_Ty=ResObject *,
_Pr=std::less<UString>,
_Alloc=class_allocator<std::pair<UString,ResObject *>>
]

Here's the relevant code:

template< class type, size_t blockCount = 256, size_t alignment = 8 >
class class_allocator : public std::allocator<type>
{
public:
// All of this weirdness is required to make it stl compatible
template <class U> struct rebind { typedef class_allocator<U,blockCount,alignment> other; }; //!< Allow containers to manufacture notes containing node+this
template <class U> class_allocator(const class_allocator<U,blockCount,alignment>&) {} //!< Whatever sort of constructor, this eats them all to provide compatibility
class_allocator() {}

static type* allocate( size_t count = 1, void* = NULL ) { return (type*)pool_allocator<type, sizeof (type), blockCount, alignment>::allocate( count * sizeof (type) ); }
static void deallocate( void* p, size_t = 0 ) { pool_allocator<type, sizeof (type), blockCount, alignment>::deallocate( p ); }

static size_t GetBlockCount() { return pool_allocator<type, sizeof (type), blockCount, alignment>::GetBlockCount(); }
static size_t GetFreeCount() { return pool_allocator<type, sizeof (type), blockCount, alignment>::GetFreeCount(); }
static size_t GetInstanceCount() { return pool_allocator<type, sizeof (type), blockCount, alignment>::GetInstanceCount(); }
};

Does anyone have any idea what's wrong? If not, does anyone have any idea where I could look to find out?

Thanks,
Jon McClure
GeneralRe: std::allocator inheritance problem (please help) Pin
Andrew Walker19-Feb-04 0:17
Andrew Walker19-Feb-04 0:17 
GeneralMessage Removed Pin
18-Feb-04 9:16
sussBryn Aspestrand18-Feb-04 9:16 
Generalcout behavior........ Pin
ns18-Feb-04 8:47
ns18-Feb-04 8:47 
GeneralRe: cout behavior........ Pin
Ravi Bhavnani18-Feb-04 8:58
professionalRavi Bhavnani18-Feb-04 8:58 
GeneralRe: cout behavior........ Pin
ns18-Feb-04 9:15
ns18-Feb-04 9:15 
GeneralRe: cout behavior........ Pin
Maximilien18-Feb-04 9:59
Maximilien18-Feb-04 9:59 
Generaloops! Pin
nss18-Feb-04 14:40
nss18-Feb-04 14:40 
GeneralRe: cout behavior........ Pin
Robert A. T. Káldy18-Feb-04 11:43
Robert A. T. Káldy18-Feb-04 11:43 
GeneralCombo Box Pin
DougW4818-Feb-04 8:40
DougW4818-Feb-04 8:40 
GeneralRe: Combo Box Pin
Ravi Bhavnani18-Feb-04 8:57
professionalRavi Bhavnani18-Feb-04 8:57 
GeneralRe: dialog mfc app Pin
David Crow18-Feb-04 5:58
David Crow18-Feb-04 5:58 
GeneralRe: dialog mfc app Pin
Irish_GUI18-Feb-04 6:52
Irish_GUI18-Feb-04 6:52 
GeneralRe: dialog mfc app Pin
David Crow18-Feb-04 7:00
David Crow18-Feb-04 7:00 
GeneralRe: dialog mfc app Pin
Irish_GUI18-Feb-04 8:19
Irish_GUI18-Feb-04 8:19 
GeneralRe: dialog mfc app Pin
David Crow18-Feb-04 8:34
David Crow18-Feb-04 8:34 
GeneralDLL global variables Pin
peterchen18-Feb-04 5:49
peterchen18-Feb-04 5:49 
GeneralRe: DLL global variables Pin
Steve S18-Feb-04 6:02
Steve S18-Feb-04 6:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.