Blame view

3rdparty/boost_1_81_0/libs/convert/doc/tools.qbk 2.35 KB
977ed18d   Hu Chunming   提交三方库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  [/
    Copyright (c) Vladimir Batov 2009-2022
    Distributed under the Boost Software License, Version 1.0.
    See copy at http://www.boost.org/LICENSE_1_0.txt.
  ]
  
  [section:supporting_tools Supporting Tools]
  
  This section describes a few supporting tools written as part of ['Boost.Convert] but which might be useful in their own rights.
  
  [section boost::cnv::range]
  
  ['boost::cnv::range] is a consolidation of the [begin, end)-based ranges (such as ['std::string]) and the sentry-based ranges (such as null-terminated C-style strings). It allows universal traversal of both types of ranges with
  
   for (auto s = range.begin(); s != range.sentry(); ++s)
  
  without the penalty or the need for an extra traversal of the sentry-based ranges in order to find the end.
  
  TODO
  
  [endsect]
  [section boost::cnv::is_range]
  
  TODO
  
  [endsect]
  [section BOOST_DECLARE_HAS_MEMBER]
  
  The BOOST_DECLARE_HAS_MEMBER macro allows to declare a trait which would then let introspect the existence of a class member (a data member or a member function) with the specified name. 
  
  For example, the following declarations introduce `local::has_begin` and `local::has_funop` traits which then allow to test if the supplied class has respectively `begin` and `operator()` members:
  
  [has_member_declaration]
  
  Now these traits can be used as follows:
  
  [has_member_classes_tested]
  [has_member_usage]
  
  As it can be seen from the example the traits only check for the existence of a member (be that a data member or a member function) with the specified name. 
  
  [endsect]
  [section BOOST_DECLARE_IS_CALLABLE]
  
  The BOOST_DECLARE_IS_CALLABLE macro extends the functionality provided by BOOST_DECLARE_HAS_MEMBER and allows to declare a trait which would then let introspect the existence of a named class member function ['callable with the supplied signature]. 
  
  For example, the following declarations introduce `local::can_call_funop` and `local::can_call_func` traits: 
  
  [is_callable_declaration]
  
  The traits allow to test if the supplied class has respectively `operator()` and `func()` member functions callable with the specified signature:
  
  [is_callable_classes_tested]
  [is_callable_usage1]
  [is_callable_usage2]
  
  As it can be seen from the example the traits check for the existence of a ['callable] member function but ['not necessarily of the specified signature]. Please check the ['Boost.TTI] library for the latter.
  
  [endsect]
  [endsect]