1 | [library Boost.TR1 |
---|
2 | [copyright 2005 John Maddock] |
---|
3 | [purpose An implementation of the C++ Technical Report on Standard Library Extensions] |
---|
4 | [license |
---|
5 | Distributed under the Boost Software License, Version 1.0. |
---|
6 | (See accompanying file LICENSE_1_0.txt or copy at |
---|
7 | <ulink url="http://www.boost.org/LICENSE_1_0.txt"> |
---|
8 | http://www.boost.org/LICENSE_1_0.txt</ulink>)] |
---|
9 | [authors [Maddock, John]] |
---|
10 | [category misc] |
---|
11 | [last-revision $Date: 2007/05/09 17:20:56 $] |
---|
12 | ] |
---|
13 | |
---|
14 | [section:intro Introduction] |
---|
15 | |
---|
16 | This documentation is |
---|
17 | [@http://boost-consulting.com/vault/index.php?action=downloadfile&filename=boost_tr1-1.34.pdf&directory=PDF%20Documentation& |
---|
18 | also available in printer-friendly PDF format]. |
---|
19 | |
---|
20 | The TR1 library provides an implementation of the C++ Technical Report on Standard Library Extensions. |
---|
21 | This library does not itself implement the TR1 components, rather it's a thin wrapper that will |
---|
22 | include your standard library's TR1 implementation (if it has one), otherwise it will include the Boost |
---|
23 | Library equivalents, and import them into namespace `std::tr1`. |
---|
24 | |
---|
25 | [endsect] |
---|
26 | |
---|
27 | [section:usage Usage] |
---|
28 | There are two things you need to decide before using the Boost.TR1 library: |
---|
29 | whether to use your standard library's native TR1 implementation (if it has one), |
---|
30 | and which include style to use. |
---|
31 | |
---|
32 | [section:native Whether to use Your Native TR1 Library] |
---|
33 | If your standard library implements the TR1, and you want to make |
---|
34 | use of it, rather than use the Boost equivalents, then you will need to |
---|
35 | take some explicit action to enable it: this may be a pre-processor |
---|
36 | define, a special compiler switch, or a different include path. |
---|
37 | You will need to consult your compilers documentation to find out |
---|
38 | which of these |
---|
39 | actions you need to take. |
---|
40 | |
---|
41 | Provided Boost is [link boost_tr1.config correctly configured], |
---|
42 | everything should |
---|
43 | now "just work", and code written to use Boost.TR1 will include |
---|
44 | your standard library's native headers rather than the Boost ones. |
---|
45 | |
---|
46 | [endsect] |
---|
47 | |
---|
48 | [section:include_style Header Include Style] |
---|
49 | |
---|
50 | There are two ways you can include the Boost.TR1 headers, |
---|
51 | for example if you are interested in shared_ptr then you can either use: |
---|
52 | |
---|
53 | #include <boost/tr1/memory.hpp> |
---|
54 | |
---|
55 | or: |
---|
56 | |
---|
57 | #include <memory> |
---|
58 | |
---|
59 | The first option is the preferred method for other Boost libraries |
---|
60 | to use. The second option is standard-conforming, but requires that you |
---|
61 | add `boost-install-path/boost/tr1/tr1` to your compiler's include search path. |
---|
62 | Note that you must not copy the headers in boost/tr1/tr1 into a directory |
---|
63 | called "include", doing so will cause them to cease working. |
---|
64 | |
---|
65 | [blurb [*Important Note #1]\n\n |
---|
66 | The include path order is very important if you want this library to work |
---|
67 | correctly. If you get compiler errors then suspect the include paths. The |
---|
68 | correct order is:\n\n |
---|
69 | 1) boost-root/boost/tr1/tr1\n |
---|
70 | 2) boost-root\n |
---|
71 | 3) Any other standard library replacements (STLport for example).\n |
---|
72 | 4) Your regular standard library.] |
---|
73 | |
---|
74 | [blurb [*Important Note #2: Borland C++ Users]\n\n |
---|
75 | Borland's compiler has a particularly broken form of `#include`, that |
---|
76 | will actually look for a file named `array.h` if you `#include <array>`. |
---|
77 | In order to make this library work with Borland's compiler you will need to |
---|
78 | set up the include paths as follows:\n\n |
---|
79 | 1) boost-root/boost/tr1/tr1/bcc32\n |
---|
80 | 2) boost-root/boost/tr1/tr1\n |
---|
81 | 3) boost-root\n |
---|
82 | 4) Any other standard library replacements (STLport for example).\n |
---|
83 | 5) Your regular standard library.] |
---|
84 | |
---|
85 | [blurb [*Important Note #3: Sun C++ Users]\n\n |
---|
86 | Sun's compiler has a particularly interesting form of `#include`, that |
---|
87 | will actually look for a file named `array.SUNWCCh` if you `#include <array>`. |
---|
88 | In order to make this library work with Sun's compiler you will need to |
---|
89 | set up the include paths as follows:\n\n |
---|
90 | 1) boost-root/boost/tr1/tr1/sun\n |
---|
91 | 2) boost-root/boost/tr1/tr1\n |
---|
92 | 3) boost-root\n |
---|
93 | 4) Any other standard library replacements (STLport for example).\n |
---|
94 | 5) Your regular standard library.] |
---|
95 | |
---|
96 | [endsect] |
---|
97 | |
---|
98 | [endsect] |
---|
99 | |
---|
100 | [section:config Configuration] |
---|
101 | |
---|
102 | Configuring Boost.TR1 is no different to configuring any other part of |
---|
103 | Boost; in the majority of cases you shouldn't actually need to do anything at all. |
---|
104 | However, because Boost.TR1 will inject Boost components into namespace std::tr1 |
---|
105 | it is more than usually sensitive to an incorrect configuration. |
---|
106 | |
---|
107 | The intention is that |
---|
108 | [@../../libs/config/index.html Boost.Config] |
---|
109 | will automaticaly define the configuration |
---|
110 | macros used by this library, so that if your standard library is set up to |
---|
111 | support TR1 (note that few are at present) then this will be detected and Boost.TR1 |
---|
112 | will use your standard library versions of these components rather than the |
---|
113 | Boost ones. |
---|
114 | |
---|
115 | If you would prefer to use the Boost versions of the TR1 conponents rather than |
---|
116 | your standard library, then either: include the Boost headers directly |
---|
117 | |
---|
118 | #include <boost/regex.hpp> |
---|
119 | |
---|
120 | boost::regex e("myregex"); //etc |
---|
121 | |
---|
122 | Or else don't enable TR1 in your standard library: since TR1 is not part of |
---|
123 | the current standard, there should be some option to disable it in your |
---|
124 | compiler or standard library. |
---|
125 | |
---|
126 | The configuration macros used by each TR1 component are documented in each |
---|
127 | library section (and all together in the |
---|
128 | [@../../libs/config/index.html Boost.Config] |
---|
129 | documentation), but defining BOOST_HAS_TR1 will turn on native TR1 support |
---|
130 | for everything (if your standard library has it), which can act as a |
---|
131 | convenient shortcut. |
---|
132 | |
---|
133 | [blurb [*Note for gcc users]\n\n |
---|
134 | Boost.TR1 does not currently enable gcc's native TR1 implementation |
---|
135 | as this is currently in an early stage of development. However, you may |
---|
136 | choose to do so by defining BOOST_HAS_GCC_TR1.] |
---|
137 | |
---|
138 | [endsect] |
---|
139 | |
---|
140 | [section:subject_list TR1 By Subject] |
---|
141 | |
---|
142 | [section:ref Reference Wrappers.] |
---|
143 | |
---|
144 | #include <boost/tr1/functional.hpp> |
---|
145 | |
---|
146 | or |
---|
147 | |
---|
148 | #include <functional> |
---|
149 | |
---|
150 | The Ref library is a small library that is useful for passing |
---|
151 | references to function templates (algorithms) that would usually |
---|
152 | take copies of their arguments. It defines the class template |
---|
153 | `reference_wrapper<T>`, |
---|
154 | and the two functions |
---|
155 | `ref` and `cref` that return |
---|
156 | instances of `reference_wrapper<T>`. |
---|
157 | [@../../doc/html/ref.html Refer to Boost.Bind for more information.] |
---|
158 | |
---|
159 | namespace std { |
---|
160 | namespace tr1 { |
---|
161 | |
---|
162 | template <class T> class reference_wrapper; |
---|
163 | |
---|
164 | template <class T> reference_wrapper<T> ref(T&); |
---|
165 | template <class T> reference_wrapper<const T> cref(const T&); |
---|
166 | template <class T> reference_wrapper<T> ref(reference_wrapper<T>); |
---|
167 | template <class T> reference_wrapper<const T> cref(reference_wrapper<T>); |
---|
168 | |
---|
169 | } // namespace tr1 |
---|
170 | } // namespace std |
---|
171 | |
---|
172 | [*Configuration:] |
---|
173 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
174 | the macro BOOST_HAS_TR1_REFERENCE_WRAPPER if your |
---|
175 | standard library implements this part of TR1. |
---|
176 | |
---|
177 | [*Standard Conformity:] |
---|
178 | The Boost version of this this component does not currently support |
---|
179 | function call invocation (2.1.2.4), or derivation from std::unary_function |
---|
180 | or std::binary_function (2.1.2 paragraphs 3 and 4). |
---|
181 | |
---|
182 | The Boost version is not implicitly convertible to T& as the TR requires. |
---|
183 | |
---|
184 | [endsect] |
---|
185 | |
---|
186 | [section:ptrs Smart Pointers.] |
---|
187 | |
---|
188 | #include <boost/tr1/memory.hpp> |
---|
189 | |
---|
190 | or |
---|
191 | |
---|
192 | #include <memory> |
---|
193 | |
---|
194 | The `shared_ptr` class template stores a pointer to a dynamically allocated |
---|
195 | object, typically with a C++ new-expression. The object pointed to is |
---|
196 | guaranteed to be deleted when the last `shared_ptr` pointing to it is |
---|
197 | destroyed or reset. For more information refer to the |
---|
198 | [@../../libs/smart_ptr/shared_ptr.htm shared_ptr] |
---|
199 | and [@../../libs/smart_ptr/weak_ptr.htm weak_ptr] documentation. |
---|
200 | |
---|
201 | namespace std { |
---|
202 | namespace tr1 { |
---|
203 | |
---|
204 | class bad_weak_ptr; |
---|
205 | |
---|
206 | // [2.2.3] Class template shared_ptr |
---|
207 | template<class T> class shared_ptr; |
---|
208 | |
---|
209 | // [2.2.3.6] shared_ptr comparisons |
---|
210 | template<class T, class U> bool operator==(shared_ptr<T> const& a, shared_ptr<U> const& b); |
---|
211 | template<class T, class U> bool operator!=(shared_ptr<T> const& a, shared_ptr<U> const& b); |
---|
212 | template<class T, class U> bool operator<(shared_ptr<T> const& a, shared_ptr<U> const& b); |
---|
213 | |
---|
214 | // [2.2.3.8] shared_ptr specialized algorithms |
---|
215 | template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>& b); |
---|
216 | |
---|
217 | // [2.2.3.9] shared_ptr casts |
---|
218 | template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const& r); |
---|
219 | template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const& r); |
---|
220 | template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const& r); |
---|
221 | |
---|
222 | // [2.2.3.7] shared_ptr I/O |
---|
223 | template<class E, class T, class Y> |
---|
224 | basic_ostream<E, T>& operator<< (basic_ostream<E, T>& os, shared_ptr<Y> const& p); |
---|
225 | |
---|
226 | // [2.2.3.10] shared_ptr get_deleter |
---|
227 | template<class D, class T> D * get_deleter(shared_ptr<T> const& p); |
---|
228 | |
---|
229 | // [2.2.4] Class template weak_ptr |
---|
230 | template<class T> class weak_ptr; |
---|
231 | |
---|
232 | // [2.2.4.6] weak_ptr comparison |
---|
233 | template<class T, class U> bool operator<(weak_ptr<T> const& a, weak_ptr<U> const& b); |
---|
234 | |
---|
235 | // [2.2.4.7] weak_ptr specialized algorithms |
---|
236 | template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b); |
---|
237 | |
---|
238 | // [2.2.5] Class enable_shared_from_this |
---|
239 | template<class T> class enable_shared_from_this; |
---|
240 | |
---|
241 | } // namespace tr1 |
---|
242 | } // namespace std |
---|
243 | |
---|
244 | [*Configuration:] |
---|
245 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
246 | the macro BOOST_HAS_TR1_SHARED_PTR if your |
---|
247 | standard library implements this part of TR1. |
---|
248 | |
---|
249 | [*Standard Conformity:] There are no known deviations from the standard when |
---|
250 | using the Boost version of this component. |
---|
251 | |
---|
252 | [endsect] |
---|
253 | |
---|
254 | [section:result_of Class template result_of.] |
---|
255 | |
---|
256 | #include <boost/tr1/functional.hpp> |
---|
257 | |
---|
258 | or |
---|
259 | |
---|
260 | #include <functional> |
---|
261 | |
---|
262 | The class template |
---|
263 | `result_of` helps determine the type of a |
---|
264 | call expression. Given an lvalue `f` of |
---|
265 | type `F` and lvalues `t1`, |
---|
266 | `t2, ..., tN` of |
---|
267 | types `T1, T2, ..., TN`, respectively, the type |
---|
268 | `result_of<F(T1, T2, ..., TN)>::type` defines the result type |
---|
269 | of the expression `f(t1, t2, ...,tN)`. The implementation permits |
---|
270 | the type `F` to be a function pointer, |
---|
271 | function reference, member function pointer, or class |
---|
272 | type. For more information |
---|
273 | [@../../libs/utility/utility.htm#result_of refer to the Boost.Utility documentation.] |
---|
274 | |
---|
275 | namespace std { |
---|
276 | namespace tr1 { |
---|
277 | |
---|
278 | template <class T> |
---|
279 | struct result_of |
---|
280 | { |
---|
281 | typedef unspecified type; |
---|
282 | }; |
---|
283 | |
---|
284 | } // namespace tr1 |
---|
285 | } // namespace std |
---|
286 | |
---|
287 | [*Configuration:] |
---|
288 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
289 | the macro BOOST_HAS_TR1_RESULT_OF if your |
---|
290 | standard library implements this part of TR1. |
---|
291 | |
---|
292 | [*Standard Conformity:] No known problems. |
---|
293 | |
---|
294 | [endsect] |
---|
295 | |
---|
296 | [section:mem_fn Function template mem_fn.] |
---|
297 | |
---|
298 | #include <boost/tr1/functional.hpp> |
---|
299 | |
---|
300 | or |
---|
301 | |
---|
302 | #include <functional> |
---|
303 | |
---|
304 | `std::tr1::mem_fn` is a generalization of the standard functions `std::mem_fun` |
---|
305 | and `std::mem_fun_ref`. It supports member function pointers with more |
---|
306 | than one argument, and the returned function object can take a pointer, a |
---|
307 | reference, or a smart pointer to an object instance as its first argument. `mem_fn` |
---|
308 | also supports pointers to data members by treating them as functions taking no |
---|
309 | arguments and returning a (const) reference to the member. |
---|
310 | For more information refer to the [@../../libs/bind/mem_fn.html |
---|
311 | Boost.Mem_fn documentation]. |
---|
312 | |
---|
313 | namespace std { |
---|
314 | namespace tr1 { |
---|
315 | |
---|
316 | template <class R, class T> unspecified mem_fn(R T::* pm); |
---|
317 | |
---|
318 | } // namespace tr1 |
---|
319 | } // namespace std |
---|
320 | |
---|
321 | [*Configuration:] |
---|
322 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
323 | the macro BOOST_HAS_TR1_MEM_FN if your |
---|
324 | standard library implements this part of TR1. |
---|
325 | |
---|
326 | [*Standard Conformity:] |
---|
327 | The Boost implementation does not produce functors that inherit from |
---|
328 | `std::unary_function` or `std::binary_function`, nor does it function |
---|
329 | correctly with pointers to volatile member functions (these should |
---|
330 | be extremely rare in practice however). |
---|
331 | |
---|
332 | [endsect] |
---|
333 | |
---|
334 | [section:bind Function Object Binders.] |
---|
335 | |
---|
336 | #include <boost/tr1/functional.hpp> |
---|
337 | |
---|
338 | or |
---|
339 | |
---|
340 | #include <functional> |
---|
341 | |
---|
342 | `std::tr1::bind` is a generalization of the standard functions `std::bind1st` |
---|
343 | and `std::bind2nd`. It supports arbitrary function objects, functions, |
---|
344 | function pointers, and member function pointers, and is able to bind any |
---|
345 | argument to a specific value or route input arguments into arbitrary positions. `bind` |
---|
346 | does not place any requirements on the function object; in particular, it does |
---|
347 | not need the `result_type`, `first_argument_type` and `second_argument_type` |
---|
348 | standard typedefs. |
---|
349 | For more information refer to the [@../../libs/bind/bind.html |
---|
350 | Boost.Bind documentation]. |
---|
351 | |
---|
352 | namespace std { |
---|
353 | namespace tr1 { |
---|
354 | |
---|
355 | // [3.6] Function object binders |
---|
356 | template<class T> struct is_bind_expression; |
---|
357 | template<class T> struct is_placeholder; |
---|
358 | template<class F, class T1, ..., class Tn > unspecified bind(F f, T1 t1, ..., Tn tn ); |
---|
359 | template<class R, class F, class T1, ..., class Tn > unspecified bind(F f, T1 t1, ..., Tn tn ); |
---|
360 | |
---|
361 | namespace placeholders { |
---|
362 | // M is the implementation-defined number of placeholders |
---|
363 | extern unspecified _1; |
---|
364 | extern unspecified _2; |
---|
365 | . |
---|
366 | . |
---|
367 | . |
---|
368 | extern unspecified _M; |
---|
369 | } |
---|
370 | |
---|
371 | } // namespace tr1 |
---|
372 | } // namespace std |
---|
373 | |
---|
374 | [*Configuration:] |
---|
375 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
376 | the macro BOOST_HAS_TR1_BIND if your |
---|
377 | standard library implements this part of TR1. |
---|
378 | |
---|
379 | [*Standard Conformity:] |
---|
380 | The traits classes `is_placeholder` and `is_bind_expression` are not supported |
---|
381 | by the Boost implementation. |
---|
382 | |
---|
383 | The named return value syntax isn't supported if the object being bound is a |
---|
384 | function pointer, for example: |
---|
385 | |
---|
386 | std::tr1::bind(&my_proc, arg1, arg2 /* etc */); // works OK. |
---|
387 | std::tr1::bind<double>(&my_proc, arg1, arg2 /* etc */); // causes compiler error. |
---|
388 | std::tr1::bind<double>(my_function_object, arg1, arg2 /* etc */); // works OK. |
---|
389 | |
---|
390 | On the other hand, the Boost implementation does work with pointers to overloaded |
---|
391 | functions, and optionally with function pointers with non-standard |
---|
392 | calling conventions. |
---|
393 | |
---|
394 | [endsect] |
---|
395 | |
---|
396 | [section:function Polymorphic function wrappers.] |
---|
397 | |
---|
398 | #include <boost/tr1/functional.hpp> |
---|
399 | |
---|
400 | or |
---|
401 | |
---|
402 | #include <functional> |
---|
403 | |
---|
404 | The polymorphic function wrappers are a family of class templates |
---|
405 | that may be used as a generalized callback mechanism. |
---|
406 | A polymorphic function wrapper shares features with function pointers, in |
---|
407 | that both define a call interface (for example a function taking two integer |
---|
408 | arguments and returning a floating-point value) through which some |
---|
409 | arbitrary code may be called. However a polymorphic function wrapper can call |
---|
410 | any callable object with a compatible call signature, this could be a function |
---|
411 | pointer, or it could be a function object produced by std::tr1::bind, or some |
---|
412 | other mechanism. For more information see the [@../../doc/html/function.html |
---|
413 | Boost.Function documentation]. |
---|
414 | |
---|
415 | |
---|
416 | namespace std { |
---|
417 | namespace tr1 { |
---|
418 | |
---|
419 | // [3.7] polymorphic function wrappers |
---|
420 | class bad_function_call; |
---|
421 | |
---|
422 | template<class Function> |
---|
423 | class function; |
---|
424 | |
---|
425 | template<class Function> |
---|
426 | void swap(function<Function>&, function<Function>&); |
---|
427 | |
---|
428 | template<class Function1, class Function2> |
---|
429 | void operator==(const function<Function1>&, const function<Function2>&); |
---|
430 | template<class Function1, class Function2> |
---|
431 | void operator!=(const function<Function1>&, const function<Function2>&); |
---|
432 | template <class Function> |
---|
433 | bool operator==(const function<Function>&, unspecified-null-pointer-type ); |
---|
434 | template <class Function> |
---|
435 | bool operator==(unspecified-null-pointer-type , const function<Function>&); |
---|
436 | template <class Function> |
---|
437 | bool operator!=(const function<Function>&, unspecified-null-pointer-type ); |
---|
438 | template <class Function> |
---|
439 | bool operator!=(unspecified-null-pointer-type , const function<Function>&); |
---|
440 | |
---|
441 | } // namespace tr1 |
---|
442 | } // namespace std |
---|
443 | |
---|
444 | [*Configuration:] |
---|
445 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
446 | the macro BOOST_HAS_TR1_FUNCTION if your |
---|
447 | standard library implements this part of TR1. |
---|
448 | |
---|
449 | [*Standard Conformity:] |
---|
450 | The Boost version of `std::tr1::function` lacks the member function |
---|
451 | `target_type()` and does not inherit from `std::unary_function` |
---|
452 | or `std::binary_function` when applicable. The member function |
---|
453 | target() can only access pointer-to-member targets when they |
---|
454 | have been wrapped in mem_fn. |
---|
455 | |
---|
456 | [endsect] |
---|
457 | |
---|
458 | [section:type_traits Type Traits.] |
---|
459 | |
---|
460 | #include <boost/tr1/type_traits.hpp> |
---|
461 | |
---|
462 | or |
---|
463 | |
---|
464 | #include <type_traits> |
---|
465 | |
---|
466 | Type traits enable generic code to access the fundamental properties |
---|
467 | of a type, to determine the relationship between two types, or to |
---|
468 | transform one type into another related type. For more information |
---|
469 | refer to the [@../../libs/type_traits/index.html Boost.Type_traits documentation]. |
---|
470 | |
---|
471 | namespace std { |
---|
472 | namespace tr1 { |
---|
473 | |
---|
474 | template <class T, T v> struct integral_constant; |
---|
475 | |
---|
476 | typedef integral_constant<bool, true> true_type; |
---|
477 | typedef integral_constant<bool, false> false_type; |
---|
478 | |
---|
479 | // [4.5.1] primary type categories: |
---|
480 | template <class T> struct is_void; |
---|
481 | template <class T> struct is_integral; |
---|
482 | template <class T> struct is_floating_point; |
---|
483 | template <class T> struct is_array; |
---|
484 | template <class T> struct is_pointer; |
---|
485 | template <class T> struct is_reference; |
---|
486 | template <class T> struct is_member_object_pointer; |
---|
487 | template <class T> struct is_member_function_pointer; |
---|
488 | template <class T> struct is_enum; |
---|
489 | template <class T> struct is_union; |
---|
490 | template <class T> struct is_class; |
---|
491 | template <class T> struct is_function; |
---|
492 | |
---|
493 | // [4.5.2] composite type categories: |
---|
494 | template <class T> struct is_arithmetic; |
---|
495 | template <class T> struct is_fundamental; |
---|
496 | template <class T> struct is_object; |
---|
497 | template <class T> struct is_scalar; |
---|
498 | template <class T> struct is_compound; |
---|
499 | template <class T> struct is_member_pointer; |
---|
500 | |
---|
501 | // [4.5.3] type properties: |
---|
502 | template <class T> struct is_const; |
---|
503 | template <class T> struct is_volatile; |
---|
504 | template <class T> struct is_pod; |
---|
505 | template <class T> struct is_empty; |
---|
506 | template <class T> struct is_polymorphic; |
---|
507 | template <class T> struct is_abstract; |
---|
508 | template <class T> struct has_trivial_constructor; |
---|
509 | template <class T> struct has_trivial_copy; |
---|
510 | template <class T> struct has_trivial_assign; |
---|
511 | template <class T> struct has_trivial_destructor; |
---|
512 | template <class T> struct has_nothrow_constructor; |
---|
513 | template <class T> struct has_nothrow_copy; |
---|
514 | template <class T> struct has_nothrow_assign; |
---|
515 | template <class T> struct has_virtual_destructor; |
---|
516 | template <class T> struct is_signed; |
---|
517 | template <class T> struct is_unsigned; |
---|
518 | template <class T> struct alignment_of; |
---|
519 | template <class T> struct rank; |
---|
520 | template <class T, unsigned I = 0> struct extent; |
---|
521 | |
---|
522 | // [4.6] type relations: |
---|
523 | template <class T, class U> struct is_same; |
---|
524 | template <class Base, class Derived> struct is_base_of; |
---|
525 | template <class From, class To> struct is_convertible; |
---|
526 | |
---|
527 | // [4.7.1] const-volatile modifications: |
---|
528 | template <class T> struct remove_const; |
---|
529 | template <class T> struct remove_volatile; |
---|
530 | template <class T> struct remove_cv; |
---|
531 | template <class T> struct add_const; |
---|
532 | template <class T> struct add_volatile; |
---|
533 | template <class T> struct add_cv; |
---|
534 | |
---|
535 | // [4.7.2] reference modifications: |
---|
536 | template <class T> struct remove_reference; |
---|
537 | template <class T> struct add_reference; |
---|
538 | |
---|
539 | // [4.7.3] array modifications: |
---|
540 | template <class T> struct remove_extent; |
---|
541 | template <class T> struct remove_all_extents; |
---|
542 | |
---|
543 | // [4.7.4] pointer modifications: |
---|
544 | template <class T> struct remove_pointer; |
---|
545 | template <class T> struct add_pointer; |
---|
546 | |
---|
547 | // [4.8] other transformations: |
---|
548 | template <std::size_t Len, std::size_t Align> struct aligned_storage; |
---|
549 | |
---|
550 | } // namespace tr1 |
---|
551 | } // namespace std |
---|
552 | |
---|
553 | [*Configuration:] |
---|
554 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
555 | the macro BOOST_HAS_TR1_TYPE_TRAITS if your |
---|
556 | standard library implements this part of TR1. |
---|
557 | |
---|
558 | [*Standard Conformity:] |
---|
559 | No known problems. |
---|
560 | |
---|
561 | [endsect] |
---|
562 | |
---|
563 | [section:random Random Number Generators and Distributions.] |
---|
564 | |
---|
565 | #include <boost/tr1/random.hpp> |
---|
566 | |
---|
567 | or |
---|
568 | |
---|
569 | #include <random> |
---|
570 | |
---|
571 | The random number library is devided into three parts: |
---|
572 | [@../../libs/random/random-generators.html generators], which |
---|
573 | are nullary functors producing uniform random number distributions. |
---|
574 | [@../../libs/random/random-distributions.html Distributions], which are unary |
---|
575 | functors that adapt a generator to some |
---|
576 | specific kind of distribution. And the class template |
---|
577 | [@../../libs/random/random-variate.html variate_generator] |
---|
578 | which combines a generator with a distribution, to create a new generator. |
---|
579 | For more information see the [@../../libs/random/index.html Boost.Random documentation]. |
---|
580 | |
---|
581 | |
---|
582 | namespace std { |
---|
583 | namespace tr1 { |
---|
584 | |
---|
585 | // [5.1.3] Class template variate_generator |
---|
586 | template<class UniformRandomNumberGenerator, class Distribution> |
---|
587 | class variate_generator; |
---|
588 | |
---|
589 | // [5.1.4.1] Class template linear_congruential |
---|
590 | template<class IntType, IntType a, IntType c, IntType m> |
---|
591 | class linear_congruential; |
---|
592 | |
---|
593 | // [5.1.4.2] Class template mersenne_twister |
---|
594 | template<class UIntType, int w, int n, int m, int r, |
---|
595 | UIntType a, int u, int s, UIntType b, int t, UIntType c, int l> |
---|
596 | class mersenne_twister; |
---|
597 | |
---|
598 | // [5.1.4.3] Class template substract_with_carry |
---|
599 | template<class IntType, IntType m, int s, int r> |
---|
600 | class subtract_with_carry; |
---|
601 | |
---|
602 | // [5.1.4.4] Class template substract_with_carry_01 |
---|
603 | template<class RealType, int w, int s, int r> |
---|
604 | class subtract_with_carry_01; |
---|
605 | |
---|
606 | // [5.1.4.5] Class template discard_block |
---|
607 | template<class UniformRandomNumberGenerator, int p, int r> |
---|
608 | class discard_block; |
---|
609 | |
---|
610 | // [5.1.4.6] Class template xor_combine |
---|
611 | template<class UniformRandomNumberGenerator1, int s1, |
---|
612 | class UniformRandomNumberGenerator2, int s2> |
---|
613 | class xor_combine; |
---|
614 | |
---|
615 | // [5.1.5] Predefined generators |
---|
616 | typedef linear_congruential< |
---|
617 | implementation-defined , |
---|
618 | 16807, |
---|
619 | 0, |
---|
620 | 2147483647> minstd_rand0; |
---|
621 | |
---|
622 | typedef linear_congruential< |
---|
623 | implementation-defined , |
---|
624 | 48271, |
---|
625 | 0, |
---|
626 | 2147483647> minstd_rand; |
---|
627 | |
---|
628 | typedef mersenne_twister< |
---|
629 | implementation-defined , |
---|
630 | 32, 624, 397, 31, |
---|
631 | 0x9908b0df, 11, 7, |
---|
632 | 0x9d2c5680, 15, |
---|
633 | 0xefc60000, 18> mt19937; |
---|
634 | |
---|
635 | typedef subtract_with_carry_01< |
---|
636 | float, |
---|
637 | 24, |
---|
638 | 10, |
---|
639 | 24> ranlux_base_01; |
---|
640 | |
---|
641 | typedef subtract_with_carry_01< |
---|
642 | double, |
---|
643 | 48, |
---|
644 | 10, |
---|
645 | 24> ranlux64_base_01; |
---|
646 | |
---|
647 | typedef discard_block< |
---|
648 | subtract_with_carry< |
---|
649 | implementation-defined , |
---|
650 | (1<<24), |
---|
651 | 10, |
---|
652 | 24>, |
---|
653 | 223, |
---|
654 | 24> ranlux3; |
---|
655 | |
---|
656 | typedef discard_block< |
---|
657 | subtract_with_carry< |
---|
658 | implementation-defined, |
---|
659 | (1<<24), |
---|
660 | 10, |
---|
661 | 24>, |
---|
662 | 389, |
---|
663 | 24> ranlux4; |
---|
664 | |
---|
665 | typedef discard_block< |
---|
666 | subtract_with_carry_01< |
---|
667 | float, |
---|
668 | 24, |
---|
669 | 10, |
---|
670 | 24>, |
---|
671 | 223, |
---|
672 | 24> ranlux3_01; |
---|
673 | |
---|
674 | typedef discard_block< |
---|
675 | subtract_with_carry_01< |
---|
676 | float, |
---|
677 | 24, |
---|
678 | 10, |
---|
679 | 24>, |
---|
680 | 389, |
---|
681 | 24> ranlux4_01; |
---|
682 | |
---|
683 | // [5.1.6] Class random_device |
---|
684 | class random_device; |
---|
685 | |
---|
686 | // [5.1.7.1] Class template uniform_int |
---|
687 | template<class IntType = int> |
---|
688 | class uniform_int; |
---|
689 | |
---|
690 | // [5.1.7.2] Class bernoulli_distribution |
---|
691 | class bernoulli_distribution; |
---|
692 | |
---|
693 | // [5.1.7.3] Class template geometric_distribution |
---|
694 | template<class IntType = int, class RealType = double> |
---|
695 | class geometric_distribution; |
---|
696 | |
---|
697 | // [5.1.7.4] Class template poisson_distribution |
---|
698 | template<class IntType = int, class RealType = double> |
---|
699 | class poisson_distribution; |
---|
700 | |
---|
701 | // [5.1.7.5] Class template binomial_distribution |
---|
702 | template<class IntType = int, class RealType = double> |
---|
703 | class binomial_distribution; |
---|
704 | |
---|
705 | // [5.1.7.6] Class template uniform_real |
---|
706 | template<class RealType = double> |
---|
707 | class uniform_real; |
---|
708 | |
---|
709 | // [5.1.7.7] Class template exponential_distribution |
---|
710 | template<class RealType = double> |
---|
711 | class exponential_distribution; |
---|
712 | |
---|
713 | // [5.1.7.8] Class template normal_distribution |
---|
714 | template<class RealType = double> |
---|
715 | class normal_distribution; |
---|
716 | |
---|
717 | // [5.1.7.9] Class template gamma_distribution |
---|
718 | template<class RealType = double> |
---|
719 | class gamma_distribution; |
---|
720 | |
---|
721 | } // namespace tr1 |
---|
722 | } // namespace std |
---|
723 | |
---|
724 | [*Configuration:] |
---|
725 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
726 | the macro BOOST_HAS_TR1_RANDOM if your |
---|
727 | standard library implements this part of TR1. |
---|
728 | |
---|
729 | [*Standard Conformity:] |
---|
730 | The Boost implementation has the following limitations: |
---|
731 | |
---|
732 | *The linear_congruential generator is fully supported for |
---|
733 | signed integer types only (unsigned types probably only work when |
---|
734 | the modulus is zero). |
---|
735 | *The subtract_with_carry template does not support a modulus of zero. |
---|
736 | *Not all of the standard generator types have Boost documentation yet, they are |
---|
737 | none the less supported however. |
---|
738 | *Class template variate_generator does not have a template unary function call operator(), |
---|
739 | only the non-template nullary version. |
---|
740 | |
---|
741 | Note also that most of the Random number generators have been re-implemented |
---|
742 | as thin wrappers around the Boost versions in order to |
---|
743 | provide a standard conforming interface (the Boost versions all take an additional, |
---|
744 | redundant, template parameter, and are initialized by iterators rather than functors). |
---|
745 | |
---|
746 | [endsect] |
---|
747 | |
---|
748 | [section:tuple Tuples.] |
---|
749 | |
---|
750 | #include <boost/tr1/tuple.hpp> |
---|
751 | |
---|
752 | or |
---|
753 | |
---|
754 | #include <tuple> |
---|
755 | |
---|
756 | A tuple is a fixed size collection of elements. |
---|
757 | Pairs, triples, quadruples etc. are tuples. |
---|
758 | In a programming language, a tuple is a data object containing other objects as elements. |
---|
759 | These element objects may be of different types. |
---|
760 | Tuples are convenient in many circumstances. |
---|
761 | For instance, tuples make it easy to define functions that return more than one value. |
---|
762 | Some programming languages, such as ML, Python and Haskell, have built-in tuple constructs. |
---|
763 | Unfortunately C++ does not. |
---|
764 | To compensate for this "deficiency", the TR1 Tuple Library implements a tuple construct using templates. |
---|
765 | For more information see the [@../../libs/tuple/index.html Boost Tuple Library Documentation]. |
---|
766 | |
---|
767 | namespace std { |
---|
768 | namespace tr1 { |
---|
769 | |
---|
770 | // [6.1.3] Class template tuple |
---|
771 | template <class T1 = unspecified , |
---|
772 | class T2 = unspecified , |
---|
773 | ..., |
---|
774 | class TM = unspecified > class tuple; |
---|
775 | |
---|
776 | // [6.1.3.2] Tuple creation functions |
---|
777 | const unspecified ignore; |
---|
778 | |
---|
779 | template<class T1, class T2, ..., class TN> |
---|
780 | tuple<V1, V2, ..., VN> make_tuple(const T1&, const T2& , ..., const TN&); |
---|
781 | |
---|
782 | // [6.1] Tuple types Containers |
---|
783 | template<class T1, class T2, ..., class TN> |
---|
784 | tuple<T1&, T2&, ..., TN&> tie(T1&, T2& , ..., TN&); |
---|
785 | |
---|
786 | // [6.1.3.3] Tuple helper classes |
---|
787 | template <class T> class tuple_size; |
---|
788 | template <int I, class T> class tuple_element; |
---|
789 | |
---|
790 | // [6.1.3.4] Element access |
---|
791 | template <int I, class T1, class T2, ..., class TN> |
---|
792 | RI get(tuple<T1, T2, ..., TN>&); |
---|
793 | template <int I, class T1, class T2, ..., class TN> |
---|
794 | PI get(const tuple<T1, T2, ..., TN>&); |
---|
795 | |
---|
796 | // [6.1.3.5] relational operators |
---|
797 | template<class T1, class T2, ..., class TM, class U1, class U2, ..., class UM> |
---|
798 | bool operator==(const tuple<T1, T2, ..., TM>&, const tuple<U1, U2, ..., UM>&); |
---|
799 | template<class T1, class T2, ..., class TM, class U1, class U2, ..., class UM> |
---|
800 | bool operator<(const tuple<T1, T2, ..., TM>&, const tuple<U1, U2, ..., UM>&); |
---|
801 | template<class T1, class T2, ..., class TM, class U1, class U2, ..., class UM> |
---|
802 | bool operator!=(const tuple<T1, T2, ..., TM>&, const tuple<U1, U2, ..., UM>&); |
---|
803 | template<class T1, class T2, ..., class TM, class U1, class U2, ..., class UM> |
---|
804 | bool operator>(const tuple<T1, T2, ..., TM>&, const tuple<U1, U2, ..., UM>&); |
---|
805 | template<class T1, class T2, ..., class TM, class U1, class U2, ..., class UM> |
---|
806 | bool operator<=(const tuple<T1, T2, ..., TM>&, const tuple<U1, U2, ..., UM>&); |
---|
807 | template<class T1, class T2, ..., class TM, class U1, class U2, ..., class UM> |
---|
808 | bool operator>=(const tuple<T1, T2, ..., TM>&, const tuple<U1, U2, ..., UM>&); |
---|
809 | |
---|
810 | } // namespace tr1 |
---|
811 | } // namespace std |
---|
812 | |
---|
813 | [*Configuration:] |
---|
814 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
815 | the macro BOOST_HAS_TR1_TUPLE if your |
---|
816 | standard library implements this part of TR1. |
---|
817 | |
---|
818 | [*Standard Conformity:] |
---|
819 | No known issues for conforming compilers. |
---|
820 | |
---|
821 | [endsect] |
---|
822 | |
---|
823 | [section:utility Tuple Interface to std::pair.] |
---|
824 | |
---|
825 | #include <boost/tr1/utility.hpp> |
---|
826 | |
---|
827 | or |
---|
828 | |
---|
829 | #include <utility> |
---|
830 | |
---|
831 | The existing class template std::pair, can also be accessed using the |
---|
832 | [link boost_tr1.tuple tuple interface]. |
---|
833 | |
---|
834 | namespace std { |
---|
835 | namespace tr1 { |
---|
836 | |
---|
837 | template <class T> class tuple_size; // forward declaration |
---|
838 | template <int I, class T> class tuple_element; // forward declaration |
---|
839 | template <class T1, class T2> struct tuple_size<std::pair<T1, T2> >; |
---|
840 | template <class T1, class T2> struct tuple_element<0, std::pair<T2, T2> >; |
---|
841 | template <class T1, class T2> struct tuple_element<1, std::pair<T2, T2> >; |
---|
842 | // see below for definition of "P". |
---|
843 | template<int I, class T1, class T2> P& get(std::pair<T1, T2>&); |
---|
844 | template<int I, class T1, class T2> const P& get(const std::pair<T1, T2>&); |
---|
845 | |
---|
846 | } // namespace tr1 |
---|
847 | } // namespace std |
---|
848 | |
---|
849 | [*Configuration:] |
---|
850 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
851 | the macro BOOST_HAS_TR1_UTILITY if your |
---|
852 | standard library implements this part of TR1. |
---|
853 | |
---|
854 | [*Standard Conformity:] |
---|
855 | No known problems. |
---|
856 | |
---|
857 | [endsect] |
---|
858 | |
---|
859 | [section:array Fixed Size Array.] |
---|
860 | |
---|
861 | #include <boost/tr1/array.hpp> |
---|
862 | |
---|
863 | or |
---|
864 | |
---|
865 | #include <array> |
---|
866 | |
---|
867 | Class template array is a fixed size array that is safer than and no |
---|
868 | less efficient than a C style array. Class array fulfils almost all of the |
---|
869 | requirements of a reversible-container (see Section 23.1, |
---|
870 | [lib.container.requirements] of the C++ Standard). For more information refer |
---|
871 | to the [@../../libs/array/index.html Boost.Array documentation]. |
---|
872 | |
---|
873 | namespace std { |
---|
874 | namespace tr1 { |
---|
875 | |
---|
876 | // [6.2.2] Class template array |
---|
877 | template <class T, size_t N > struct array; |
---|
878 | |
---|
879 | // Array comparisons |
---|
880 | template <class T, size_t N> bool operator== (const array<T,N>& x, const array<T,N>& y); |
---|
881 | template <class T, size_t N> bool operator< (const array<T,N>& x, const array<T,N>& y); |
---|
882 | template <class T, size_t N> bool operator!= (const array<T,N>& x, const array<T,N>& y); |
---|
883 | template <class T, size_t N> bool operator> (const array<T,N>& x, const array<T,N>& y); |
---|
884 | template <class T, size_t N> bool operator>= (const array<T,N>& x, const array<T,N>& y); |
---|
885 | template <class T, size_t N> bool operator<= (const array<T,N>& x, const array<T,N>& y); |
---|
886 | |
---|
887 | // [6.2.2.2] Specialized algorithms |
---|
888 | template <class T, size_t N > void swap(array<T,N>& x, array<T,N>& y); |
---|
889 | |
---|
890 | // [6.2.2.5] Tuple interface to class template array |
---|
891 | template <class T> class tuple_size; // forward declaration |
---|
892 | template <int I, class T> class tuple_element; // forward declaration |
---|
893 | template <class T, size_t N> struct tuple_size<array<T, N> >; |
---|
894 | template <int I, class T, size_t N> struct tuple_element<I, array<T, N> >; |
---|
895 | template <int I, class T, size_t N> T& get( array<T, N>&); |
---|
896 | template <int I, class T, size_t N> const T& get(const array<T, N>&); |
---|
897 | |
---|
898 | } // namespace tr1 |
---|
899 | } // namespace std |
---|
900 | |
---|
901 | [*Configuration:] |
---|
902 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
903 | the macro BOOST_HAS_TR1_ARRAY if your |
---|
904 | standard library implements this part of TR1. |
---|
905 | |
---|
906 | [*Standard Conformity:] |
---|
907 | No known issues as of Boost-1.34 onwards. |
---|
908 | |
---|
909 | [endsect] |
---|
910 | |
---|
911 | [section:hash Hash Function Objects.] |
---|
912 | |
---|
913 | #include <boost/tr1/functional.hpp> |
---|
914 | |
---|
915 | or |
---|
916 | |
---|
917 | #include <functional> |
---|
918 | |
---|
919 | Class template std::hash is a unary-functor that converts some type T |
---|
920 | into a hash-value, |
---|
921 | specializations of std::hash are provided for integer, character, floating point, |
---|
922 | and pointer types, plus the two string types std::string and std::wstring. |
---|
923 | See the [@../../libs/functional/hash/index.html Boost.Hash] |
---|
924 | documentation for more information. |
---|
925 | |
---|
926 | namespace std { |
---|
927 | namespace tr1 { |
---|
928 | |
---|
929 | template <class T> |
---|
930 | struct hash : public unary_function<T, size_t> |
---|
931 | { |
---|
932 | size_t operator()(T val)const; |
---|
933 | }; |
---|
934 | |
---|
935 | // Hash function specializations |
---|
936 | template <> struct hash<bool>; |
---|
937 | template <> struct hash<char>; |
---|
938 | template <> struct hash<signed char>; |
---|
939 | template <> struct hash<unsigned char>; |
---|
940 | template <> struct hash<wchar_t>; |
---|
941 | template <> struct hash<short>; |
---|
942 | template <> struct hash<int>; |
---|
943 | template <> struct hash<long>; |
---|
944 | template <> struct hash<unsigned short>; |
---|
945 | template <> struct hash<unsigned int>; |
---|
946 | template <> struct hash<unsigned long>; |
---|
947 | template <> struct hash<float>; |
---|
948 | template <> struct hash<double>; |
---|
949 | template <> struct hash<long double>; |
---|
950 | template<class T> struct hash<T*>; |
---|
951 | template <> struct hash<std::string>; |
---|
952 | template <> struct hash<std::wstring>; |
---|
953 | |
---|
954 | } // namespace tr1 |
---|
955 | } // namespace std |
---|
956 | |
---|
957 | [*Configuration:] |
---|
958 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
959 | the macro BOOST_HAS_TR1_HASH if your |
---|
960 | standard library implements this part of TR1. |
---|
961 | |
---|
962 | [*Standard Conformity:] |
---|
963 | Boost.Hash adds specialisations of std::hash for a wider range of types |
---|
964 | than those required by TR1: Boost.Hash acts as a testbed for issue 6.18 |
---|
965 | in the [@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf |
---|
966 | Library Extension Technical Report Issues List]. |
---|
967 | |
---|
968 | [endsect] |
---|
969 | |
---|
970 | [section:regex Regular Expressions.] |
---|
971 | |
---|
972 | #include <boost/tr1/regex.hpp> |
---|
973 | |
---|
974 | or |
---|
975 | |
---|
976 | #include <regex> |
---|
977 | |
---|
978 | This library provides comprehensive support for regular expressions, |
---|
979 | including either iterator or string based matching, searching, search-and-replace, |
---|
980 | iteration, and tokenization. Both POSIX and ECMAScript (JavaScript) regular |
---|
981 | expressions are supported. For more information see the [@../../libs/regex/index.html |
---|
982 | Boost.Regex documentation]. |
---|
983 | |
---|
984 | namespace std { |
---|
985 | namespace tr1 { |
---|
986 | |
---|
987 | // [7.5] Regex constants |
---|
988 | namespace regex_constants { |
---|
989 | |
---|
990 | typedef bitmask_type syntax_option_type; |
---|
991 | typedef bitmask_type match_flag_type; |
---|
992 | typedef implementation-defined error_type; |
---|
993 | |
---|
994 | } // namespace regex_constants |
---|
995 | |
---|
996 | // [7.6] Class regex_error |
---|
997 | class regex_error; |
---|
998 | |
---|
999 | // [7.7] Class template regex_traits |
---|
1000 | template <class charT> struct regex_traits; |
---|
1001 | |
---|
1002 | // [7.8] Class template basic_regex |
---|
1003 | template <class charT, class traits = regex_traits<charT> > |
---|
1004 | class basic_regex; |
---|
1005 | |
---|
1006 | typedef basic_regex<char> regex; |
---|
1007 | typedef basic_regex<wchar_t> wregex; |
---|
1008 | |
---|
1009 | // [7.8.6] basic_regex swap |
---|
1010 | template <class charT, class traits> |
---|
1011 | void swap(basic_regex<charT, traits>& e1, |
---|
1012 | basic_regex<charT, traits>& e2); |
---|
1013 | |
---|
1014 | // [7.9] Class template sub_match |
---|
1015 | template <class BidirectionalIterator> |
---|
1016 | class sub_match; |
---|
1017 | |
---|
1018 | typedef sub_match<const char*> csub_match; |
---|
1019 | typedef sub_match<const wchar_t*> wcsub_match; |
---|
1020 | typedef sub_match<string::const_iterator> ssub_match; |
---|
1021 | typedef sub_match<wstring::const_iterator> wssub_match; |
---|
1022 | |
---|
1023 | // [7.9.2] sub_match non-member operators |
---|
1024 | |
---|
1025 | /* Comparison operators omitted for clarity.... */ |
---|
1026 | |
---|
1027 | template <class charT, class ST, class BiIter> |
---|
1028 | basic_ostream<charT, ST>& |
---|
1029 | operator<<(basic_ostream<charT, ST>& os, |
---|
1030 | const sub_match<BiIter>& m); |
---|
1031 | |
---|
1032 | // [7.10] Class template match_results |
---|
1033 | template <class BidirectionalIterator, |
---|
1034 | class Allocator = allocator<sub_match<BidirectionalIterator> > > |
---|
1035 | class match_results; |
---|
1036 | |
---|
1037 | typedef match_results<const char*> cmatch; |
---|
1038 | typedef match_results<const wchar_t*> wcmatch; |
---|
1039 | typedef match_results<string::const_iterator> smatch; |
---|
1040 | typedef match_results<wstring::const_iterator> wsmatch; |
---|
1041 | |
---|
1042 | // match_results comparisons |
---|
1043 | template <class BidirectionalIterator, class Allocator> |
---|
1044 | bool operator== (const match_results<BidirectionalIterator, Allocator>& m1, |
---|
1045 | const match_results<BidirectionalIterator, Allocator>& m2); |
---|
1046 | template <class BidirectionalIterator, class Allocator> |
---|
1047 | bool operator!= (const match_results<BidirectionalIterator, Allocator>& m1, |
---|
1048 | const match_results<BidirectionalIterator, Allocator>& m2); |
---|
1049 | |
---|
1050 | // [7.10.6] match_results swap |
---|
1051 | template <class BidirectionalIterator, class Allocator> |
---|
1052 | void swap(match_results<BidirectionalIterator, Allocator>& m1, |
---|
1053 | match_results<BidirectionalIterator, Allocator>& m2); |
---|
1054 | |
---|
1055 | // [7.11.2] Function template regex_match |
---|
1056 | template <class BidirectionalIterator, class Allocator, class charT, class traits> |
---|
1057 | bool regex_match(BidirectionalIterator first, |
---|
1058 | BidirectionalIterator last, |
---|
1059 | match_results<BidirectionalIterator, Allocator>& m, |
---|
1060 | const basic_regex<charT, traits>& e, |
---|
1061 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1062 | |
---|
1063 | template <class BidirectionalIterator, class charT, class traits> |
---|
1064 | bool regex_match(BidirectionalIterator first, |
---|
1065 | BidirectionalIterator last, |
---|
1066 | const basic_regex<charT, traits>& e, |
---|
1067 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1068 | |
---|
1069 | template <class charT, class Allocator, class traits> |
---|
1070 | bool regex_match(const charT* str, |
---|
1071 | match_results<const charT*, Allocator>& m, |
---|
1072 | const basic_regex<charT, traits>& e, |
---|
1073 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1074 | |
---|
1075 | template <class ST, class SA, class Allocator, class charT, class traits> |
---|
1076 | bool regex_match(const basic_string<charT, ST, SA>& s, |
---|
1077 | match_results<typename basic_string<charT, ST, SA>::const_iterator,Allocator>& m, |
---|
1078 | const basic_regex<charT, traits>& e, |
---|
1079 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1080 | |
---|
1081 | template <class charT, class traits> |
---|
1082 | bool regex_match(const charT* str, |
---|
1083 | const basic_regex<charT, traits>& e, |
---|
1084 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1085 | |
---|
1086 | template <class ST, class SA, class charT, class traits> |
---|
1087 | bool regex_match(const basic_string<charT, ST, SA>& s, |
---|
1088 | const basic_regex<charT, traits>& e, |
---|
1089 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1090 | |
---|
1091 | // [7.11.3] Function template regex_search |
---|
1092 | template <class BidirectionalIterator, class Allocator, class charT, class traits> |
---|
1093 | bool regex_search(BidirectionalIterator first, |
---|
1094 | BidirectionalIterator last, |
---|
1095 | match_results<BidirectionalIterator, Allocator>& m, |
---|
1096 | const basic_regex<charT, traits>& e, |
---|
1097 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1098 | |
---|
1099 | template <class BidirectionalIterator, class charT, class traits> |
---|
1100 | bool regex_search(BidirectionalIterator first, |
---|
1101 | BidirectionalIterator last, |
---|
1102 | const basic_regex<charT, traits>& e, |
---|
1103 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1104 | |
---|
1105 | template <class charT, class Allocator, class traits> |
---|
1106 | bool regex_search(const charT* str, |
---|
1107 | match_results<const charT*, Allocator>& m, |
---|
1108 | const basic_regex<charT, traits>& e, |
---|
1109 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1110 | |
---|
1111 | template <class charT, class traits> |
---|
1112 | bool regex_search(const charT* str, |
---|
1113 | const basic_regex<charT, traits>& e, |
---|
1114 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1115 | |
---|
1116 | template <class ST, class SA, class charT, class traits> |
---|
1117 | bool regex_search(const basic_string<charT, ST, SA>& s, |
---|
1118 | const basic_regex<charT, traits>& e, |
---|
1119 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1120 | |
---|
1121 | template <class ST, class SA, class Allocator, class charT, class traits> |
---|
1122 | bool regex_search(const basic_string<charT, ST, SA>& s, |
---|
1123 | match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m, |
---|
1124 | const basic_regex<charT, traits>& e, |
---|
1125 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1126 | |
---|
1127 | // [7.11.4] Function template regex_replace |
---|
1128 | template <class OutputIterator, class BidirectionalIterator, class traits, class charT> |
---|
1129 | OutputIterator regex_replace(OutputIterator out, |
---|
1130 | BidirectionalIterator first, |
---|
1131 | BidirectionalIterator last, |
---|
1132 | const basic_regex<charT, traits>& e, |
---|
1133 | const basic_string<charT>& fmt, |
---|
1134 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1135 | |
---|
1136 | template <class traits, class charT> |
---|
1137 | basic_string<charT> regex_replace(const basic_string<charT>& s, |
---|
1138 | const basic_regex<charT, traits>& e, |
---|
1139 | const basic_string<charT>& fmt, |
---|
1140 | regex_constants::match_flag_type flags = regex_constants::match_default); |
---|
1141 | |
---|
1142 | // [7.12.1] Class template regex_iterator |
---|
1143 | template <class BidirectionalIterator, |
---|
1144 | class charT = typename iterator_traits<BidirectionalIterator>::value_type, |
---|
1145 | class traits = regex_traits<charT> > |
---|
1146 | class regex_iterator; |
---|
1147 | |
---|
1148 | typedef regex_iterator<const char*> cregex_iterator; |
---|
1149 | typedef regex_iterator<const wchar_t*> wcregex_iterator; |
---|
1150 | typedef regex_iterator<string::const_iterator> sregex_iterator; |
---|
1151 | typedef regex_iterator<wstring::const_iterator> wsregex_iterator; |
---|
1152 | |
---|
1153 | // [7.12.2] Class template regex_token_iterator |
---|
1154 | template <class BidirectionalIterator, |
---|
1155 | class charT = typename iterator_traits<BidirectionalIterator>::value_type, |
---|
1156 | class traits = regex_traits<charT> > |
---|
1157 | class regex_token_iterator; |
---|
1158 | |
---|
1159 | typedef regex_token_iterator<const char*> cregex_token_iterator; |
---|
1160 | typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator; |
---|
1161 | typedef regex_token_iterator<string::const_iterator> sregex_token_iterator; |
---|
1162 | typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; |
---|
1163 | |
---|
1164 | } // namespace tr1 |
---|
1165 | } // namespace std |
---|
1166 | |
---|
1167 | |
---|
1168 | [*Configuration:] |
---|
1169 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
1170 | the macro BOOST_HAS_TR1_REGEX if your |
---|
1171 | standard library implements this part of TR1. |
---|
1172 | |
---|
1173 | [*Standard Conformity:] |
---|
1174 | No known problems. |
---|
1175 | |
---|
1176 | [endsect] |
---|
1177 | |
---|
1178 | [section:complex Complex Number Algorithm Overloads.] |
---|
1179 | |
---|
1180 | #include <boost/tr1/complex.hpp> |
---|
1181 | |
---|
1182 | or |
---|
1183 | |
---|
1184 | #include <complex> |
---|
1185 | |
---|
1186 | The following function templates have additional overloads: |
---|
1187 | `arg`, `norm`, `conj`, `polar`, `imag`, and `real`. |
---|
1188 | |
---|
1189 | The additional |
---|
1190 | overloads are sufficient to ensure: |
---|
1191 | |
---|
1192 | *If the argument has type `long double`, then the overload behaves as if |
---|
1193 | the argument had been cast to `std::complex<long double>`. |
---|
1194 | *Otherwise, if the argument has type `double` or is an integer type, |
---|
1195 | then the overload behaves as if |
---|
1196 | the argument had been cast to `std::complex<double>`. |
---|
1197 | *Otherwise, if the argument has type `float`, then the overload |
---|
1198 | behaves as if |
---|
1199 | the argument had been cast to `std::complex<float>`. |
---|
1200 | |
---|
1201 | The function template `pow` has additional overloads sufficient to ensure, |
---|
1202 | for a call with at least one argument of type `std::complex<T>`: |
---|
1203 | |
---|
1204 | *If either argument has type `complex<long double>` or type |
---|
1205 | `long double`, then the overload behaves as if both arguments were cast |
---|
1206 | to `std::complex<long double>` |
---|
1207 | *Otherwise, if either argument has type `complex<double>`, `double`, |
---|
1208 | or an integer type, then the overload behaves as if both arguments were cast |
---|
1209 | to `std::complex<double>` |
---|
1210 | *Otherwise, if either argument has type `complex<float>` or `float`, |
---|
1211 | then the overload behaves as if both arguments were cast |
---|
1212 | to `std::complex<float>` |
---|
1213 | |
---|
1214 | In the following synopsis, `Real` is a floating point type, |
---|
1215 | `Arithmetic` is an integer or floating point type, and ` |
---|
1216 | PROMOTE(X1 ... XN)` is the largest floating point type in the list |
---|
1217 | X1 to XN, after any non-floating point types in the list have been replaced by |
---|
1218 | the type `double`. |
---|
1219 | |
---|
1220 | template <class Arithmetic> |
---|
1221 | PROMOTE(Arithmetic) arg(const Arithmetic& t); |
---|
1222 | |
---|
1223 | template <class Arithmetic> |
---|
1224 | PROMOTE(Arithmetic) norm(const Arithmetic& t); |
---|
1225 | |
---|
1226 | template <class Arithmetic> |
---|
1227 | complex<PROMOTE(Arithmetic)> conj(const Arithmetic& t); |
---|
1228 | |
---|
1229 | template <class Arithmetic1, class Arithmetic2> |
---|
1230 | complex<PROMOTE(Arithmetic1,Arithmetic2)> polar(const Arithmetic1& rho, const Arithmetic2& theta = 0); |
---|
1231 | |
---|
1232 | template <class Arithmetic> |
---|
1233 | PROMOTE(Arithmetic) imag(const Arithmetic& ); |
---|
1234 | |
---|
1235 | template <class Arithmetic> |
---|
1236 | PROMOTE(Arithmetic) real(const Arithmetic& t); |
---|
1237 | |
---|
1238 | template<class Real1, class Real2> |
---|
1239 | complex<PROMOTE(Real1, Real2)> |
---|
1240 | pow(const complex<Real1>& x, const complex<Real2>& y); |
---|
1241 | |
---|
1242 | template<class Real, class Arithmetic> |
---|
1243 | complex<PROMOTE(Real, Arithmetic)> |
---|
1244 | pow (const complex<Real>& x, const Arithmetic& y); |
---|
1245 | |
---|
1246 | template<class Arithmetic, class Real> |
---|
1247 | complex<PROMOTE(Real, Arithmetic)> |
---|
1248 | pow (const Arithmetic& x, const complex<Real>& y); |
---|
1249 | |
---|
1250 | [*Configuration:] |
---|
1251 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
1252 | the macro BOOST_HAS_TR1_COMPLEX_OVERLOADS if your |
---|
1253 | standard library implements the additional overloads for the existing |
---|
1254 | complex arithmetic functions. |
---|
1255 | |
---|
1256 | [*Standard Conformity:] |
---|
1257 | No known problems. |
---|
1258 | |
---|
1259 | [endsect] |
---|
1260 | |
---|
1261 | [section:complex_trig Complex Number Additional Algorithms.] |
---|
1262 | |
---|
1263 | #include <boost/tr1/complex.hpp> |
---|
1264 | |
---|
1265 | or |
---|
1266 | |
---|
1267 | #include <complex> |
---|
1268 | |
---|
1269 | The algorithms `acos`, `asin`, `atan`, |
---|
1270 | `acosh`, `asinh`, `atanh` and `fabs` |
---|
1271 | are overloaded |
---|
1272 | for arguments of type `std::complex<T>`. |
---|
1273 | These algorithms are entirely |
---|
1274 | classical, and behave as specified in the C99 standard section 7.3.5. |
---|
1275 | See the [@boost_math/inverse_complex.html Boost.Math documentation |
---|
1276 | for more information]. |
---|
1277 | |
---|
1278 | namespace std { |
---|
1279 | namespace tr1 { |
---|
1280 | |
---|
1281 | template<class T> complex<T> acos(complex<T>& x); |
---|
1282 | template<class T> complex<T> asin(complex<T>& x); |
---|
1283 | template<class T> complex<T> atan(complex<T>& x); |
---|
1284 | template<class T> complex<T> acosh(complex<T>& x); |
---|
1285 | template<class T> complex<T> asinh(complex<T>& x); |
---|
1286 | template<class T> complex<T> atanh(complex<T>& x); |
---|
1287 | template<class T> complex<T> fabs(complex<T>& x); |
---|
1288 | |
---|
1289 | } // namespace tr1 |
---|
1290 | } // namespace std |
---|
1291 | |
---|
1292 | [*Configuration:] |
---|
1293 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
1294 | the macro BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG |
---|
1295 | if your standard library implements the additional inverse trig functions. |
---|
1296 | |
---|
1297 | [*Standard Conformity:] |
---|
1298 | No known problems. |
---|
1299 | |
---|
1300 | [endsect] |
---|
1301 | |
---|
1302 | [endsect] |
---|
1303 | |
---|
1304 | [section:unsupported TR By Subject: Unsupported Features] |
---|
1305 | |
---|
1306 | [section:special Mathematical Special Functions.] |
---|
1307 | |
---|
1308 | The TR adds 23 special functions (plus float and long double overloads) |
---|
1309 | to header <cmath>. However, at present there is no Boost License |
---|
1310 | compatible implementation of these functions, so these are [*unsupported |
---|
1311 | by this implementation] unless your standard library supports them itself. |
---|
1312 | |
---|
1313 | namespace std { |
---|
1314 | namespace tr1 { |
---|
1315 | |
---|
1316 | // [5.2.1.1] associated Laguerre polynomials: |
---|
1317 | double assoc_laguerre(unsigned n, unsigned m, double x); |
---|
1318 | float assoc_laguerref(unsigned n, unsigned m, float x); |
---|
1319 | long double assoc_laguerrel(unsigned n, unsigned m, long double x); |
---|
1320 | |
---|
1321 | // [5.2.1.2] associated Legendre functions: |
---|
1322 | double assoc_legendre(unsigned l, unsigned m, double x); |
---|
1323 | float assoc_legendref(unsigned l, unsigned m, float x); |
---|
1324 | long double assoc_legendrel(unsigned l, unsigned m, long double x); |
---|
1325 | |
---|
1326 | // [5.2.1.3] beta function: |
---|
1327 | double beta(double x, double y); |
---|
1328 | float betaf(float x, float y); |
---|
1329 | long double betal(long double x, long double y); |
---|
1330 | |
---|
1331 | // [5.2.1.4] (complete) elliptic integral of the first kind: |
---|
1332 | double comp_ellint_1(double k); |
---|
1333 | float comp_ellint_1f(float k); |
---|
1334 | long double comp_ellint_1l(long double k); |
---|
1335 | |
---|
1336 | // [5.2.1.5] (complete) elliptic integral of the second kind: |
---|
1337 | double comp_ellint_2(double k); |
---|
1338 | float comp_ellint_2f(float k); |
---|
1339 | long double comp_ellint_2l(long double k); |
---|
1340 | |
---|
1341 | // [5.2.1.6] (complete) elliptic integral of the third kind: |
---|
1342 | double comp_ellint_3(double k, double nu); |
---|
1343 | float comp_ellint_3f(float k, float nu); |
---|
1344 | long double comp_ellint_3l(long double k, long double nu); |
---|
1345 | |
---|
1346 | // [5.2.1.7] confluent hypergeometric functions: |
---|
1347 | double conf_hyperg(double a, double c, double x); |
---|
1348 | float conf_hypergf(float a, float c, float x); |
---|
1349 | long double conf_hypergl(long double a, long double c, long double x); |
---|
1350 | |
---|
1351 | // [5.2.1.8] regular modified cylindrical Bessel functions: |
---|
1352 | double cyl_bessel_i(double nu, double x); |
---|
1353 | float cyl_bessel_if(float nu, float x); |
---|
1354 | long double cyl_bessel_il(long double nu, long double x); |
---|
1355 | |
---|
1356 | // [5.2.1.9] cylindrical Bessel functions (of the first kind): |
---|
1357 | double cyl_bessel_j(double nu, double x); |
---|
1358 | float cyl_bessel_jf(float nu, float x); |
---|
1359 | long double cyl_bessel_jl(long double nu, long double x); |
---|
1360 | |
---|
1361 | // [5.2.1.10] irregular modified cylindrical Bessel functions: |
---|
1362 | double cyl_bessel_k(double nu, double x); |
---|
1363 | float cyl_bessel_kf(float nu, float x); |
---|
1364 | long double cyl_bessel_kl(long double nu, long double x); |
---|
1365 | |
---|
1366 | // [5.2.1.11] cylindrical Neumann functions; |
---|
1367 | // cylindrical Bessel functions (of the second kind): |
---|
1368 | double cyl_neumann(double nu, double x); |
---|
1369 | float cyl_neumannf(float nu, float x); |
---|
1370 | long double cyl_neumannl(long double nu, long double x); |
---|
1371 | |
---|
1372 | // [5.2.1.12] (incomplete) elliptic integral of the first kind: |
---|
1373 | double ellint_1(double k, double phi); |
---|
1374 | float ellint_1f(float k, float phi); |
---|
1375 | long double ellint_1l(long double k, long double phi); |
---|
1376 | |
---|
1377 | // [5.2.1.13] (incomplete) elliptic integral of the second kind: |
---|
1378 | double ellint_2(double k, double phi); |
---|
1379 | float ellint_2f(float k, float phi); |
---|
1380 | long double ellint_2l(long double k, long double phi); |
---|
1381 | |
---|
1382 | // [5.2.1.14] (incomplete) elliptic integral of the third kind: |
---|
1383 | double ellint_3(double k, double nu, double phi); |
---|
1384 | float ellint_3f(float k, float nu, float phi); |
---|
1385 | long double ellint_3l(long double k, long double nu, long double phi); |
---|
1386 | |
---|
1387 | // [5.2.1.15] exponential integral: |
---|
1388 | double expint(double x); |
---|
1389 | float expintf(float x); |
---|
1390 | long double expintl(long double x); |
---|
1391 | |
---|
1392 | // [5.2.1.16] Hermite polynomials: |
---|
1393 | double hermite(unsigned n, double x); |
---|
1394 | float hermitef(unsigned n, float x); |
---|
1395 | long double hermitel(unsigned n, long double x); |
---|
1396 | |
---|
1397 | // [5.2.1.17] hypergeometric functions: |
---|
1398 | double hyperg(double a, double b, double c, double x); |
---|
1399 | float hypergf(float a, float b, float c, float x); |
---|
1400 | long double hypergl(long double a, long double b, long double c, long double x); |
---|
1401 | |
---|
1402 | // [5.2.1.18] Laguerre polynomials: |
---|
1403 | double laguerre(unsigned n, double x); |
---|
1404 | float laguerref(unsigned n, float x); |
---|
1405 | long double laguerrel(unsigned n, long double x); |
---|
1406 | |
---|
1407 | // [5.2.1.19] Legendre polynomials: |
---|
1408 | double legendre(unsigned l, double x); |
---|
1409 | float legendref(unsigned l, float x); |
---|
1410 | long double legendrel(unsigned l, long double x); |
---|
1411 | |
---|
1412 | // [5.2.1.20] Riemann zeta function: |
---|
1413 | double riemann_zeta(double); |
---|
1414 | float riemann_zetaf(float); |
---|
1415 | long double riemann_zetal(long double); |
---|
1416 | |
---|
1417 | // [5.2.1.21] spherical Bessel functions (of the first kind): |
---|
1418 | double sph_bessel(unsigned n, double x); |
---|
1419 | float sph_besself(unsigned n, float x); |
---|
1420 | long double sph_bessell(unsigned n, long double x); |
---|
1421 | |
---|
1422 | // [5.2.1.22] spherical associated Legendre functions: |
---|
1423 | double sph_legendre(unsigned l, unsigned m, double theta); |
---|
1424 | float sph_legendref(unsigned l, unsigned m, float theta); |
---|
1425 | long double sph_legendrel(unsigned l, unsigned m, long double theta); |
---|
1426 | |
---|
1427 | // [5.2.1.23] spherical Neumann functions; |
---|
1428 | // spherical Bessel functions (of the second kind): |
---|
1429 | double sph_neumann(unsigned n, double x); |
---|
1430 | float sph_neumannf(unsigned n, float x); |
---|
1431 | long double sph_neumannl(unsigned n, long double x); |
---|
1432 | |
---|
1433 | } // namespace tr1 |
---|
1434 | } // namespace std |
---|
1435 | |
---|
1436 | |
---|
1437 | [*Standard Conformity:] |
---|
1438 | ['[*Not Supported.]] |
---|
1439 | |
---|
1440 | [endsect] |
---|
1441 | |
---|
1442 | [section:unordered_set Unordered Associative Set (Hash Table).] |
---|
1443 | |
---|
1444 | #include <boost/tr1/unordered_set.hpp> |
---|
1445 | |
---|
1446 | or |
---|
1447 | |
---|
1448 | #include <unordered_set> |
---|
1449 | |
---|
1450 | This is not currently supported by Boost, although that situation is |
---|
1451 | hoped to change soon. |
---|
1452 | |
---|
1453 | namespace std { |
---|
1454 | namespace tr1 { |
---|
1455 | |
---|
1456 | template <class Value, |
---|
1457 | class Hash = hash<Value>, |
---|
1458 | class Pred = std::equal_to<Value>, |
---|
1459 | class Alloc = std::allocator<Value> > |
---|
1460 | class unordered_set; |
---|
1461 | |
---|
1462 | // [6.3.4.5] Class template unordered_multiset |
---|
1463 | template <class Value, |
---|
1464 | class Hash = hash<Value>, |
---|
1465 | class Pred = std::equal_to<Value>, |
---|
1466 | class Alloc = std::allocator<Value> > |
---|
1467 | class unordered_multiset; |
---|
1468 | |
---|
1469 | template <class Value, class Hash, class Pred, class Alloc> |
---|
1470 | void swap(unordered_set<Value, Hash, Pred, Alloc>& x, |
---|
1471 | unordered_set<Value, Hash, Pred, Alloc>& y); |
---|
1472 | |
---|
1473 | template <class Value, class Hash, class Pred, class Alloc> |
---|
1474 | void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x, |
---|
1475 | unordered_multiset<Value, Hash, Pred, Alloc>& y); |
---|
1476 | |
---|
1477 | } // namespace tr1 |
---|
1478 | } // namespace std |
---|
1479 | |
---|
1480 | [*Configuration:] |
---|
1481 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
1482 | the macro BOOST_HAS_TR1_UNORDERED_SET if your |
---|
1483 | standard library implements this part of TR1. |
---|
1484 | |
---|
1485 | [*Standard Conformity:] |
---|
1486 | Not supported. |
---|
1487 | |
---|
1488 | [endsect] |
---|
1489 | |
---|
1490 | [section:unordered_map Unordered Associative Map (Hash Table).] |
---|
1491 | |
---|
1492 | #include <boost/tr1/unordered_map.hpp> |
---|
1493 | |
---|
1494 | or |
---|
1495 | |
---|
1496 | #include <unordered_map> |
---|
1497 | |
---|
1498 | This is not currently supported by Boost, although that situation is |
---|
1499 | hoped to change soon. |
---|
1500 | |
---|
1501 | namespace std { |
---|
1502 | namespace tr1 { |
---|
1503 | |
---|
1504 | // [6.3.4.4] Class template unordered_map |
---|
1505 | template <class Key, |
---|
1506 | class T, |
---|
1507 | class Hash = hash<Key>, |
---|
1508 | class Pred = std::equal_to<Key>, |
---|
1509 | class Alloc = std::allocator<std::pair<const Key, T> > > |
---|
1510 | class unordered_map; |
---|
1511 | |
---|
1512 | // [6.3.4.6] Class template unordered_multimap |
---|
1513 | template <class Key, |
---|
1514 | class T, |
---|
1515 | class Hash = hash<Key>, |
---|
1516 | class Pred = std::equal_to<Key>, |
---|
1517 | class Alloc = std::allocator<std::pair<const Key, T> > > |
---|
1518 | class unordered_multimap; |
---|
1519 | |
---|
1520 | template <class Key, class T, class Hash, class Pred, class Alloc> |
---|
1521 | void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x, |
---|
1522 | unordered_map<Key, T, Hash, Pred, Alloc>& y); |
---|
1523 | |
---|
1524 | template <class Key, class T, class Hash, class Pred, class Alloc> |
---|
1525 | void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x, |
---|
1526 | unordered_multimap<Key, T, Hash, Pred, Alloc>& y); |
---|
1527 | |
---|
1528 | } // namespace tr1 |
---|
1529 | } // namespace std |
---|
1530 | |
---|
1531 | [*Configuration:] |
---|
1532 | [@../../libs/config/index.html Boost.Config] should (automatically) define |
---|
1533 | the macro BOOST_HAS_TR1_UNORDERED_MAP if your |
---|
1534 | standard library implements this part of TR1. |
---|
1535 | |
---|
1536 | [*Standard Conformity:] |
---|
1537 | Not supported. |
---|
1538 | |
---|
1539 | [endsect] |
---|
1540 | |
---|
1541 | [endsect] |
---|
1542 | |
---|
1543 | [section:header_list TR1 By Header] |
---|
1544 | |
---|
1545 | [section:array_header <array>] |
---|
1546 | |
---|
1547 | See: [link boost_tr1.array Fixed Size Array] |
---|
1548 | |
---|
1549 | [endsect] |
---|
1550 | |
---|
1551 | [section:cmath_header <cmath>] |
---|
1552 | |
---|
1553 | See: [link boost_tr1.special Special Functions] |
---|
1554 | |
---|
1555 | [endsect] |
---|
1556 | |
---|
1557 | [section:complex_header <complex>] |
---|
1558 | |
---|
1559 | See: [link boost_tr1.complex Additional Overloads for Complex Number Algorithms] |
---|
1560 | |
---|
1561 | See: [link boost_tr1.complex_trig Additional Complex Number Algorithms] |
---|
1562 | |
---|
1563 | [endsect] |
---|
1564 | |
---|
1565 | [section:functional <functional>] |
---|
1566 | |
---|
1567 | See: [link boost_tr1.ref Reference Wrapper]. |
---|
1568 | |
---|
1569 | See: [link boost_tr1.result_of Result_of]. |
---|
1570 | |
---|
1571 | See: [link boost_tr1.mem_fn Member Function Wrappers]. |
---|
1572 | |
---|
1573 | See: [link boost_tr1.bind Function Binders]. |
---|
1574 | |
---|
1575 | See: [link boost_tr1.function Polymorphic Function Wrappers]. |
---|
1576 | |
---|
1577 | See: [link boost_tr1.hash Hash Functions]. |
---|
1578 | |
---|
1579 | [endsect] |
---|
1580 | |
---|
1581 | [section:memory <memory>] |
---|
1582 | |
---|
1583 | See: [link boost_tr1.ptrs Smart Pointers]. |
---|
1584 | |
---|
1585 | [endsect] |
---|
1586 | |
---|
1587 | [section:random_header <random>] |
---|
1588 | |
---|
1589 | See: [link boost_tr1.random Random Numbers]. |
---|
1590 | |
---|
1591 | [endsect] |
---|
1592 | |
---|
1593 | [section:regex_header <regex>] |
---|
1594 | |
---|
1595 | See: [link boost_tr1.regex Regular Expressions]. |
---|
1596 | |
---|
1597 | [endsect] |
---|
1598 | |
---|
1599 | [section:tuple_header <tuple>] |
---|
1600 | |
---|
1601 | See: [link boost_tr1.tuple Tuple Types]. |
---|
1602 | |
---|
1603 | [endsect] |
---|
1604 | |
---|
1605 | [section:type_traits_header <type_traits>] |
---|
1606 | |
---|
1607 | See: [link boost_tr1.type_traits Type Traits]. |
---|
1608 | |
---|
1609 | [endsect] |
---|
1610 | |
---|
1611 | [section:unordered_map_header <unordered_map>] |
---|
1612 | |
---|
1613 | See: [link boost_tr1.unordered_map Unordered Associative Map] |
---|
1614 | |
---|
1615 | [endsect] |
---|
1616 | |
---|
1617 | [section:unordered_set_header <unordered_set>] |
---|
1618 | |
---|
1619 | See: [link boost_tr1.unordered_set Unordered Associative Set]. |
---|
1620 | |
---|
1621 | [endsect] |
---|
1622 | |
---|
1623 | [section:utility_header <utility>] |
---|
1624 | |
---|
1625 | See: [link boost_tr1.utility Tuple Interface to std::pair]. |
---|
1626 | |
---|
1627 | [endsect] |
---|
1628 | |
---|
1629 | [endsect] |
---|
1630 | |
---|
1631 | [section:implementation Implementation] |
---|
1632 | |
---|
1633 | When Boost.TR1 is [link boost_tr1.config configured] to make use of your standard library's |
---|
1634 | native TR1 implementation, then it doesn't do very much: it just includes |
---|
1635 | the appropriate header. |
---|
1636 | |
---|
1637 | When Boost.TR1 is using the Boost implementation of a particular |
---|
1638 | component, then it includes the appropriate Boost header(s) and imports |
---|
1639 | the necessary declarations in `namespace std::tr1` with using declarations. |
---|
1640 | Note that only those declarations that are part of the standard are imported: |
---|
1641 | the implementation is deliberately quite strict about not including any |
---|
1642 | Boost-specific extensions in `namespace std::tr1`, in order to catch any |
---|
1643 | portability errors in user code. If you really need to use Boost-specific |
---|
1644 | extensions then you should include the Boost headers directly and use the |
---|
1645 | declarations in `namespace boost::` instead. Note that this style of implementation |
---|
1646 | is not completely standards-conforming, in particular it is not possible |
---|
1647 | to add user-defined template specializations of TR1 components |
---|
1648 | into `namespace std::tr1`. There are also one or two Boost libraries that are not |
---|
1649 | yet fully standards conforming, any such non-conformities are documented in |
---|
1650 | [link boost_tr1.subject_list the TR1 by subject section]. Hopefully, occurrences of non-standard |
---|
1651 | behavior should be extremely rare in practice however. |
---|
1652 | |
---|
1653 | If you use the standard conforming header includes (in `boost/tr1/tr1`) |
---|
1654 | then these header names can sometimes conflict with existing standard library |
---|
1655 | headers (for example `shared_ptr` is added to the existing |
---|
1656 | standard library header |
---|
1657 | `<memory>` rather than it's own header). These headers |
---|
1658 | forward on to your existing standard library header in one of two ways: for |
---|
1659 | gcc it uses `#include_next`, and for other compilers it uses the |
---|
1660 | macro `BOOST_TR1_STD_HEADER(header)` (defined in |
---|
1661 | [@../../boost/tr1/detail/config.hpp" boost/tr1/detail/config.hpp]) |
---|
1662 | which evaluates to `#include <../include/header>`. This |
---|
1663 | should work "straight out the box" for most compilers, but does mean that |
---|
1664 | these headers should [*never] be placed inside a |
---|
1665 | directory called "include" |
---|
1666 | that is already in your compiler's search path. |
---|
1667 | |
---|
1668 | [endsect] |
---|
1669 | |
---|
1670 | |
---|
1671 | [section:testing Testing] |
---|
1672 | |
---|
1673 | The test suite for Boost.TR1 is relatively lightweight; tests have been |
---|
1674 | added to the Boost.Config test suite for each new configuration macro, and |
---|
1675 | each TR1 component has a very short concept check test added. The concept test |
---|
1676 | programs are designed only to verify that all the TR1 components |
---|
1677 | that are |
---|
1678 | supposed to be in `namespace std::tr1` are indeed present and have standards |
---|
1679 | conforming interfaces. There are a few test programs (those which end in the suffix |
---|
1680 | "_tricky") which do not currently compile with the Boost.TR1 implementation, because the |
---|
1681 | relevant Boost libraries have not yet implemented the features tested; hopefully |
---|
1682 | these incompatibilities will be removed in future releases. |
---|
1683 | |
---|
1684 | The concept tests do not take account of compiler defects (quite deliberately |
---|
1685 | so); the intent is that the tests can be used to verify conformance with the |
---|
1686 | standard, both for Boost code, and for third party implementations. Consequently |
---|
1687 | very many of these tests are known to fail with older compilers. This should |
---|
1688 | not be taken as evidence that these compilers can not be used at all with Boost.TR1, |
---|
1689 | simply that there are features missing that make those compilers non-conforming. |
---|
1690 | |
---|
1691 | Full runtime tests for TR1 components are not in general part of this |
---|
1692 | test suite, however, it is hoped that the Boost.TR1 component authors will make |
---|
1693 | their regular test suites compile with the standards conforming headers as well |
---|
1694 | as the Boost-specific ones. This will allow these tests to be used against the standard |
---|
1695 | library's own TR1 implementation as well as the Boost one. |
---|
1696 | |
---|
1697 | [endsect] |
---|
1698 | |
---|
1699 | |
---|
1700 | |
---|
1701 | |
---|
1702 | |
---|