I tried to implement unique pointers to non-pointer as described here: One-liner for RAII on non pointer? and https://dzone.com/articles/c11-smart-pointers-are-not . But I always get an compiler error: /usr/include/c++/5/bits/unique_ptr.h:235:12: error: invalid operands of types ‘unsigned int’ and ‘std::nullptr_t’ to binary ‘operator!=’
This is my code:
struct ShaderDeleter
{
typedef GLuint pointer; // Note the added typedef
void operator()(GLuint shader) {
glDeleteShader(shader);
}
};
int main() {
std::unique_ptr<GLuint, ShaderDeleter> smart_shader{glCreateShader(GL_VERTEX_SHADER)};
}
What am I doing wrong?
Platform: Ubuntu 16.04
Compiler: g++
Aucun commentaire:
Enregistrer un commentaire