Skip to content

Instantly share code, notes, and snippets.

@badair
badair / function_type.cpp
Last active December 17, 2018 18:07
function_type - reference implementation
/*
(c) copyright Barrett Adair 2017
Distributed under the Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
@badair
badair / tmp.cpp
Last active July 12, 2017 01:42
flow graph drawn at compile-time
/*<-
Copyright Barrett Adair 2016-2017
All rights reserved
->*/
// need to add support for per-node concurrecy limits
// need to add support for multifunction nodes by using
// boost::callable_traits to inspect the 2nd parameter type
@badair
badair / explanation.md
Last active May 25, 2016 19:10
This is a reply to the first comment on my StackOverflow answer here: http://stackoverflow.com/a/37444724/2397809

The interface and behavior for the following traits and metafunctions (as they currently stand on the CallableTraits develop branch) are unlikely to change, for the most part. I explain what I mean by "for the most part" after this list:

  • add_member_const
  • add_member_volatile
  • add_member_cv
  • add_member_lvalue_reference
  • add_member_rvalue_reference
  • add_varargs
  • remove_member_const
  • remove_member_cv
@badair
badair / 1 - interface.md
Last active May 6, 2016 10:27
Revisiting the Boost.FunctionTypes interface example

The Boost.FunctionTypes interface example can be found in your Boost install, at ${BOOST_ROOT}/libs/function_types/example/interface_example.cpp.

The example produces a macro for defining Java-style interfaces using type erasure for virtual dispatch, instead of inheritance polymorphism. The macro is used like this:

BOOST_EXAMPLE_INTERFACE( interface_x,
  (( a_func, (void)(int) , const_qualified ))
  (( a_func, (void)(long), const_qualified ))
 (( another_func, (int) , non_const ))