我看到一段累世的代码:
template<template <typename> class _Alloc>
class ACE_STL_Allocator : public ACE_Allocator
{
public:
typedef _Alloc<char> alloc_type;
public:
/// These methods are defined.
virtual void *malloc (size_t nbytes);
virtual void *calloc (size_t nbytes, char initial_value = '\0');
virtual void *calloc (size_t n_elem, size_t elem_size, char initial_value = '\0');
virtual void free (void *ptr);
/// These methods are no-ops.
virtual int remove (void);
virtual int bind (const char *name, void *pointer, int duplicates = 0);
virtual int trybind (const char *name, void *&pointer);
virtual int find (const char *name, void *&pointer);
virtual int find (const char *name);
virtual int unbind (const char *name);
virtual int unbind (const char *name, void *&pointer);
virtual int sync (ssize_t len = -1, int flags = MS_SYNC);
virtual int sync (void *addr, size_t len, int flags = MS_SYNC);
virtual int protect (ssize_t len = -1, int prot = PROT_RDWR);
virtual int protect (void *addr, size_t len, int prot = PROT_RDWR);
#if defined (ACE_HAS_MALLOC_STATS)
virtual void print_stats (void) const;
#endif /* ACE_HAS_MALLOC_STATS */
virtual void dump (void) const;
private:
alloc_type allocator;
};
请问是不是这么用的啊?
我编译的时候为什么说没alloc_type 这个类型呢?