Brian Silverman | ce4aa8d | 2018-08-04 23:36:03 -0700 | [diff] [blame^] | 1 | [/ |
| 2 | / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. |
| 3 | / Copyright (c) 2003-2005 Peter Dimov |
| 4 | / |
| 5 | / Distributed under the Boost Software License, Version 1.0. (See |
| 6 | / accompanying file LICENSE_1_0.txt or copy at |
| 7 | / http://www.boost.org/LICENSE_1_0.txt) |
| 8 | /] |
| 9 | |
| 10 | [section:interface Interface] |
| 11 | |
| 12 | [section:synopsys Synopsis] |
| 13 | |
| 14 | namespace boost |
| 15 | { |
| 16 | template<class T> T * ``[link get_pointer_1 `get_pointer`]``(T * p); |
| 17 | |
| 18 | template<class R, class T> ``/unspecified-1/`` ``[link mem_fn_1 `mem_fn`]``(R (T::*pmf) ()); |
| 19 | |
| 20 | template<class R, class T> ``/unspecified-2/`` ``[link mem_fn_2 `mem_fn`]``(R (T::*pmf) () const); |
| 21 | |
| 22 | template<class R, class T> ``/unspecified-2-1/`` ``[link mem_fn_2_1 `mem_fn`]``(R T::*pm); |
| 23 | |
| 24 | template<class R, class T, class A1> ``/unspecified-3/`` ``[link mem_fn_3 `mem_fn`]``(R (T::*pmf) (A1)); |
| 25 | |
| 26 | template<class R, class T, class A1> ``/unspecified-4/`` ``[link mem_fn_4 `mem_fn`]``(R (T::*pmf) (A1) const); |
| 27 | |
| 28 | template<class R, class T, class A1, class A2> ``/unspecified-5/`` ``[link mem_fn_5 `mem_fn`]``(R (T::*pmf) (A1, A2)); |
| 29 | |
| 30 | template<class R, class T, class A1, class A2> ``/unspecified-6/`` ``[link mem_fn_6 `mem_fn`]``(R (T::*pmf) (A1, A2) const); |
| 31 | |
| 32 | // implementation defined number of additional overloads for more arguments |
| 33 | } |
| 34 | |
| 35 | [endsect] |
| 36 | |
| 37 | [section Common requirements] |
| 38 | |
| 39 | All /unspecified-N/ types mentioned in the Synopsis are /CopyConstructible/ |
| 40 | and /Assignable/. Their copy constructors and assignment operators do not |
| 41 | throw exceptions. /unspecified-N/`::result_type` is defined as the return type |
| 42 | of the member function pointer passed as an argument to `mem_fn` (`R` in the |
| 43 | Synopsis.) /unspecified-2-1/`::result_type` is defined as `R`. |
| 44 | |
| 45 | [endsect] |
| 46 | |
| 47 | [section `get_pointer`] |
| 48 | |
| 49 | [#get_pointer_1] |
| 50 | |
| 51 | template<class T> T * get_pointer(T * p) |
| 52 | |
| 53 | * /Returns:/ `p`. |
| 54 | |
| 55 | * /Throws:/ Nothing. |
| 56 | |
| 57 | [endsect] |
| 58 | |
| 59 | [section `mem_fn`] |
| 60 | |
| 61 | [#mem_fn_1] |
| 62 | |
| 63 | template<class R, class T> ``/unspecified-1/`` mem_fn(R (T::*pmf) ()) |
| 64 | |
| 65 | * /Returns:/ a function object \u03DD such that the expression \u03DD`(t)` is |
| 66 | equivalent to `(t.*pmf)()` when `t` is an l-value of type `T` or derived, |
| 67 | `(get_pointer(t)->*pmf)()` otherwise. |
| 68 | |
| 69 | * /Throws:/ Nothing. |
| 70 | |
| 71 | [#mem_fn_2] |
| 72 | |
| 73 | template<class R, class T> ``/unspecified-2/`` mem_fn(R (T::*pmf) () const) |
| 74 | |
| 75 | * /Returns:/ a function object \u03DD such that the expression \u03DD`(t)` is |
| 76 | equivalent to `(t.*pmf)()` when `t` is of type `T` /[/`const`/]/ or derived, |
| 77 | `(get_pointer(t)->*pmf)()` otherwise. |
| 78 | |
| 79 | * /Throws:/ Nothing. |
| 80 | |
| 81 | [#mem_fn_2_1] |
| 82 | |
| 83 | template<class R, class T> ``/unspecified-2-1/`` mem_fn(R T::*pm) |
| 84 | |
| 85 | * /Returns:/ a function object \u03DD such that the expression \u03DD`(t)` is |
| 86 | equivalent to `t.*pm` when `t` is of type `T` /[/`const`/]/ or derived, |
| 87 | `get_pointer(t)->*pm` otherwise. |
| 88 | |
| 89 | * /Throws:/ Nothing. |
| 90 | |
| 91 | [#mem_fn_3] |
| 92 | |
| 93 | template<class R, class T, class A1> ``/unspecified-3/`` mem_fn(R (T::*pmf) (A1)) |
| 94 | |
| 95 | * /Returns:/ a function object \u03DD such that the expression \u03DD`(t, a1)` |
| 96 | is equivalent to `(t.*pmf)(a1)` when `t` is an l-value of type `T` or derived, |
| 97 | `(get_pointer(t)->*pmf)(a1)` otherwise. |
| 98 | |
| 99 | * /Throws:/ Nothing. |
| 100 | |
| 101 | [#mem_fn_4] |
| 102 | |
| 103 | template<class R, class T, class A1> ``/unspecified-4/`` mem_fn(R (T::*pmf) (A1) const) |
| 104 | |
| 105 | * /Returns:/ a function object \u03DD such that the expression \u03DD`(t, a1)` |
| 106 | is equivalent to `(t.*pmf)(a1)` when `t` is of type `T` /[/`const`/]/ or derived, |
| 107 | `(get_pointer(t)->*pmf)(a1)` otherwise. |
| 108 | |
| 109 | * /Throws:/ Nothing. |
| 110 | |
| 111 | [#mem_fn_5] |
| 112 | |
| 113 | template<class R, class T, class A1, class A2> ``/unspecified-5/`` mem_fn(R (T::*pmf) (A1, A2)) |
| 114 | |
| 115 | * /Returns:/ a function object \u03DD such that the expression \u03DD`(t, a1, a2)` |
| 116 | is equivalent to `(t.*pmf)(a1, a2)` when `t` is an l-value of type `T` or derived, |
| 117 | `(get_pointer(t)->*pmf)(a1, a2)` otherwise. |
| 118 | |
| 119 | * /Throws:/ Nothing. |
| 120 | |
| 121 | [#mem_fn_6] |
| 122 | |
| 123 | template<class R, class T, class A1, class A2> ``/unspecified-6/`` mem_fn(R (T::*pmf) (A1, A2) const) |
| 124 | |
| 125 | * /Returns:/ a function object \u03DD such that the expression \u03DD`(t, a1, a2)` |
| 126 | is equivalent to `(t.*pmf)(a1, a2)` when `t` is of type `T` /[/`const`/]/ or derived, |
| 127 | `(get_pointer(t)->*pmf)(a1, a2)` otherwise. |
| 128 | |
| 129 | * /Throws:/ Nothing. |
| 130 | |
| 131 | [endsect] |
| 132 | |
| 133 | [endsect] |