Adobe Systems Incorporated


Detailed Description

A ConvertibleToFunction is simply something which can be invoked using function notation - or something that boost::bind can convert to a function. Specifically, a ConvertibleToFunction can be:

  • A pointer to a function
  • A pointer to a class or struct data member (argument is a pointer or a reference to a struct/class instance)
  • A pointer to a class or struct member function (first argument is a pointer or a reference to a struct/class instance; Member function arguments follow in order)
  • A boost::reference_wrapper to a ConvertibleToFunction
  • A function object

Where functions are passed as template parameters in the Adobe Source Libraries, any ConvertibleToFunction may be used. The idea is that boost::bind(x, ...); is a valid expression where ... are arguments to x. x, in this case, is ConvertibleToFunction.

Refinement Of:
Associated Types:
F A type that is a model of ConvertibleToFunction
x1...xn An optional argument list for the type that is a model of ConvertibleToFunction
f Object of type F
Valid Expressions:
NameExpressionType requirementsReturn type
Convertible boost::bind(&f, x1...xn);   An invokable boost::function whose template argument is the function signature of f
Expression Semantics:
Complexity Guarantees:
Type(s) Modeling this Concept:
  • Anything that is acceptable to boost::bind.
Given a vector of structs...
struct my_struct { bool value_m; }
std::vector<my_struct> my_vector;

// Code here to fill the vector with some bools...
Writing the following would be an error:
iter = std::find_if(my_vector.begin(), my_vector.end(), &my_struct::value_m); // Error!
But because a pointer to a member is ConvertibleToFunction, and in this case the function meets the requirements of a predicate (that is, the accessing of value_m will return either true or false) we can write:
iter = adobe::find_if(my_vector.begin(), my_vector.end(), &my_struct::value_m); // works!
Further, because vector meets the requirements of a ConvertibleToRange, this can be shortened to:
iter = adobe::find_if(my_vector, &my_struct::value_m); // also works!

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google