]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/stacktrace/example/user_config.hpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / stacktrace / example / user_config.hpp
CommitLineData
f67539c2 1// Copyright Antony Polukhin, 2016-2020.
b32b8144
FG
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
16namespace boost { namespace stacktrace {
17
18template <class CharT, class TraitsT, class Allocator>
19std::basic_ostream<CharT, TraitsT>& do_stream_st(std::basic_ostream<CharT, TraitsT>& os, const basic_stacktrace<Allocator>& bt);
20
21template <class CharT, class TraitsT>
22std::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
92f5a8d4
TL
32
33#include <ios> // std::streamsize
34
b32b8144
FG
35//[getting_started_user_config_impl
36namespace boost { namespace stacktrace {
37
38template <class CharT, class TraitsT, class Allocator>
39std::basic_ostream<CharT, TraitsT>& do_stream_st(std::basic_ostream<CharT, TraitsT>& os, const basic_stacktrace<Allocator>& bt) {
40 const std::streamsize w = os.width();
41 const std::size_t frames = bt.size();
42 for (std::size_t i = 0; i < frames; ++i) {
43 os.width(2);
44 os << i;
45 os.width(w);
46 os << "# ";
47 os << bt[i].name();
48 os << '\n';
49 }
50
51 return os;
52}
53
54}} // namespace boost::stacktrace
55//]
56
57#endif // USER_CONFIG2_HPP
58