什麼::確實符合: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