什么::确实符合:return :: operator new(size,:: std :: nothrow); 以及为什么类使用模板时,有没有使用模板类型T关于范围解析运算符在C++中的困惑
template<typename T>
class DefaultMemoryAllocator
{
public:
static inline void *Allocate(size_t size)
{
return ::operator new(size, ::std::nothrow);
}
static inline void Deallocate(void *pointer, size_t size)
{
::operator delete(pointer);
}
};
它是“范围解析运算符”。此类型的原因在这里解释http://stackoverflow.com/questions/4173254/what-is-the-curiously-recurring-template-pattern-crtp – StoryTeller