Access boost::function arguments


Is it possible to access the arguments contained in a boost::function type?

I'd like to be able to retrieve the address of the function to be called, and the values of the arguments provided for that function.


boost::function erases the implementation type, but if you know it, you can cast to it; since boost::function are comparable by value (== !=) the information is clearly available.

It looks like (from the function_base superclass of functionN) you can get the implementation object with:


Which will return NULL if you provided the wrong concrete type.

Also in function_base (probably not helpful beyond the target method above):

public: // should be protected, but GCC 2.95.3 will fail to allow access detail::function::vtable_base* vtable; mutable detail::function::function_buffer functor;

vtable gives you access to:

struct vtable_base { void (*manager)(const function_buffer& in_buffer, function_buffer& out_buffer, functor_manager_operation_type op); };

which can get you the typeid of the functor:

case get_functor_type_tag: out_buffer.type.type = &typeid(F); out_buffer.type.const_qualified = in_buffer.obj_ref.is_const_qualified; out_buffer.type.volatile_qualified = in_buffer.obj_ref.is_volatile_qualified; return; }

function_buffer (functor) is only useful for refs to function objects, bound (this is fixed) member functions ptrs, and free functions, where you haven't bound any arguments


  • The correct order to load Google Client api gapi and angular js
  • Loading while scrolling on Codeigniter
  • Conditional count and group by in R
  • How to compile typescript files in a specific folder with Angular Quickstart
  • Generating cookie from website that implements testcookie-nginx-module
  • Iterrating in DataFrame and writing down the index of the values where a condition is met
  • How to use web sockets for communication between angular app and composer-rest-server?
  • Generic return type of non-explicit generic type declared by wildcard
  • .cs files can't be opened anymore in VS 2013 Professional Update 4
  • What is the difference between Root Class & Base Class in Objective-C?
  • How is a large, spread out company supposed to work with the iOS Developer Program?
  • Where can I download android sdk manually? [closed]
  • How to correctly use shouldCompactOnLaunch in RealmSwift
  • Android google maps v2 execute asynctask when user stops moving the camera
  • iTunes Store operation failed. You must supply a CFBundleIdentifier for this request
  • When does HttpUrlConnection.usingProxy() return true?
  • Sql - SELECT rows until the sum of a row is a certain value
  • boost fusion: strange problem depending on number of elements on a vector
  • how to implement search for 2 different table data?
  • jquery mobile loadPage not working
  • How to include full .NET prerequisite for Wix Burn installer
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How do I configure my settings file to work with unit tests?
  • Qt: Run a script BEFORE make
  • Is it possible to post an object from jquery to bottle.py?
  • unknown Exception android
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Django query for large number of relationships
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • How can I use `wmic` in a Windows PE script?
  • failed to connect to specific WiFi in android programmatically
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal
  • How to push additional view controllers onto NavigationController but keep the TabBar?
  • How can I use threading to 'tick' a timer to be accessed by other threads?