actor.qbk 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. [/==============================================================================
  2. Copyright (C) 2001-2010 Joel de Guzman
  3. Copyright (C) 2001-2005 Dan Marsden
  4. Copyright (C) 2001-2010 Thomas Heller
  5. Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. ===============================================================================/]
  8. [section Actor]
  9. The `Actor` is the main concept behind the library. Actors are function objects.
  10. An actor can accept 0 to `BOOST_PHOENIX_LIMIT` arguments.
  11. [note You can set `BOOST_PHOENIX_LIMIT`, the predefined maximum arity an
  12. actor can take. By default, `BOOST_PHOENIX_LIMIT` is set to 10.]
  13. Phoenix supplies an `actor` class template whose specializations
  14. model the `Actor` concept. `actor` has one template parameter, `Expr`,
  15. that supplies the underlying expression to evaluate.
  16. template <typename Expr>
  17. struct actor
  18. {
  19. return_type
  20. operator()() const;
  21. return_type
  22. operator()();
  23. template <typename T0>
  24. return_type
  25. operator()(T0& _0) const;
  26. template <typename T0>
  27. return_type
  28. operator()(T0 const& _0) const;
  29. template <typename T0>
  30. return_type
  31. operator()(T0& _0);
  32. template <typename T0>
  33. return_type
  34. operator()(T0 const& _0);
  35. //...
  36. };
  37. The actor class accepts the arguments through a set of function call operators
  38. for 0 to `BOOST_PHOENIX_LIMIT` arities (Don't worry about the details, for now. Note, for example,
  39. that we skimed over the details regarding `return_type`). The arguments
  40. are then forwarded to the actor's `Expr` for evaluation.
  41. [endsect]