[stacktrace.basic.nonmem] # 19 Diagnostics library [[diagnostics]](./#diagnostics) ## 19.6 Stacktrace [[stacktrace]](stacktrace#basic.nonmem) ### 19.6.4 Class template basic_stacktrace [[stacktrace.basic]](stacktrace.basic#nonmem) #### 19.6.4.6 Non-member functions [stacktrace.basic.nonmem] [🔗](#lib:swap,basic_stacktrace) `template void swap(basic_stacktrace& a, basic_stacktrace& b) noexcept(noexcept(a.swap(b))); ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L2295) *Effects*: Equivalent to a.swap(b)[.](#1.sentence-1) [🔗](#lib:to_string,basic_stacktrace) `string to_string(const stacktrace_entry& f); ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L2306) *Returns*: A string with a description of f[.](#2.sentence-1) [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L2310) *Recommended practice*: The description should provide information about the contained evaluation, including information fromf.source_file() and f.source_line()[.](#3.sentence-1) [🔗](#lib:to_string,basic_stacktrace_) `template string to_string(const basic_stacktrace& st); ` [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L2324) *Returns*: A string with a description of st[.](#4.sentence-1) [*Note [1](#note-1)*: The number of lines is not guaranteed to be equal to st.size()[.](#4.sentence-2) — *end note*] [🔗](#lib:operator%3c%3c,stacktrace_entry) `ostream& operator<<(ostream& os, const stacktrace_entry& f); ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L2338) *Effects*: Equivalent to: return os << to_string(f); [🔗](#lib:operator%3c%3c,basic_stacktrace) `template ostream& operator<<(ostream& os, const basic_stacktrace& st); ` [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L2350) *Effects*: Equivalent to: return os << to_string(st);