Skip to content

Instantly share code, notes, and snippets.

@d1ff
Created November 18, 2014 19:26
Show Gist options
  • Save d1ff/2d3b3119b36676fbc855 to your computer and use it in GitHub Desktop.
Save d1ff/2d3b3119b36676fbc855 to your computer and use it in GitHub Desktop.
boost type erasure
#include <boost/type_erasure/any.hpp>
#include <boost/type_erasure/member.hpp>
#include <boost/mpl/vector.hpp>
BOOST_TYPE_ERASURE_MEMBER((has_init), init, 0)
BOOST_TYPE_ERASURE_MEMBER((has_loadIntoTexture), loadIntoTexture, 1)
using _self = boost::type_erasure::_self;
using initiable_concept = has_init<void(), _self>;
using loader_concept = has_loadIntoTexture<void(shared_ptr<AVFrame>), _self>;
using frame_loader_requirement = boost::mpl::vector<
initiable_concept,
loader_concept
>;
using any_frame_loader = boost::type_erasure::any<frame_loader_requirement, const _self&>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment