Skip to content

Instantly share code, notes, and snippets.

View moonmagian's full-sized avatar

Magical Moon moonmagian

  • BeiJing
View GitHub Profile
@moonmagian
moonmagian / implement.hpp
Created June 7, 2020 18:53
header only library to help implementing concept for a class
// This header only library is usued to check whether a class satisfies a concept.
// When compiling, an error will happen if the class doesn't satisfy the concept.
// IDEs like QtCreator and CLion will also display an error for it whiling editing.
// This is useful when you want to satisfy a concept by implementing methods one by one.
// (without checking the definition of the concept over time).
// usage: implement(class, concept, unique name for the implementation)
// define DISABLE_IMPL_CHECK to disable the macro.
#ifndef IMPLEMENT_CONCEPT_HPP
#define IMPLEMENT_CONCEPT_HPP