]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/============================================================================== |
2 | Copyright (C) 2001-2010 Joel de Guzman | |
3 | Copyright (C) 2001-2005 Dan Marsden | |
4 | Copyright (C) 2001-2010 Thomas Heller | |
5 | ||
6 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
7 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
8 | ===============================================================================/] | |
9 | ||
10 | [section References] | |
11 | ||
12 | References are functions. They hold a reference to a value stored somewhere. | |
13 | For example, given: | |
14 | ||
15 | int i = 3; | |
16 | char const* s = "Hello World"; | |
17 | ||
18 | we create `references` to `i` and `s` this way: | |
19 | ||
20 | ref(i) | |
21 | ref(s) | |
22 | ||
23 | Like `val`, the expressions above evaluates to a nullary function; the first one | |
24 | returning an `int&`, and the second one returning a `char const*&`. | |
25 | ||
26 | (See [@../../example/references.cpp references.cpp]) | |
27 | ||
28 | [blurb __tip__ Learn more about references [link phoenix.modules.core.references here.]] | |
29 | ||
30 | [endsect] | |
31 |