In theory, I should be able to use a custom pointer type and deleter in order to have unique_ptr manage an object that is not a pointer. I tried the following c
Making Nicol Bolas class more general:
template
class Handle
{
public:
Handle(T handle):m_handle(handle){}
Handle(std::nullptr_t):m_handle(null_val){}
operator T(){return m_handle;}
bool operator==(const Handle& other) const
{return other.m_handle==m_handle;}
private:
T m_handle;
};
typedef Handle FileDescriptor;
typedef Handle GlResource; // according to http://stackoverflow.com/questions/7322147/what-is-the-range-of-opengl-texture-id
// ...
I am not sure if I should have default template parameter values or not.