Skip to content

Commit 7fc257b

Browse files
committed
Add 3 sections: design, impact, proposed interface
Note: I didn't replace boost in namespaces
1 parent 9f3d01b commit 7fc257b

File tree

1 file changed

+73
-1
lines changed

1 file changed

+73
-1
lines changed

stacktrace.html

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,79 @@ <h2>II. Proposed wording</h2>
7070
<p>X.2.2.1.1. </p>
7171
<p>X.2.2. Header &lt;stacktrace_fwd&gt; <span class="right">[stacktrace.fwd]</span></p>
7272
-->
73-
<h2>II. Feature-testing macro</h2>
73+
<h2>II. Impact on the Standard</h2>
74+
<p>This proposal is a pure library extension and it do not break the existing code and do not degrade performance. It is does not require any changes in the core language and could be implemented in standard C++.</p>
75+
<h2>III. Design Decisions</h2>
76+
<p>The design is based on Boost.Stacktrace, an popular library that does not depend on any non-standard library components and provides the STD-like interface.</p>
77+
<p>Note about signal safety: we can't offer the proposal which could be signal-safe on any platform because it's not possible to implement. <!-- add note about custom allocator? --></p>
78+
<h2>IV. Proposed Interface</h2>
79+
<h3>Header &lt;stacktrace&gt;</h3>
80+
<pre>
81+
namespace boost {
82+
namespace stacktrace {
83+
template&lt;typename Allocator&gt; class basic_stacktrace;
84+
85+
typedef basic_stacktrace stacktrace; // This is the typedef to use unless you'd like to provide a specific allocator to boost::stacktrace::basic_stacktrace.
86+
template&lt;typename Allocator1, typename Allocator2&gt;
87+
bool operator&lt;(const basic_stacktrace&lt; Allocator1 &gt; &,
88+
const basic_stacktrace&lt; Allocator2 &gt; &);
89+
template&lt;typename Allocator1, typename Allocator2&gt;
90+
bool operator==(const basic_stacktrace&lt; Allocator1 &gt; &,
91+
const basic_stacktrace&lt; Allocator2 &gt; &);
92+
93+
// Comparison operators that provide platform dependant ordering and have amortized O(1) complexity; O(size()) worst case complexity; are Async-Handler-Safe.
94+
template&lt;typename Allocator1, typename Allocator2&gt;
95+
bool operator&gt;(const basic_stacktrace&lt; Allocator1 &gt; & lhs,
96+
const basic_stacktrace&lt; Allocator2 &gt; & rhs);
97+
template&lt;typename Allocator1, typename Allocator2&gt;
98+
bool operator&lt;=(const basic_stacktrace&lt; Allocator1 &gt; & lhs,
99+
const basic_stacktrace&lt; Allocator2 &gt; & rhs);
100+
template&lt;typename Allocator1, typename Allocator2&gt;
101+
bool operator&gt;=(const basic_stacktrace&lt; Allocator1 &gt; & lhs,
102+
const basic_stacktrace&lt; Allocator2 &gt; & rhs);
103+
template&lt;typename Allocator1, typename Allocator2&gt;
104+
bool operator!=(const basic_stacktrace&lt; Allocator1 &gt; & lhs,
105+
const basic_stacktrace&lt; Allocator2 &gt; & rhs);
106+
107+
// Fast hashing support, O(st.size()) complexity; Async-Handler-Safe.
108+
template&lt;typename Allocator&gt;
109+
std::size_t hash_value(const basic_stacktrace&lt; Allocator &gt; & st);
110+
111+
// Outputs stacktrace in a human readable format to output stream; unsafe to use in async handlers.
112+
template&lt;typename CharT, typename TraitsT, typename Allocator&gt;
113+
std::basic_ostream&lt; CharT, TraitsT &gt; &
114+
operator&lt;&lt;(std::basic_ostream&lt; CharT, TraitsT &gt; & os,
115+
const basic_stacktrace&lt; Allocator &gt; & bt);
116+
}
117+
}
118+
</pre>
119+
<h3> Header &lt;frame&gt;</h3>
120+
<pre>
121+
namespace boost {
122+
namespace stacktrace {
123+
124+
// Comparison operators that provide platform dependant ordering and have O(1) complexity; are Async-Handler-Safe.
125+
constexpr bool operator&lt;(const frame & lhs, const frame & rhs);
126+
constexpr bool operator&gt;(const frame & lhs, const frame & rhs);
127+
constexpr bool operator&lt;=(const frame & lhs, const frame & rhs);
128+
constexpr bool operator&gt;=(const frame & lhs, const frame & rhs);
129+
constexpr bool operator==(const frame & lhs, const frame & rhs);
130+
constexpr bool operator!=(const frame & lhs, const frame & rhs);
131+
132+
// Fast hashing support, O(1) complexity; Async-Handler-Safe.
133+
std::size_t hash_value(const frame & f);
134+
135+
// Outputs stacktrace::frame in a human readable format to string; unsafe to use in async handlers.
136+
std::string to_string(const frame & f);
137+
138+
// Outputs stacktrace::frame in a human readable format to output stream; unsafe to use in async handlers.
139+
template&lt;typename CharT, typename TraitsT&gt;
140+
std::basic_ostream&lt; CharT, TraitsT &gt; &
141+
operator&lt;&lt;(std::basic_ostream&lt; CharT, TraitsT &gt; & os, const frame & f);
142+
}
143+
}
144+
</pre>
145+
<h2>V. Feature-testing macro</h2>
74146
<p>For the purposes of SG10 we recommend the feature-testing macro name <code>__cpp_lib_stacktrace</code>.</p>
75147

76148
<script type="text/javascript">

0 commit comments

Comments
 (0)