references.qbk 993 B

12345678910111213141516171819202122232425262728293031
  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 References]
  9. References are functions. They hold a reference to a value stored somewhere.
  10. For example, given:
  11. int i = 3;
  12. char const* s = "Hello World";
  13. we create `references` to `i` and `s` this way:
  14. ref(i)
  15. ref(s)
  16. Like `val`, the expressions above evaluates to a nullary function; the first one
  17. returning an `int&`, and the second one returning a `char const*&`.
  18. (See [@../../example/references.cpp references.cpp])
  19. [blurb __tip__ Learn more about references [link phoenix.modules.core.references here.]]
  20. [endsect]