]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/stacktrace/example/user_config.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / stacktrace / example / user_config.hpp
1 // Copyright Antony Polukhin, 2016-2017.
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See
4 // accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6
7
8 //[getting_started_user_config
9 #ifndef USER_CONFIG_HPP
10 #define USER_CONFIG_HPP
11
12 #include <boost/stacktrace/stacktrace_fwd.hpp>
13
14 #include <iosfwd>
15
16 namespace boost { namespace stacktrace {
17
18 template <class CharT, class TraitsT, class Allocator>
19 std::basic_ostream<CharT, TraitsT>& do_stream_st(std::basic_ostream<CharT, TraitsT>& os, const basic_stacktrace<Allocator>& bt);
20
21 template <class CharT, class TraitsT>
22 std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT>& os, const stacktrace& bt) {
23 return do_stream_st(os, bt);
24 }
25
26 }} // namespace boost::stacktrace
27 #endif // USER_CONFIG_HPP
28 //]
29
30 #ifndef USER_CONFIG2_HPP
31 #define USER_CONFIG2_HPP
32 //[getting_started_user_config_impl
33 namespace boost { namespace stacktrace {
34
35 template <class CharT, class TraitsT, class Allocator>
36 std::basic_ostream<CharT, TraitsT>& do_stream_st(std::basic_ostream<CharT, TraitsT>& os, const basic_stacktrace<Allocator>& bt) {
37 const std::streamsize w = os.width();
38 const std::size_t frames = bt.size();
39 for (std::size_t i = 0; i < frames; ++i) {
40 os.width(2);
41 os << i;
42 os.width(w);
43 os << "# ";
44 os << bt[i].name();
45 os << '\n';
46 }
47
48 return os;
49 }
50
51 }} // namespace boost::stacktrace
52 //]
53
54 #endif // USER_CONFIG2_HPP
55