object.qbk 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. [def __limit_note__
  9. The maximum number of actual parameters is limited by the
  10. preprocessor constant BOOST_PHOENIX_COMPOSITE_LIMIT. Note though, that this limit
  11. should not be greater than BOOST_PHOENIX_LIMIT. By default, `BOOST_PHOENIX_COMPOSITE_LIMIT`
  12. is set to `BOOST_PHOENIX_LIMIT` (See [link phoenix.actor Actor]).
  13. ]
  14. [section Object]
  15. The Object module deals with object construction, destruction and conversion.
  16. The module provides /"lazy"/ versions of C++'s object constructor, `new`,
  17. `delete`, `static_cast`, `dynamic_cast`, `const_cast` and `reinterpret_cast`.
  18. [section Construction]
  19. [*/Lazy constructors.../]
  20. #include <boost/phoenix/object/construct.hpp>
  21. Lazily construct an object from an arbitrary set of arguments:
  22. construct<T>(ctor_arg1, ctor_arg2, ..., ctor_argN);
  23. where the given parameters are the parameters to the constructor of the object of
  24. type T (This implies, that type T is expected to have a constructor with a
  25. corresponding set of parameter types.).
  26. Example:
  27. construct<std::string>(arg1, arg2)
  28. Constructs a `std::string` from `arg1` and `arg2`.
  29. [note __limit_note__ ]
  30. [endsect]
  31. [section New]
  32. [*/Lazy new.../]
  33. #include <boost/phoenix/object/new.hpp>
  34. Lazily construct an object, on the heap, from an arbitrary set of arguments:
  35. new_<T>(ctor_arg1, ctor_arg2, ..., ctor_argN);
  36. where the given parameters are the parameters to the contractor of the object of
  37. type T (This implies, that type T is expected to have a constructor with a
  38. corresponding set of parameter types.).
  39. Example:
  40. new_<std::string>(arg1, arg2) // note the spelling of new_ (with trailing underscore)
  41. Creates a `std::string` from `arg1` and `arg2` on the heap.
  42. [note __limit_note__ ]
  43. [endsect]
  44. [section Delete]
  45. [*/Lazy delete.../]
  46. #include <boost/phoenix/object/delete.hpp>
  47. Lazily delete an object, from the heap:
  48. delete_(arg);
  49. where arg is assumed to be a pointer to an object.
  50. Example:
  51. delete_<std::string>(arg1) // note the spelling of delete_ (with trailing underscore)
  52. [endsect]
  53. [section Casts]
  54. [*/Lazy casts.../]
  55. #include <boost/phoenix/object/static_cast.hpp>
  56. #include <boost/phoenix/object/dynamic_cast.hpp>
  57. #include <boost/phoenix/object/const_cast.hpp>
  58. #include <boost/phoenix/object/reinterpret_cast.hpp>
  59. The set of lazy C++ cast template functions provide a way of lazily casting an
  60. object of a certain type to another type. The syntax resembles the well known
  61. C++ casts. Take note however that the lazy versions have a trailing underscore.
  62. static_cast_<T>(lambda_expression)
  63. dynamic_cast_<T>(lambda_expression)
  64. const_cast_<T>(lambda_expression)
  65. reinterpret_cast_<T>(lambda_expression)
  66. Example:
  67. static_cast_<Base*>(&arg1)
  68. Static-casts the address of `arg1` to a `Base*`.
  69. [endsect]
  70. [endsect]