1<!DOCTYPE html> 2<html lang="en"> 3<head> 4<meta charset="UTF-8"> 5<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]--> 6<meta name="viewport" content="width=device-width, initial-scale=1.0"> 7<meta name="generator" content="Asciidoctor 1.5.8"> 8<meta name="author" content="Beman Dawes, Christopher Kohlhoff, Peter Dimov"> 9<title>Boost.System: Extensible Error Reporting</title> 10<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700"> 11<style> 12/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */ 13/* Uncomment @import statement below to use as custom stylesheet */ 14/*@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700";*/ 15article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block} 16audio,canvas,video{display:inline-block} 17audio:not([controls]){display:none;height:0} 18script{display:none!important} 19html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%} 20a{background:transparent} 21a:focus{outline:thin dotted} 22a:active,a:hover{outline:0} 23h1{font-size:2em;margin:.67em 0} 24abbr[title]{border-bottom:1px dotted} 25b,strong{font-weight:bold} 26dfn{font-style:italic} 27hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0} 28mark{background:#ff0;color:#000} 29code,kbd,pre,samp{font-family:monospace;font-size:1em} 30pre{white-space:pre-wrap} 31q{quotes:"\201C" "\201D" "\2018" "\2019"} 32small{font-size:80%} 33sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline} 34sup{top:-.5em} 35sub{bottom:-.25em} 36img{border:0} 37svg:not(:root){overflow:hidden} 38figure{margin:0} 39fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em} 40legend{border:0;padding:0} 41button,input,select,textarea{font-family:inherit;font-size:100%;margin:0} 42button,input{line-height:normal} 43button,select{text-transform:none} 44button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer} 45button[disabled],html input[disabled]{cursor:default} 46input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0} 47button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0} 48textarea{overflow:auto;vertical-align:top} 49table{border-collapse:collapse;border-spacing:0} 50*,*::before,*::after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box} 51html,body{font-size:100%} 52body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;font-weight:400;font-style:normal;line-height:1;position:relative;cursor:auto;tab-size:4;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased} 53a:hover{cursor:pointer} 54img,object,embed{max-width:100%;height:auto} 55object,embed{height:100%} 56img{-ms-interpolation-mode:bicubic} 57.left{float:left!important} 58.right{float:right!important} 59.text-left{text-align:left!important} 60.text-right{text-align:right!important} 61.text-center{text-align:center!important} 62.text-justify{text-align:justify!important} 63.hide{display:none} 64img,object,svg{display:inline-block;vertical-align:middle} 65textarea{height:auto;min-height:50px} 66select{width:100%} 67.center{margin-left:auto;margin-right:auto} 68.stretch{width:100%} 69.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em} 70div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0;direction:ltr} 71a{color:#2156a5;text-decoration:underline;line-height:inherit} 72a:hover,a:focus{color:#1d4b8f} 73a img{border:none} 74p{font-family:inherit;font-weight:400;font-size:1em;line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility} 75p aside{font-size:.875em;line-height:1.35;font-style:italic} 76h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em} 77h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0} 78h1{font-size:2.125em} 79h2{font-size:1.6875em} 80h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em} 81h4,h5{font-size:1.125em} 82h6{font-size:1em} 83hr{border:solid #dddddf;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0} 84em,i{font-style:italic;line-height:inherit} 85strong,b{font-weight:bold;line-height:inherit} 86small{font-size:60%;line-height:inherit} 87code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)} 88ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit} 89ul,ol{margin-left:1.5em} 90ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em} 91ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit} 92ul.square{list-style-type:square} 93ul.circle{list-style-type:circle} 94ul.disc{list-style-type:disc} 95ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0} 96dl dt{margin-bottom:.3125em;font-weight:bold} 97dl dd{margin-bottom:1.25em} 98abbr,acronym{text-transform:uppercase;font-size:90%;color:rgba(0,0,0,.8);border-bottom:1px dotted #ddd;cursor:help} 99abbr{text-transform:none} 100blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd} 101blockquote cite{display:block;font-size:.9375em;color:rgba(0,0,0,.6)} 102blockquote cite::before{content:"\2014 \0020"} 103blockquote cite a,blockquote cite a:visited{color:rgba(0,0,0,.6)} 104blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)} 105@media screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2} 106h1{font-size:2.75em} 107h2{font-size:2.3125em} 108h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em} 109h4{font-size:1.4375em}} 110table{background:#fff;margin-bottom:1.25em;border:solid 1px #dedede} 111table thead,table tfoot{background:#f7f8f7} 112table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left} 113table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)} 114table tr.even,table tr.alt,table tr:nth-of-type(even){background:#f8f8f7} 115table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.6} 116h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em} 117h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400} 118.clearfix::before,.clearfix::after,.float-group::before,.float-group::after{content:" ";display:table} 119.clearfix::after,.float-group::after{clear:both} 120*:not(pre)>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background-color:#f7f7f8;-webkit-border-radius:4px;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed;word-wrap:break-word} 121*:not(pre)>code.nobreak{word-wrap:normal} 122*:not(pre)>code.nowrap{white-space:nowrap} 123pre,pre>code{line-height:1.45;color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;text-rendering:optimizeSpeed} 124em em{font-style:normal} 125strong strong{font-weight:400} 126.keyseq{color:rgba(51,51,51,.8)} 127kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap} 128.keyseq kbd:first-child{margin-left:0} 129.keyseq kbd:last-child{margin-right:0} 130.menuseq,.menuref{color:#000} 131.menuseq b:not(.caret),.menuref{font-weight:inherit} 132.menuseq{word-spacing:-.02em} 133.menuseq b.caret{font-size:1.25em;line-height:.8} 134.menuseq i.caret{font-weight:bold;text-align:center;width:.45em} 135b.button::before,b.button::after{position:relative;top:-1px;font-weight:400} 136b.button::before{content:"[";padding:0 3px 0 2px} 137b.button::after{content:"]";padding:0 2px 0 3px} 138p a>code:hover{color:rgba(0,0,0,.9)} 139#header,#content,#footnotes,#footer{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em} 140#header::before,#header::after,#content::before,#content::after,#footnotes::before,#footnotes::after,#footer::before,#footer::after{content:" ";display:table} 141#header::after,#content::after,#footnotes::after,#footer::after{clear:both} 142#content{margin-top:1.25em} 143#content::before{content:none} 144#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0} 145#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #dddddf} 146#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px} 147#header .details{border-bottom:1px solid #dddddf;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap} 148#header .details span:first-child{margin-left:-.125em} 149#header .details span.email a{color:rgba(0,0,0,.85)} 150#header .details br{display:none} 151#header .details br+span::before{content:"\00a0\2013\00a0"} 152#header .details br+span.author::before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)} 153#header .details br+span#revremark::before{content:"\00a0|\00a0"} 154#header #revnumber{text-transform:capitalize} 155#header #revnumber::after{content:"\00a0"} 156#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #dddddf;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem} 157#toc{border-bottom:1px solid #e7e7e9;padding-bottom:.5em} 158#toc>ul{margin-left:.125em} 159#toc ul.sectlevel0>li>a{font-style:italic} 160#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0} 161#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none} 162#toc li{line-height:1.3334;margin-top:.3334em} 163#toc a{text-decoration:none} 164#toc a:active{text-decoration:underline} 165#toctitle{color:#7a2518;font-size:1.2em} 166@media screen and (min-width:768px){#toctitle{font-size:1.375em} 167body.toc2{padding-left:15em;padding-right:0} 168#toc.toc2{margin-top:0!important;background-color:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #e7e7e9;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto} 169#toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em} 170#toc.toc2>ul{font-size:.9em;margin-bottom:0} 171#toc.toc2 ul ul{margin-left:0;padding-left:1em} 172#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em} 173body.toc2.toc-right{padding-left:0;padding-right:15em} 174body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #e7e7e9;left:auto;right:0}} 175@media screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0} 176#toc.toc2{width:20em} 177#toc.toc2 #toctitle{font-size:1.375em} 178#toc.toc2>ul{font-size:.95em} 179#toc.toc2 ul ul{padding-left:1.25em} 180body.toc2.toc-right{padding-left:0;padding-right:20em}} 181#content #toc{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px} 182#content #toc>:first-child{margin-top:0} 183#content #toc>:last-child{margin-bottom:0} 184#footer{max-width:100%;background-color:rgba(0,0,0,.8);padding:1.25em} 185#footer-text{color:rgba(255,255,255,.8);line-height:1.44} 186#content{margin-bottom:.625em} 187.sect1{padding-bottom:.625em} 188@media screen and (min-width:768px){#content{margin-bottom:1.25em} 189.sect1{padding-bottom:1.25em}} 190.sect1:last-child{padding-bottom:0} 191.sect1+.sect1{border-top:1px solid #e7e7e9} 192#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400} 193#content h1>a.anchor::before,h2>a.anchor::before,h3>a.anchor::before,#toctitle>a.anchor::before,.sidebarblock>.content>.title>a.anchor::before,h4>a.anchor::before,h5>a.anchor::before,h6>a.anchor::before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em} 194#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible} 195#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none} 196#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221} 197.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em} 198.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic} 199table.tableblock.fit-content>caption.title{white-space:nowrap;width:0} 200.paragraph.lead>p,#preamble>.sectionbody>[class="paragraph"]:first-of-type p{font-size:1.21875em;line-height:1.6;color:rgba(0,0,0,.85)} 201table.tableblock #preamble>.sectionbody>[class="paragraph"]:first-of-type p{font-size:inherit} 202.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%} 203.admonitionblock>table td.icon{text-align:center;width:80px} 204.admonitionblock>table td.icon img{max-width:none} 205.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase} 206.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #dddddf;color:rgba(0,0,0,.6)} 207.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0} 208.exampleblock>.content{border-style:solid;border-width:1px;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;-webkit-border-radius:4px;border-radius:4px} 209.exampleblock>.content>:first-child{margin-top:0} 210.exampleblock>.content>:last-child{margin-bottom:0} 211.sidebarblock{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px} 212.sidebarblock>:first-child{margin-top:0} 213.sidebarblock>:last-child{margin-bottom:0} 214.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center} 215.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0} 216.literalblock pre,.listingblock pre:not(.highlight),.listingblock pre[class="highlight"],.listingblock pre[class^="highlight "],.listingblock pre.CodeRay,.listingblock pre.prettyprint{background:#f7f7f8} 217.sidebarblock .literalblock pre,.sidebarblock .listingblock pre:not(.highlight),.sidebarblock .listingblock pre[class="highlight"],.sidebarblock .listingblock pre[class^="highlight "],.sidebarblock .listingblock pre.CodeRay,.sidebarblock .listingblock pre.prettyprint{background:#f2f1f1} 218.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{-webkit-border-radius:4px;border-radius:4px;word-wrap:break-word;overflow-x:auto;padding:1em;font-size:.8125em} 219@media screen and (min-width:768px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:.90625em}} 220@media screen and (min-width:1280px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:1em}} 221.literalblock pre.nowrap,.literalblock pre.nowrap pre,.listingblock pre.nowrap,.listingblock pre.nowrap pre{white-space:pre;word-wrap:normal} 222.literalblock.output pre{color:#f7f7f8;background-color:rgba(0,0,0,.9)} 223.listingblock pre.highlightjs{padding:0} 224.listingblock pre.highlightjs>code{padding:1em;-webkit-border-radius:4px;border-radius:4px} 225.listingblock pre.prettyprint{border-width:0} 226.listingblock>.content{position:relative} 227.listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:#999} 228.listingblock:hover code[data-lang]::before{display:block} 229.listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:.5em;color:#999} 230.listingblock.terminal pre .command:not([data-prompt])::before{content:"$"} 231table.pyhltable{border-collapse:separate;border:0;margin-bottom:0;background:none} 232table.pyhltable td{vertical-align:top;padding-top:0;padding-bottom:0;line-height:1.45} 233table.pyhltable td.code{padding-left:.75em;padding-right:0} 234pre.pygments .lineno,table.pyhltable td:not(.code){color:#999;padding-left:0;padding-right:.5em;border-right:1px solid #dddddf} 235pre.pygments .lineno{display:inline-block;margin-right:.25em} 236table.pyhltable .linenodiv{background:none!important;padding-right:0!important} 237.quoteblock{margin:0 1em 1.25em 1.5em;display:table} 238.quoteblock>.title{margin-left:-1.5em;margin-bottom:.75em} 239.quoteblock blockquote,.quoteblock p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify} 240.quoteblock blockquote{margin:0;padding:0;border:0} 241.quoteblock blockquote::before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)} 242.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0} 243.quoteblock .attribution{margin-top:.75em;margin-right:.5ex;text-align:right} 244.verseblock{margin:0 1em 1.25em} 245.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility} 246.verseblock pre strong{font-weight:400} 247.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex} 248.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic} 249.quoteblock .attribution br,.verseblock .attribution br{display:none} 250.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)} 251.quoteblock.abstract blockquote::before,.quoteblock.excerpt blockquote::before,.quoteblock .quoteblock blockquote::before{display:none} 252.quoteblock.abstract blockquote,.quoteblock.abstract p,.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{line-height:1.6;word-spacing:0} 253.quoteblock.abstract{margin:0 1em 1.25em;display:block} 254.quoteblock.abstract>.title{margin:0 0 .375em;font-size:1.15em;text-align:center} 255.quoteblock.excerpt,.quoteblock .quoteblock{margin:0 0 1.25em;padding:0 0 .25em 1em;border-left:.25em solid #dddddf} 256.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{color:inherit;font-size:1.0625rem} 257.quoteblock.excerpt .attribution,.quoteblock .quoteblock .attribution{color:inherit;text-align:left;margin-right:0} 258table.tableblock{max-width:100%;border-collapse:separate} 259p.tableblock:last-child{margin-bottom:0} 260td.tableblock>.content{margin-bottom:-1.25em} 261table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede} 262table.grid-all>thead>tr>.tableblock,table.grid-all>tbody>tr>.tableblock{border-width:0 1px 1px 0} 263table.grid-all>tfoot>tr>.tableblock{border-width:1px 1px 0 0} 264table.grid-cols>*>tr>.tableblock{border-width:0 1px 0 0} 265table.grid-rows>thead>tr>.tableblock,table.grid-rows>tbody>tr>.tableblock{border-width:0 0 1px} 266table.grid-rows>tfoot>tr>.tableblock{border-width:1px 0 0} 267table.grid-all>*>tr>.tableblock:last-child,table.grid-cols>*>tr>.tableblock:last-child{border-right-width:0} 268table.grid-all>tbody>tr:last-child>.tableblock,table.grid-all>thead:last-child>tr>.tableblock,table.grid-rows>tbody>tr:last-child>.tableblock,table.grid-rows>thead:last-child>tr>.tableblock{border-bottom-width:0} 269table.frame-all{border-width:1px} 270table.frame-sides{border-width:0 1px} 271table.frame-topbot,table.frame-ends{border-width:1px 0} 272table.stripes-all tr,table.stripes-odd tr:nth-of-type(odd){background:#f8f8f7} 273table.stripes-none tr,table.stripes-odd tr:nth-of-type(even){background:none} 274th.halign-left,td.halign-left{text-align:left} 275th.halign-right,td.halign-right{text-align:right} 276th.halign-center,td.halign-center{text-align:center} 277th.valign-top,td.valign-top{vertical-align:top} 278th.valign-bottom,td.valign-bottom{vertical-align:bottom} 279th.valign-middle,td.valign-middle{vertical-align:middle} 280table thead th,table tfoot th{font-weight:bold} 281tbody tr th{display:table-cell;line-height:1.6;background:#f7f8f7} 282tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold} 283p.tableblock>code:only-child{background:none;padding:0} 284p.tableblock{font-size:1em} 285td>div.verse{white-space:pre} 286ol{margin-left:1.75em} 287ul li ol{margin-left:1.5em} 288dl dd{margin-left:1.125em} 289dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0} 290ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em} 291ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none} 292ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em} 293ul.unstyled,ol.unstyled{margin-left:0} 294ul.checklist{margin-left:.625em} 295ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em} 296ul.checklist li>p:first-child>input[type="checkbox"]:first-child{margin-right:.25em} 297ul.inline{display:-ms-flexbox;display:-webkit-box;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap;list-style:none;margin:0 0 .625em -1.25em} 298ul.inline>li{margin-left:1.25em} 299.unstyled dl dt{font-weight:400;font-style:normal} 300ol.arabic{list-style-type:decimal} 301ol.decimal{list-style-type:decimal-leading-zero} 302ol.loweralpha{list-style-type:lower-alpha} 303ol.upperalpha{list-style-type:upper-alpha} 304ol.lowerroman{list-style-type:lower-roman} 305ol.upperroman{list-style-type:upper-roman} 306ol.lowergreek{list-style-type:lower-greek} 307.hdlist>table,.colist>table{border:0;background:none} 308.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none} 309td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em} 310td.hdlist1{font-weight:bold;padding-bottom:1.25em} 311.literalblock+.colist,.listingblock+.colist{margin-top:-.5em} 312.colist td:not([class]):first-child{padding:.4em .75em 0;line-height:1;vertical-align:top} 313.colist td:not([class]):first-child img{max-width:none} 314.colist td:not([class]):last-child{padding:.25em 0} 315.thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd} 316.imageblock.left{margin:.25em .625em 1.25em 0} 317.imageblock.right{margin:.25em 0 1.25em .625em} 318.imageblock>.title{margin-bottom:0} 319.imageblock.thumb,.imageblock.th{border-width:6px} 320.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em} 321.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0} 322.image.left{margin-right:.625em} 323.image.right{margin-left:.625em} 324a.image{text-decoration:none;display:inline-block} 325a.image object{pointer-events:none} 326sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super} 327sup.footnote a,sup.footnoteref a{text-decoration:none} 328sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline} 329#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em} 330#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em;border-width:1px 0 0} 331#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;margin-bottom:.2em} 332#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none;margin-left:-1.05em} 333#footnotes .footnote:last-of-type{margin-bottom:0} 334#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0} 335.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0} 336.gist .file-data>table td.line-data{width:99%} 337div.unbreakable{page-break-inside:avoid} 338.big{font-size:larger} 339.small{font-size:smaller} 340.underline{text-decoration:underline} 341.overline{text-decoration:overline} 342.line-through{text-decoration:line-through} 343.aqua{color:#00bfbf} 344.aqua-background{background-color:#00fafa} 345.black{color:#000} 346.black-background{background-color:#000} 347.blue{color:#0000bf} 348.blue-background{background-color:#0000fa} 349.fuchsia{color:#bf00bf} 350.fuchsia-background{background-color:#fa00fa} 351.gray{color:#606060} 352.gray-background{background-color:#7d7d7d} 353.green{color:#006000} 354.green-background{background-color:#007d00} 355.lime{color:#00bf00} 356.lime-background{background-color:#00fa00} 357.maroon{color:#600000} 358.maroon-background{background-color:#7d0000} 359.navy{color:#000060} 360.navy-background{background-color:#00007d} 361.olive{color:#606000} 362.olive-background{background-color:#7d7d00} 363.purple{color:#600060} 364.purple-background{background-color:#7d007d} 365.red{color:#bf0000} 366.red-background{background-color:#fa0000} 367.silver{color:#909090} 368.silver-background{background-color:#bcbcbc} 369.teal{color:#006060} 370.teal-background{background-color:#007d7d} 371.white{color:#bfbfbf} 372.white-background{background-color:#fafafa} 373.yellow{color:#bfbf00} 374.yellow-background{background-color:#fafa00} 375span.icon>.fa{cursor:default} 376a span.icon>.fa{cursor:inherit} 377.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default} 378.admonitionblock td.icon .icon-note::before{content:"\f05a";color:#19407c} 379.admonitionblock td.icon .icon-tip::before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111} 380.admonitionblock td.icon .icon-warning::before{content:"\f071";color:#bf6900} 381.admonitionblock td.icon .icon-caution::before{content:"\f06d";color:#bf3400} 382.admonitionblock td.icon .icon-important::before{content:"\f06a";color:#bf0000} 383.conum[data-value]{display:inline-block;color:#fff!important;background-color:rgba(0,0,0,.8);-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold} 384.conum[data-value] *{color:#fff!important} 385.conum[data-value]+b{display:none} 386.conum[data-value]::after{content:attr(data-value)} 387pre .conum[data-value]{position:relative;top:-.125em} 388b.conum *{color:inherit!important} 389.conum:not([data-value]):empty{display:none} 390dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility} 391h1,h2,p,td.content,span.alt{letter-spacing:-.01em} 392p strong,td.content strong,div.footnote strong{letter-spacing:-.005em} 393p,blockquote,dt,td.content,span.alt{font-size:1.0625rem} 394p{margin-bottom:1.25rem} 395.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em} 396.exampleblock>.content{background-color:#fffef7;border-color:#e0e0dc;-webkit-box-shadow:0 1px 4px #e0e0dc;box-shadow:0 1px 4px #e0e0dc} 397.print-only{display:none!important} 398@page{margin:1.25cm .75cm} 399@media print{*{-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important} 400html{font-size:80%} 401a{color:inherit!important;text-decoration:underline!important} 402a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important} 403a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em} 404abbr[title]::after{content:" (" attr(title) ")"} 405pre,blockquote,tr,img,object,svg{page-break-inside:avoid} 406thead{display:table-header-group} 407svg{max-width:100%} 408p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3} 409h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid} 410#toc,.sidebarblock,.exampleblock>.content{background:none!important} 411#toc{border-bottom:1px solid #dddddf!important;padding-bottom:0!important} 412body.book #header{text-align:center} 413body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em} 414body.book #header .details{border:0!important;display:block;padding:0!important} 415body.book #header .details span:first-child{margin-left:0!important} 416body.book #header .details br{display:block} 417body.book #header .details br+span::before{content:none!important} 418body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important} 419body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always} 420.listingblock code[data-lang]::before{display:block} 421#footer{padding:0 .9375em} 422.hide-on-print{display:none!important} 423.print-only{display:block!important} 424.hide-for-print{display:none!important} 425.show-for-print{display:inherit!important}} 426@media print,amzn-kf8{#header>h1:first-child{margin-top:1.25rem} 427.sect1{padding:0!important} 428.sect1+.sect1{border:0} 429#footer{background:none} 430#footer-text{color:rgba(0,0,0,.6);font-size:.9em}} 431@media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}} 432</style> 433</head> 434<body class="article toc2 toc-left"> 435<div id="header"> 436<h1>Boost.System: Extensible Error Reporting</h1> 437<div class="details"> 438<span id="author" class="author">Beman Dawes, Christopher Kohlhoff, Peter Dimov</span><br> 439</div> 440<div id="toc" class="toc2"> 441<div id="toctitle">Table of Contents</div> 442<ul class="sectlevel1"> 443<li><a href="#introduction">Introduction</a></li> 444<li><a href="#changes">Revision History</a> 445<ul class="sectlevel2"> 446<li><a href="#changes_in_boost_1_74">Changes in Boost 1.74</a></li> 447<li><a href="#changes_in_boost_1_69">Changes in Boost 1.69</a></li> 448<li><a href="#changes_in_boost_1_68">Changes in Boost 1.68</a></li> 449<li><a href="#changes_in_boost_1_65">Changes in Boost 1.65</a></li> 450</ul> 451</li> 452<li><a href="#rationale">Design Rationale</a></li> 453<li><a href="#reference">Reference</a> 454<ul class="sectlevel2"> 455<li><a href="#ref_use_of_c11_and_c14_features">Use of C++11 and C++14 Features</a></li> 456<li><a href="#ref_macros">Macros</a></li> 457<li><a href="#ref_deprecated_names">Deprecated Names</a></li> 458<li><a href="#ref_boostsystemerror_code_hpp"><boost/system/error_code.hpp></a> 459<ul class="sectlevel3"> 460<li><a href="#ref_synopsis">Synopsis</a></li> 461<li><a href="#ref_class_error_category">Class error_category</a></li> 462<li><a href="#ref_predefined_categories">Predefined Categories</a></li> 463<li><a href="#ref_class_error_code">Class error_code</a></li> 464<li><a href="#ref_class_error_condition">Class error_condition</a></li> 465<li><a href="#ref_nonmember_functions">Nonmember functions</a></li> 466</ul> 467</li> 468<li><a href="#ref_boostsystemsystem_error_hpp"><boost/system/system_error.hpp></a> 469<ul class="sectlevel3"> 470<li><a href="#ref_class_system_error">Class system_error</a></li> 471</ul> 472</li> 473</ul> 474</li> 475<li><a href="#history">History</a></li> 476<li><a href="#acknowledgments">Acknowledgments</a></li> 477<li><a href="#copyright">Copyright and License</a></li> 478</ul> 479</div> 480</div> 481<div id="content"> 482<div class="sect1"> 483<h2 id="introduction">Introduction</h2> 484<div class="sectionbody"> 485<div class="paragraph"> 486<p>Error conditions originating from the operating system or other low-level 487application program interfaces (API’s) are typically reported via an integer 488representing an error code. When these low-level API calls are wrapped in 489portable code, such as in a portable library, some users want to deal with the 490error codes in portable ways. Other users need to get at the system specific 491error codes, so they can deal with system specific needs. The Boost System 492library provides simple, light-weight <code>error_code</code> objects that encapsulate 493system-specific error code values, yet also provide access to more abstract 494and portable error conditions via <code>error_condition</code> objects.</p> 495</div> 496<div class="paragraph"> 497<p>Because <code>error_code</code> objects can represent errors from sources other than the 498operating system, including user-defined sources, each <code>error_code</code> and 499<code>error_condition</code> has an associated <code>error_category</code>.</p> 500</div> 501<div class="paragraph"> 502<p>An exception class, <code>system_error</code>, is provided. Derived from 503<code>std::runtime_error</code>, it captures the underlying <code>error_code</code> for the problem 504causing the exception so that this important information is not lost.</p> 505</div> 506<div class="paragraph"> 507<p>While exceptions are the preferred C++ default error code reporting 508mechanism, users of libraries dependent on low-level API’s often need overloads 509reporting error conditions via error code arguments and/or return values rather 510than via throwing exceptions. Otherwise, when errors are not exceptional 511occurrences and must be dealt with as they arise, programs become littered with 512try/catch blocks, unreadable, and inefficient. The Boost System library 513supports both error reporting by exception and by error code.</p> 514</div> 515<div class="paragraph"> 516<p>In addition to portable errors codes and conditions supported by the 517<code>error_code.hpp</code> header, system-specific headers support the Cygwin, Linux, 518and Windows platforms. These headers are effectively no-ops if included for 519platforms other than their intended target.</p> 520</div> 521<div class="paragraph"> 522<p>Boost.System is part of the C++11 Standard Library. 523A number of changes, particularly to names, were made by the C++ committee 524during standardization. The Boost implementation has been tracking those changes. 525See <a href="#ref_deprecated_names">Deprecated Names</a> for synonyms provided to prevent 526breakage of existing user code.</p> 527</div> 528</div> 529</div> 530<div class="sect1"> 531<h2 id="changes">Revision History</h2> 532<div class="sectionbody"> 533<div class="sect2"> 534<h3 id="changes_in_boost_1_74">Changes in Boost 1.74</h3> 535<div class="ulist"> 536<ul> 537<li> 538<p><code>operator bool()</code> now returns <code>failed()</code> instead of <code>value() != 0</code>.</p> 539</li> 540</ul> 541</div> 542</div> 543<div class="sect2"> 544<h3 id="changes_in_boost_1_69">Changes in Boost 1.69</h3> 545<div class="ulist"> 546<ul> 547<li> 548<p>Boost.System is now header-only. A stub library is still built for 549compatibility, but linking to it is no longer necessary.</p> 550</li> 551<li> 552<p>Even more functions have been marked <code>constexpr</code>.</p> 553</li> 554<li> 555<p>The destructor of <code>error_category</code> is now protected and no longer 556virtual. This is a <em>potentially breaking change</em> but its impact 557is expected to be limited.</p> 558</li> 559<li> 560<p><code>error_category</code> now has a constructor that accepts a 64 bit identifier, 561enabling distinct category objects to compare equal.</p> 562</li> 563<li> 564<p>The constructors of <code>error_category</code> are now protected.</p> 565</li> 566<li> 567<p>A non-allocating, nonthrowing overload of <code>message</code> has been added.</p> 568</li> 569<li> 570<p>A virtual function <code>failed</code> has been added, allowing categories for 571which success is not synonymous with 0.</p> 572</li> 573<li> 574<p>The deprecated <code>boost::system::throws</code> object has been removed.</p> 575</li> 576<li> 577<p><code>boost::throws()</code> is now deprecated and its use is discouraged.</p> 578</li> 579<li> 580<p>The constructor of <code>system_error</code> taking a single <code>error_code</code> argument 581is now explicit.</p> 582</li> 583<li> 584<p><code>system_error::code()</code> now returns by value.</p> 585</li> 586</ul> 587</div> 588</div> 589<div class="sect2"> 590<h3 id="changes_in_boost_1_68">Changes in Boost 1.68</h3> 591<div class="paragraph"> 592<p>On a C++14 compiler, many Boost.System functions and member functions 593are now <code>constexpr</code>, and <code>error_code</code> and <code>error_condition</code> are literal 594classes.</p> 595</div> 596<div class="paragraph"> 597<p>In addition to enabling use in constant expressions (and <code>constexpr</code> 598functions), this significantly improves the quality of the generated code.</p> 599</div> 600<div class="paragraph"> 601<p>As a result of this change, however, now using Boost.System from C++14 602or C++17 code requires that the library be also built with C++14 or 603above. This is the default on GCC 6 and newer, but not on GCC 5 or Clang. 604One can build Boost for C++14 by passing the <code>cxxstd=14</code> option to <code>b2</code>.</p> 605</div> 606<div class="paragraph"> 607<p>(Previous versions allowed code built against any C++ standard to link 608with Boost.System built against any C++ standard. In 1.68, code using 609any C++ standard can link with Boost.System built with C++14 or above, 610but if Boost.System is built with C++11 or below, only code also built 611with C++11 and below can link to it successfully.)</p> 612</div> 613</div> 614<div class="sect2"> 615<h3 id="changes_in_boost_1_65">Changes in Boost 1.65</h3> 616<div class="paragraph"> 617<p>On a C++11 compiler, Boost.System now provides implicit conversions 618from <code>boost::system::error_category</code>, <code>error_code</code>, and <code>error_condition</code> 619to their standard equivalents from <code><system_error></code>.</p> 620</div> 621<div class="paragraph"> 622<p>This allows libraries to expose a C++11 interface and report errors 623via <code>std::error_code</code> even when using Boost.System, directly or through a 624dependency such as Boost.ASIO.</p> 625</div> 626</div> 627</div> 628</div> 629<div class="sect1"> 630<h2 id="rationale">Design Rationale</h2> 631<div class="sectionbody"> 632<div class="paragraph"> 633<p><code>error_code</code> and <code>error_condition</code> are designed as value types so 634they can be copied without slicing and do not require heap allocation, but 635still have polymorphic behavior based on the error category. This is achieved 636by abstract base class <code>error_category</code> supplying the polymorphic behavior, 637and <code>error_code</code> and <code>error_condition</code> containing a pointer to an object of a 638type derived from <code>error_category</code>.</p> 639</div> 640<div class="paragraph"> 641<p>Many of the detailed design decisions were driven by the requirements that 642users to be able to add additional error categories, and that it be no more 643difficult to write portable code than system-specific code.</p> 644</div> 645<div class="paragraph"> 646<p>The <code>operator<<</code> overload for <code>error_code</code> eliminates a misleading conversion to 647<code>bool</code> in code like <code>cout << ec</code>, where <code>ec</code> is of type <code>error_code</code>. It is also 648useful in its own right.</p> 649</div> 650</div> 651</div> 652<div class="sect1"> 653<h2 id="reference">Reference</h2> 654<div class="sectionbody"> 655<div class="sect2"> 656<h3 id="ref_use_of_c11_and_c14_features">Use of C++11 and C++14 Features</h3> 657<div class="paragraph"> 658<p>The library is documented to use several C++11 and C++14 features, 659including <code>noexcept</code>, explicit conversion operators and <code>constexpr</code>. The 660actual implementation uses C++11 and C++14 features only when they are 661available, and otherwise falls back on C++03 features.</p> 662</div> 663</div> 664<div class="sect2"> 665<h3 id="ref_macros">Macros</h3> 666<div class="paragraph"> 667<p>When <code>BOOST_SYSTEM_ENABLE_DEPRECATED</code> is defined, the library provides 668deprecated features for compatibility. These features are bound to eventually 669disappear.</p> 670</div> 671<div class="paragraph"> 672<p>When <code>BOOST_SYSTEM_USE_UTF8</code> is defined, on Windows the library returns 673UTF-8 messages using code page <code>CP_UTF8</code> instead of the default <code>CP_ACP</code>. 674This macro has no effect on POSIX.</p> 675</div> 676</div> 677<div class="sect2"> 678<h3 id="ref_deprecated_names">Deprecated Names</h3> 679<div class="paragraph"> 680<p>In the process of adding Boost.System to the C++11 standard library, the 681C++ committee changed some names. To ease transition, Boost.System deprecates 682the old names, but will provide them when the macro <code>BOOST_SYSTEM_ENABLE_DEPRECATED</code> is defined.</p> 683</div> 684<table class="tableblock frame-all grid-all stretch"> 685<colgroup> 686<col style="width: 50%;"> 687<col style="width: 50%;"> 688</colgroup> 689<thead> 690<tr> 691<th class="tableblock halign-left valign-top">Old usage, now deprecated</th> 692<th class="tableblock halign-left valign-top">Replacement</th> 693</tr> 694</thead> 695<tbody> 696<tr> 697<td class="tableblock halign-left valign-top"><p class="tableblock"><code>get_generic_category()</code></p></td> 698<td class="tableblock halign-left valign-top"><p class="tableblock"><code>generic_category()</code></p></td> 699</tr> 700<tr> 701<td class="tableblock halign-left valign-top"><p class="tableblock"><code>get_system_category()</code></p></td> 702<td class="tableblock halign-left valign-top"><p class="tableblock"><code>system_category()</code></p></td> 703</tr> 704<tr> 705<td class="tableblock halign-left valign-top"><p class="tableblock"><code>namespace posix</code></p></td> 706<td class="tableblock halign-left valign-top"><p class="tableblock"><code>namespace errc</code></p></td> 707</tr> 708<tr> 709<td class="tableblock halign-left valign-top"><p class="tableblock"><code>namespace posix_error</code></p></td> 710<td class="tableblock halign-left valign-top"><p class="tableblock"><code>namespace errc</code></p></td> 711</tr> 712<tr> 713<td class="tableblock halign-left valign-top"><p class="tableblock"><code>get_posix_category()</code></p></td> 714<td class="tableblock halign-left valign-top"><p class="tableblock"><code>generic_category()</code></p></td> 715</tr> 716<tr> 717<td class="tableblock halign-left valign-top"><p class="tableblock"><code>posix_category</code></p></td> 718<td class="tableblock halign-left valign-top"><p class="tableblock"><code>generic_category()</code></p></td> 719</tr> 720<tr> 721<td class="tableblock halign-left valign-top"><p class="tableblock"><code>errno_ecat</code></p></td> 722<td class="tableblock halign-left valign-top"><p class="tableblock"><code>generic_category()</code></p></td> 723</tr> 724<tr> 725<td class="tableblock halign-left valign-top"><p class="tableblock"><code>native_ecat</code></p></td> 726<td class="tableblock halign-left valign-top"><p class="tableblock"><code>system_category()</code></p></td> 727</tr> 728</tbody> 729</table> 730</div> 731<div class="sect2"> 732<h3 id="ref_boostsystemerror_code_hpp"><boost/system/error_code.hpp></h3> 733<div class="sect3"> 734<h4 id="ref_synopsis">Synopsis</h4> 735<div class="listingblock"> 736<div class="content"> 737<pre class="highlight"><code>namespace boost { 738 namespace system { 739 740 class error_category; 741 742 constexpr const error_category & system_category() noexcept; 743 constexpr const error_category & generic_category() noexcept; 744 745 class error_code; 746 class error_condition; 747 748 // "Concept" helpers 749 750 template<class T> 751 struct is_error_code_enum { static const bool value = false; }; 752 753 template<class T> 754 struct is_error_condition_enum { static const bool value = false; }; 755 756 // generic error conditions 757 758 namespace errc { 759 enum errc_t 760 { 761 success = 0, 762 address_family_not_supported, //EAFNOSUPPORT 763 address_in_use, //EADDRINUSE 764 address_not_available, //EADDRNOTAVAIL 765 already_connected, //EISCONN 766 argument_list_too_long, //E2BIG 767 argument_out_of_domain, //EDOM 768 bad_address, //EFAULT 769 bad_file_descriptor, //EBADF 770 bad_message, //EBADMSG 771 broken_pipe, //EPIPE 772 connection_aborted, //ECONNABORTED 773 connection_already_in_progress, //EALREADY 774 connection_refused, //ECONNREFUSED 775 connection_reset, //ECONNRESET 776 cross_device_link, //EXDEV 777 destination_address_required, //EDESTADDRREQ 778 device_or_resource_busy, //EBUSY 779 directory_not_empty, //ENOTEMPTY 780 executable_format_error, //ENOEXEC 781 file_exists, //EEXIST 782 file_too_large, //EFBIG 783 filename_too_long, //ENAMETOOLONG 784 function_not_supported, //ENOSYS 785 host_unreachable, //EHOSTUNREACH 786 identifier_removed, //EIDRM 787 illegal_byte_sequence, //EILSEQ 788 inappropriate_io_control_operation, //ENOTTY 789 interrupted, //EINTR 790 invalid_argument, //EINVAL 791 invalid_seek, //ESPIPE 792 io_error, //EIO 793 is_a_directory, //EISDIR 794 message_size, //EMSGSIZE 795 network_down, //ENETDOWN 796 network_reset, //ENETRESET 797 network_unreachable, //ENETUNREACH 798 no_buffer_space, //ENOBUFS 799 no_child_process, //ECHILD 800 no_link, //ENOLINK 801 no_lock_available, //ENOLCK 802 no_message_available, //ENODATA 803 no_message, //ENOMSG 804 no_protocol_option, //ENOPROTOOPT 805 no_space_on_device, //ENOSPC 806 no_stream_resources, //ENOSR 807 no_such_device_or_address, //ENXIO 808 no_such_device, //ENODEV 809 no_such_file_or_directory, //ENOENT 810 no_such_process, //ESRCH 811 not_a_directory, //ENOTDIR 812 not_a_socket, //ENOTSOCK 813 not_a_stream, //ENOSTR 814 not_connected, //ENOTCONN 815 not_enough_memory, //ENOMEM 816 not_supported, //ENOTSUP 817 operation_canceled, //ECANCELED 818 operation_in_progress, //EINPROGRESS 819 operation_not_permitted, //EPERM 820 operation_not_supported, //EOPNOTSUPP 821 operation_would_block, //EWOULDBLOCK 822 owner_dead, //EOWNERDEAD 823 permission_denied, //EACCES 824 protocol_error, //EPROTO 825 protocol_not_supported, //EPROTONOSUPPORT 826 read_only_file_system, //EROFS 827 resource_deadlock_would_occur, //EDEADLK 828 resource_unavailable_try_again, //EAGAIN 829 result_out_of_range, //ERANGE 830 state_not_recoverable, //ENOTRECOVERABLE 831 stream_timeout, //ETIME 832 text_file_busy, //ETXTBSY 833 timed_out, //ETIMEDOUT 834 too_many_files_open_in_system, //ENFILE 835 too_many_files_open, //EMFILE 836 too_many_links, //EMLINK 837 too_many_synbolic_link_levels, //ELOOP 838 value_too_large, //EOVERFLOW 839 wrong_protocol_type //EPROTOTYPE 840 }; 841 842 } // namespace errc 843 844 template<> struct is_error_condition_enum<errc::errc_t> 845 { static const bool value = true; }; 846 847 // non-member functions 848 849 constexpr bool operator==( const error_code & lhs, 850 const error_code & rhs ) noexcept; 851 bool operator==( const error_code & code, 852 const error_condition & condition ) noexcept; 853 bool operator==( const error_condition & condition, 854 const error_code & code ) noexcept; 855 constexpr bool operator==( const error_condition & lhs, 856 const error_condition & rhs ) noexcept; 857 858 constexpr bool operator!=( const error_code & lhs, 859 const error_code & rhs ) noexcept; 860 bool operator!=( const error_code & code, 861 const error_condition & condition ) noexcept; 862 bool operator!=( const error_condition & condition, 863 const error_code & code ) noexcept; 864 constexpr bool operator!=( const error_condition & lhs, 865 const error_condition & rhs ) noexcept; 866 867 constexpr bool operator<( const error_code & lhs, 868 const error_code & rhs ) noexcept; 869 constexpr bool operator<( const error_condition & lhs, 870 const error_condition & rhs ) noexcept; 871 872 constexpr error_code make_error_code( errc::errc_t e ) noexcept; 873 constexpr error_condition make_error_condition( errc::errc_t e ) noexcept; 874 875 template <class charT, class traits> 876 std::basic_ostream<charT, traits>& 877 operator<<( basic_ostream<charT, traits>& os, const error_code & ec ); 878 879 std::size_t hash_value( const error_code & ec ); 880 881 } // namespace system 882} // namespace boost</code></pre> 883</div> 884</div> 885<div class="paragraph"> 886<p>The value of each <code>errc_t</code> constant is the same as the value of the <code><cerrno></code> 887macro shown in the above synopsis.</p> 888</div> 889<div class="paragraph"> 890<p>Users may specialize <code>is_error_code_enum</code> and <code>is_error_condition_enum</code> 891templates to indicate that a type is eligible for class <code>error_code</code> and 892<code>error_condition</code> automatic conversions respectively.</p> 893</div> 894</div> 895<div class="sect3"> 896<h4 id="ref_class_error_category">Class error_category</h4> 897<div class="paragraph"> 898<p>The class <code>error_category</code> defines the base class for types used 899to identify the source and encoding of a particular category of error code.</p> 900</div> 901<div class="paragraph"> 902<p>Classes may be derived from <code>error_category</code> to support categories of 903errors in addition to those defined in Boost.System.</p> 904</div> 905<div class="listingblock"> 906<div class="content"> 907<pre class="highlight"><code>namespace boost { 908 namespace system { 909 910 class error_category 911 { 912 public: // noncopyable 913 914 error_category( error_category const & ) = delete; 915 error_category& operator=( error_category const & ) = delete; 916 917 protected: 918 919 ~error_category() = default; 920 921 constexpr error_category() noexcept; 922 explicit constexpr error_category( unsigned long long id ) noexcept; 923 924 public: 925 926 virtual const char * name() const noexcept = 0; 927 928 virtual error_condition default_error_condition( int ev ) const noexcept; 929 930 virtual bool equivalent( int code, const error_condition & condition ) 931 const noexcept; 932 virtual bool equivalent( const error_code & code, int condition ) 933 const noexcept; 934 935 virtual std::string message( int ev ) const = 0; 936 virtual char const * message( int ev, char * buffer, std::size_t len ) 937 const noexcept; 938 939 virtual bool failed( int ev ) const noexcept; 940 941 constexpr bool operator==( const error_category & rhs ) const noexcept; 942 constexpr bool operator!=( const error_category & rhs ) const noexcept; 943 constexpr bool operator< ( const error_category & rhs ) const noexcept; 944 945 operator std::error_category const & () const; 946 947 private: 948 949 unsigned long long id_; // exposition only 950 951 }; 952 } 953}</code></pre> 954</div> 955</div> 956<div class="sect4"> 957<h5 id="ref_constructors">Constructors</h5> 958<div class="listingblock"> 959<div class="content"> 960<pre class="highlight"><code>constexpr error_category() noexcept;</code></pre> 961</div> 962</div> 963<div class="ulist none"> 964<ul class="none"> 965<li> 966<p></p> 967<div class="dlist"> 968<dl> 969<dt class="hdlist1">Effects: </dt> 970<dd> 971<p>Initializes <code>id_</code> to 0.</p> 972</dd> 973<dt class="hdlist1">Remarks: </dt> 974<dd> 975<p>Since equivalence for categories that do not have an identifier is 976based on comparing object addresses, a user-defined derived category of type 977<code>C</code> that uses this constructor should ensure that only one object of type <code>C</code> 978exists in the program.</p> 979</dd> 980</dl> 981</div> 982</li> 983</ul> 984</div> 985<div class="listingblock"> 986<div class="content"> 987<pre class="highlight"><code>explicit constexpr error_category( unsigned long long id ) noexcept;</code></pre> 988</div> 989</div> 990<div class="ulist none"> 991<ul class="none"> 992<li> 993<p></p> 994<div class="dlist"> 995<dl> 996<dt class="hdlist1">Effects: </dt> 997<dd> 998<p>Initializes <code>id_</code> to <code>id</code>.</p> 999</dd> 1000<dt class="hdlist1">Remarks: </dt> 1001<dd> 1002<p>User-defined derived categories that use this constructor are considered 1003equivalent when their identifiers match. Therefore, those categories may have more 1004than one instance existing in a program, but to minimize the possibility of 1005collision, their identifiers must be randomly chosen (at the time the category 1006is implemented, not at runtime). One way of generating a 64 bit random identifier 1007is <a href="https://www.random.org/cgi-bin/randbyte?nbytes=8&format=h" class="bare">https://www.random.org/cgi-bin/randbyte?nbytes=8&format=h</a>.</p> 1008</dd> 1009</dl> 1010</div> 1011</li> 1012</ul> 1013</div> 1014</div> 1015<div class="sect4"> 1016<h5 id="ref_virtuals">Virtuals</h5> 1017<div class="listingblock"> 1018<div class="content"> 1019<pre class="highlight"><code>virtual const char * name() const noexcept = 0;</code></pre> 1020</div> 1021</div> 1022<div class="ulist none"> 1023<ul class="none"> 1024<li> 1025<p></p> 1026<div class="dlist"> 1027<dl> 1028<dt class="hdlist1">Returns: </dt> 1029<dd> 1030<p>In derived classes, a character literal naming the error category.</p> 1031</dd> 1032</dl> 1033</div> 1034</li> 1035</ul> 1036</div> 1037<div class="listingblock"> 1038<div class="content"> 1039<pre class="highlight"><code>virtual error_condition default_error_condition( int ev ) const noexcept;</code></pre> 1040</div> 1041</div> 1042<div class="ulist none"> 1043<ul class="none"> 1044<li> 1045<p></p> 1046<div class="dlist"> 1047<dl> 1048<dt class="hdlist1">Returns: </dt> 1049<dd> 1050<div class="ulist"> 1051<ul> 1052<li> 1053<p>In derived classes, an error condition corresponding to <code>ev</code>. 1054The returned error condition will typically come from the generic category.</p> 1055</li> 1056<li> 1057<p>In the default implementation, <code>error_condition( ev, *this )</code>.</p> 1058</li> 1059</ul> 1060</div> 1061</dd> 1062</dl> 1063</div> 1064</li> 1065</ul> 1066</div> 1067<div class="listingblock"> 1068<div class="content"> 1069<pre class="highlight"><code>virtual bool equivalent( int code, const error_condition & condition ) 1070 const noexcept;</code></pre> 1071</div> 1072</div> 1073<div class="ulist none"> 1074<ul class="none"> 1075<li> 1076<p></p> 1077<div class="dlist"> 1078<dl> 1079<dt class="hdlist1">Returns: </dt> 1080<dd> 1081<div class="ulist"> 1082<ul> 1083<li> 1084<p>In derived classes, <code>true</code> when <code>error_code( code, *this )</code> is equivalent to <code>condition</code>.</p> 1085</li> 1086<li> 1087<p>In the default implementation, <code>default_error_condition( code ) == condition</code>.</p> 1088</li> 1089</ul> 1090</div> 1091</dd> 1092</dl> 1093</div> 1094</li> 1095</ul> 1096</div> 1097<div class="listingblock"> 1098<div class="content"> 1099<pre class="highlight"><code>virtual bool equivalent( const error_code & code, int condition ) 1100 const noexcept;</code></pre> 1101</div> 1102</div> 1103<div class="ulist none"> 1104<ul class="none"> 1105<li> 1106<p></p> 1107<div class="dlist"> 1108<dl> 1109<dt class="hdlist1">Returns: </dt> 1110<dd> 1111<div class="ulist"> 1112<ul> 1113<li> 1114<p>In derived classes, <code>true</code> when <code>code</code> is equivalent to <code>error_condition( condition, *this )</code>.</p> 1115</li> 1116<li> 1117<p>In the default implementation, <code>*this == code.category() && code.value() == condition</code>.</p> 1118</li> 1119</ul> 1120</div> 1121</dd> 1122</dl> 1123</div> 1124</li> 1125</ul> 1126</div> 1127<div class="listingblock"> 1128<div class="content"> 1129<pre class="highlight"><code>virtual std::string message( int ev ) const = 0;</code></pre> 1130</div> 1131</div> 1132<div class="ulist none"> 1133<ul class="none"> 1134<li> 1135<p></p> 1136<div class="dlist"> 1137<dl> 1138<dt class="hdlist1">Returns: </dt> 1139<dd> 1140<p>In derived classes, a string that describes the error denoted by <code>ev</code>.</p> 1141</dd> 1142</dl> 1143</div> 1144</li> 1145</ul> 1146</div> 1147<div class="listingblock"> 1148<div class="content"> 1149<pre class="highlight"><code>virtual char const * message( int ev, char * buffer, std::size_t len ) 1150 const noexcept;</code></pre> 1151</div> 1152</div> 1153<div class="ulist none"> 1154<ul class="none"> 1155<li> 1156<p></p> 1157<div class="dlist"> 1158<dl> 1159<dt class="hdlist1">Effects: </dt> 1160<dd> 1161<div class="ulist"> 1162<ul> 1163<li> 1164<p>Derived classes should either</p> 1165<div class="ulist"> 1166<ul> 1167<li> 1168<p>return a pointer to a character literal describing the error denoted by <code>ev</code>, or</p> 1169</li> 1170<li> 1171<p>copy a string describing the error into <code>buffer</code>, truncating it to <code>len-1</code> 1172characters and storing a null terminator, and return <code>buffer</code>. If <code>len</code> is 0, 1173nothing is copied, but the function still returns <code>buffer</code>. Note that 1174when <code>len</code> is 0, <code>buffer</code> may be <code>nullptr</code>.</p> 1175</li> 1176</ul> 1177</div> 1178</li> 1179<li> 1180<p>The default implementation calls <code>message(ev)</code> and copies the result into 1181<code>buffer</code>, truncating it to <code>len-1</code> characters and storing a null terminator. 1182If <code>len</code> is 0, copies nothing. Returns <code>buffer</code>. If <code>message(ev)</code> throws an 1183exception, the string <code>"Message text unavailable"</code> is used.</p> 1184</li> 1185</ul> 1186</div> 1187</dd> 1188<dt class="hdlist1">Example: </dt> 1189<dd> 1190<div class="listingblock"> 1191<div class="content"> 1192<pre class="highlight"><code>const char* my_category::message(int ev, char* buffer, size_t len) const noexcept 1193{ 1194 switch(ev) 1195 { 1196 case 0: return "no error"; 1197 case 1: return "voltage out of range"; 1198 case 2: return "impedance mismatch"; 1199 case 31: 1200 case 32: 1201 case 33: 1202 std::snprintf(buffer, len, "component %d failure", ev-30); 1203 return buffer; 1204 default: 1205 std::snprintf(buffer, len, "unknown error %d", ev); 1206 return buffer; 1207 } 1208}</code></pre> 1209</div> 1210</div> 1211</dd> 1212</dl> 1213</div> 1214</li> 1215</ul> 1216</div> 1217<div class="listingblock"> 1218<div class="content"> 1219<pre class="highlight"><code>virtual bool failed( int ev ) const noexcept;</code></pre> 1220</div> 1221</div> 1222<div class="ulist none"> 1223<ul class="none"> 1224<li> 1225<p></p> 1226<div class="dlist"> 1227<dl> 1228<dt class="hdlist1">Returns: </dt> 1229<dd> 1230<div class="ulist"> 1231<ul> 1232<li> 1233<p>In derived classes, <code>true</code> when <code>ev</code> represents a failure.</p> 1234</li> 1235<li> 1236<p>In the default implementation, <code>ev != 0</code>.</p> 1237</li> 1238</ul> 1239</div> 1240</dd> 1241<dt class="hdlist1">Remarks: </dt> 1242<dd> 1243<p>All calls to this function with the same <code>ev</code> must return the same value.</p> 1244</dd> 1245</dl> 1246</div> 1247</li> 1248</ul> 1249</div> 1250</div> 1251<div class="sect4"> 1252<h5 id="ref_nonvirtuals">Nonvirtuals</h5> 1253<div class="listingblock"> 1254<div class="content"> 1255<pre class="highlight"><code>constexpr bool operator==( const error_category & rhs ) const noexcept;</code></pre> 1256</div> 1257</div> 1258<div class="ulist none"> 1259<ul class="none"> 1260<li> 1261<p></p> 1262<div class="dlist"> 1263<dl> 1264<dt class="hdlist1">Returns: </dt> 1265<dd> 1266<p><code>rhs.id_ == 0? this == &rhs: id_ == rhs.id_</code>.</p> 1267</dd> 1268<dt class="hdlist1">Remarks: </dt> 1269<dd> 1270<p>Two category objects are considered equivalent when they have matching 1271nonzero identifiers, or are the same object.</p> 1272</dd> 1273</dl> 1274</div> 1275</li> 1276</ul> 1277</div> 1278<div class="listingblock"> 1279<div class="content"> 1280<pre class="highlight"><code>constexpr bool operator!=( const error_category & rhs ) const noexcept;</code></pre> 1281</div> 1282</div> 1283<div class="ulist none"> 1284<ul class="none"> 1285<li> 1286<p></p> 1287<div class="dlist"> 1288<dl> 1289<dt class="hdlist1">Returns: </dt> 1290<dd> 1291<p><code>!( *this == rhs )</code>.</p> 1292</dd> 1293</dl> 1294</div> 1295</li> 1296</ul> 1297</div> 1298<div class="listingblock"> 1299<div class="content"> 1300<pre class="highlight"><code>constexpr bool operator< ( const error_category & rhs ) const noexcept;</code></pre> 1301</div> 1302</div> 1303<div class="ulist none"> 1304<ul class="none"> 1305<li> 1306<p></p> 1307<div class="dlist"> 1308<dl> 1309<dt class="hdlist1">Returns: </dt> 1310<dd> 1311<div class="ulist"> 1312<ul> 1313<li> 1314<p>If <code>id_ < rhs.id_</code>, <code>true</code>;</p> 1315</li> 1316<li> 1317<p>Otherwise, if <code>id_ > rhs.id_</code>, <code>false</code>;</p> 1318</li> 1319<li> 1320<p>Otherwise, if <code>rhs.id_ != 0</code>, <code>false</code>;</p> 1321</li> 1322<li> 1323<p>Otherwise, <code>std::less<error_category const *>()( this, &rhs )</code>.</p> 1324</li> 1325</ul> 1326</div> 1327</dd> 1328</dl> 1329</div> 1330</li> 1331</ul> 1332</div> 1333<div class="listingblock"> 1334<div class="content"> 1335<pre class="highlight"><code>operator std::error_category const & () const;</code></pre> 1336</div> 1337</div> 1338<div class="ulist none"> 1339<ul class="none"> 1340<li> 1341<p></p> 1342<div class="dlist"> 1343<dl> 1344<dt class="hdlist1">Returns: </dt> 1345<dd> 1346<p>A reference to an <code>std::error_category</code> object corresponding 1347to <code>*this</code>.</p> 1348</dd> 1349</dl> 1350</div> 1351</li> 1352</ul> 1353</div> 1354</div> 1355</div> 1356<div class="sect3"> 1357<h4 id="ref_predefined_categories">Predefined Categories</h4> 1358<div class="listingblock"> 1359<div class="content"> 1360<pre class="highlight"><code>constexpr const error_category & system_category() noexcept;</code></pre> 1361</div> 1362</div> 1363<div class="ulist none"> 1364<ul class="none"> 1365<li> 1366<p></p> 1367<div class="dlist"> 1368<dl> 1369<dt class="hdlist1">Returns: </dt> 1370<dd> 1371<p>A reference to an <code>error_category</code> object identifying errors 1372originating from the operating system.</p> 1373</dd> 1374</dl> 1375</div> 1376</li> 1377</ul> 1378</div> 1379<div class="listingblock"> 1380<div class="content"> 1381<pre class="highlight"><code>constexpr const error_category & generic_category() noexcept;</code></pre> 1382</div> 1383</div> 1384<div class="ulist none"> 1385<ul class="none"> 1386<li> 1387<p></p> 1388<div class="dlist"> 1389<dl> 1390<dt class="hdlist1">Returns: </dt> 1391<dd> 1392<p>A reference to an <code>error_category</code> object identifying portable 1393error conditions.</p> 1394</dd> 1395</dl> 1396</div> 1397</li> 1398</ul> 1399</div> 1400</div> 1401<div class="sect3"> 1402<h4 id="ref_class_error_code">Class error_code</h4> 1403<div class="paragraph"> 1404<p>The class <code>error_code</code> describes an object used to hold error code 1405values, such as those originating from the operating system or other 1406low-level application program interfaces. It’s an adjunct to error reporting 1407by exception.</p> 1408</div> 1409<div class="listingblock"> 1410<div class="content"> 1411<pre class="highlight"><code>namespace boost { 1412 namespace system { 1413 1414 class error_code { 1415 public: 1416 1417 // constructors: 1418 1419 constexpr error_code() noexcept; 1420 constexpr error_code( int val, const error_category & cat ) noexcept; 1421 1422 template <class ErrorCodeEnum> 1423 constexpr error_code( ErrorCodeEnum e ) noexcept; 1424 1425 // modifiers: 1426 1427 constexpr void assign( int val, const error_category & cat ) noexcept; 1428 1429 template<typename ErrorCodeEnum> 1430 constexpr error_code & operator=( ErrorCodeEnum e ) noexcept; 1431 1432 constexpr void clear() noexcept; 1433 1434 // observers: 1435 1436 constexpr int value() const noexcept; 1437 constexpr const error_category & category() const noexcept; 1438 1439 error_condition default_error_condition() const noexcept; 1440 1441 std::string message() const; 1442 char const * message( char * buffer, std::size_t len ) const noexcept; 1443 1444 constexpr bool failed() const noexcept; 1445 constexpr explicit operator bool() const noexcept; 1446 1447 operator std::error_code() const; 1448 1449 private: // exposition only 1450 1451 int val_; 1452 const error_category * cat_; 1453 1454 }; 1455 } 1456}</code></pre> 1457</div> 1458</div> 1459<div class="sect4"> 1460<h5 id="ref_constructors_2">Constructors</h5> 1461<div class="listingblock"> 1462<div class="content"> 1463<pre class="highlight"><code>constexpr error_code() noexcept;</code></pre> 1464</div> 1465</div> 1466<div class="ulist none"> 1467<ul class="none"> 1468<li> 1469<p></p> 1470<div class="dlist"> 1471<dl> 1472<dt class="hdlist1">Ensures: </dt> 1473<dd> 1474<p><code>val_ == 0</code>; <code>*cat_ == system_category()</code>.</p> 1475</dd> 1476</dl> 1477</div> 1478</li> 1479</ul> 1480</div> 1481<div class="listingblock"> 1482<div class="content"> 1483<pre class="highlight"><code>constexpr error_code( int val, const error_category & cat ) noexcept;</code></pre> 1484</div> 1485</div> 1486<div class="ulist none"> 1487<ul class="none"> 1488<li> 1489<p></p> 1490<div class="dlist"> 1491<dl> 1492<dt class="hdlist1">Ensures: </dt> 1493<dd> 1494<p><code>val_ == val</code>; <code>cat_ == &cat</code>.</p> 1495</dd> 1496</dl> 1497</div> 1498</li> 1499</ul> 1500</div> 1501<div class="listingblock"> 1502<div class="content"> 1503<pre class="highlight"><code>template <class ErrorCodeEnum> 1504 constexpr error_code( ErrorCodeEnum e ) noexcept;</code></pre> 1505</div> 1506</div> 1507<div class="ulist none"> 1508<ul class="none"> 1509<li> 1510<p></p> 1511<div class="dlist"> 1512<dl> 1513<dt class="hdlist1">Ensures: </dt> 1514<dd> 1515<p><code>*this == make_error_code( e )</code>.</p> 1516</dd> 1517<dt class="hdlist1">Remarks: </dt> 1518<dd> 1519<p>This constructor is only enabled when <code>is_error_code_enum<ErrorCodeEnum>::value</code> is <code>true</code>.</p> 1520</dd> 1521</dl> 1522</div> 1523</li> 1524</ul> 1525</div> 1526</div> 1527<div class="sect4"> 1528<h5 id="ref_modifiers">Modifiers</h5> 1529<div class="listingblock"> 1530<div class="content"> 1531<pre class="highlight"><code>constexpr void assign( int val, const error_category & cat ) noexcept;</code></pre> 1532</div> 1533</div> 1534<div class="ulist none"> 1535<ul class="none"> 1536<li> 1537<p></p> 1538<div class="dlist"> 1539<dl> 1540<dt class="hdlist1">Ensures: </dt> 1541<dd> 1542<p><code>val_ == val</code>; <code>cat_ == &cat</code>.</p> 1543</dd> 1544</dl> 1545</div> 1546</li> 1547</ul> 1548</div> 1549<div class="listingblock"> 1550<div class="content"> 1551<pre class="highlight"><code>template<typename ErrorCodeEnum> 1552 constexpr error_code & operator=( ErrorCodeEnum e ) noexcept;</code></pre> 1553</div> 1554</div> 1555<div class="ulist none"> 1556<ul class="none"> 1557<li> 1558<p></p> 1559<div class="dlist"> 1560<dl> 1561<dt class="hdlist1">Ensures: </dt> 1562<dd> 1563<p><code>*this == make_error_code( e )</code>.</p> 1564</dd> 1565<dt class="hdlist1">Remarks: </dt> 1566<dd> 1567<p>This operator is only enabled when <code>is_error_code_enum<ErrorCodeEnum>::value</code> is <code>true</code>.</p> 1568</dd> 1569</dl> 1570</div> 1571</li> 1572</ul> 1573</div> 1574<div class="listingblock"> 1575<div class="content"> 1576<pre class="highlight"><code>constexpr void clear() noexcept;</code></pre> 1577</div> 1578</div> 1579<div class="ulist none"> 1580<ul class="none"> 1581<li> 1582<p></p> 1583<div class="dlist"> 1584<dl> 1585<dt class="hdlist1">Ensures: </dt> 1586<dd> 1587<p><code>val_ == 0</code>; <code>*cat_ == system_category()</code>.</p> 1588</dd> 1589</dl> 1590</div> 1591</li> 1592</ul> 1593</div> 1594</div> 1595<div class="sect4"> 1596<h5 id="ref_observers">Observers</h5> 1597<div class="listingblock"> 1598<div class="content"> 1599<pre class="highlight"><code>constexpr int value() const noexcept;</code></pre> 1600</div> 1601</div> 1602<div class="ulist none"> 1603<ul class="none"> 1604<li> 1605<p></p> 1606<div class="dlist"> 1607<dl> 1608<dt class="hdlist1">Returns: </dt> 1609<dd> 1610<p><code>val_</code>.</p> 1611</dd> 1612</dl> 1613</div> 1614</li> 1615</ul> 1616</div> 1617<div class="listingblock"> 1618<div class="content"> 1619<pre class="highlight"><code>constexpr const error_category & category() const noexcept;</code></pre> 1620</div> 1621</div> 1622<div class="ulist none"> 1623<ul class="none"> 1624<li> 1625<p></p> 1626<div class="dlist"> 1627<dl> 1628<dt class="hdlist1">Returns: </dt> 1629<dd> 1630<p><code>*cat_</code>.</p> 1631</dd> 1632</dl> 1633</div> 1634</li> 1635</ul> 1636</div> 1637<div class="listingblock"> 1638<div class="content"> 1639<pre class="highlight"><code>error_condition default_error_condition() const noexcept;</code></pre> 1640</div> 1641</div> 1642<div class="ulist none"> 1643<ul class="none"> 1644<li> 1645<p></p> 1646<div class="dlist"> 1647<dl> 1648<dt class="hdlist1">Returns: </dt> 1649<dd> 1650<p><code>cat_->default_error_condition( val_ )</code>.</p> 1651</dd> 1652</dl> 1653</div> 1654</li> 1655</ul> 1656</div> 1657<div class="listingblock"> 1658<div class="content"> 1659<pre class="highlight"><code>std::string message() const;</code></pre> 1660</div> 1661</div> 1662<div class="ulist none"> 1663<ul class="none"> 1664<li> 1665<p></p> 1666<div class="dlist"> 1667<dl> 1668<dt class="hdlist1">Returns: </dt> 1669<dd> 1670<p><code>cat_->message( val_ )</code>.</p> 1671</dd> 1672</dl> 1673</div> 1674</li> 1675</ul> 1676</div> 1677<div class="listingblock"> 1678<div class="content"> 1679<pre class="highlight"><code>char const * message( char * buffer, std::size_t len ) const noexcept;</code></pre> 1680</div> 1681</div> 1682<div class="ulist none"> 1683<ul class="none"> 1684<li> 1685<p></p> 1686<div class="dlist"> 1687<dl> 1688<dt class="hdlist1">Returns: </dt> 1689<dd> 1690<p><code>cat_->message( val_, buffer, len )</code>.</p> 1691</dd> 1692</dl> 1693</div> 1694</li> 1695</ul> 1696</div> 1697<div class="listingblock"> 1698<div class="content"> 1699<pre class="highlight"><code>constexpr bool failed() const noexcept;</code></pre> 1700</div> 1701</div> 1702<div class="ulist none"> 1703<ul class="none"> 1704<li> 1705<p></p> 1706<div class="dlist"> 1707<dl> 1708<dt class="hdlist1">Returns: </dt> 1709<dd> 1710<p><code>cat_->failed( val_ )</code>.</p> 1711</dd> 1712</dl> 1713</div> 1714</li> 1715</ul> 1716</div> 1717<div class="listingblock"> 1718<div class="content"> 1719<pre class="highlight"><code>constexpr explicit operator bool() const noexcept;</code></pre> 1720</div> 1721</div> 1722<div class="ulist none"> 1723<ul class="none"> 1724<li> 1725<p></p> 1726<div class="dlist"> 1727<dl> 1728<dt class="hdlist1">Returns: </dt> 1729<dd> 1730<p><code>failed()</code>.</p> 1731</dd> 1732</dl> 1733</div> 1734</li> 1735</ul> 1736</div> 1737<div class="listingblock"> 1738<div class="content"> 1739<pre class="highlight"><code>operator std::error_code() const;</code></pre> 1740</div> 1741</div> 1742<div class="ulist none"> 1743<ul class="none"> 1744<li> 1745<p></p> 1746<div class="dlist"> 1747<dl> 1748<dt class="hdlist1">Returns: </dt> 1749<dd> 1750<p><code>std::error_code( val_, *cat_ )</code>.</p> 1751</dd> 1752</dl> 1753</div> 1754</li> 1755</ul> 1756</div> 1757</div> 1758</div> 1759<div class="sect3"> 1760<h4 id="ref_class_error_condition">Class error_condition</h4> 1761<div class="listingblock"> 1762<div class="content"> 1763<pre class="highlight"><code>namespace boost { 1764 namespace system { 1765 1766 class error_condition { 1767 public: 1768 1769 // constructors: 1770 1771 constexpr error_condition() noexcept; 1772 constexpr error_condition( int val, const error_category & cat ) noexcept; 1773 1774 template <class ErrorConditionEnum> 1775 constexpr error_condition( ErrorConditionEnum e ) noexcept; 1776 1777 // modifiers: 1778 1779 constexpr void assign( int val, const error_category & cat ) noexcept; 1780 1781 template<typename ErrorConditionEnum> 1782 constexpr error_condition & operator=( ErrorConditionEnum e ) noexcept; 1783 1784 constexpr void clear() noexcept; 1785 1786 // observers: 1787 1788 constexpr int value() const noexcept; 1789 constexpr const error_category & category() const noexcept; 1790 1791 std::string message() const; 1792 char const * message( char * buffer, std::size_t len ) const noexcept; 1793 1794 constexpr bool failed() const noexcept; 1795 constexpr explicit operator bool() const noexcept; 1796 1797 operator std::error_condition() const; 1798 1799 private: // exposition only 1800 1801 int val_; 1802 const error_category * cat_; 1803 1804 }; 1805 } 1806}</code></pre> 1807</div> 1808</div> 1809<div class="sect4"> 1810<h5 id="ref_constructors_3">Constructors</h5> 1811<div class="listingblock"> 1812<div class="content"> 1813<pre class="highlight"><code>constexpr error_condition() noexcept;</code></pre> 1814</div> 1815</div> 1816<div class="ulist none"> 1817<ul class="none"> 1818<li> 1819<p></p> 1820<div class="dlist"> 1821<dl> 1822<dt class="hdlist1">Ensures: </dt> 1823<dd> 1824<p><code>val_ == 0</code>; <code>*cat_ == generic_category()</code>.</p> 1825</dd> 1826</dl> 1827</div> 1828</li> 1829</ul> 1830</div> 1831<div class="listingblock"> 1832<div class="content"> 1833<pre class="highlight"><code>constexpr error_condition( int val, const error_category & cat ) noexcept;</code></pre> 1834</div> 1835</div> 1836<div class="ulist none"> 1837<ul class="none"> 1838<li> 1839<p></p> 1840<div class="dlist"> 1841<dl> 1842<dt class="hdlist1">Ensures: </dt> 1843<dd> 1844<p><code>val_ == val</code>; <code>cat_ == &cat</code>.</p> 1845</dd> 1846</dl> 1847</div> 1848</li> 1849</ul> 1850</div> 1851<div class="listingblock"> 1852<div class="content"> 1853<pre class="highlight"><code>template <class ErrorConditionEnum> 1854 constexpr error_condition( ErrorConditionEnum e ) noexcept;</code></pre> 1855</div> 1856</div> 1857<div class="ulist none"> 1858<ul class="none"> 1859<li> 1860<p></p> 1861<div class="dlist"> 1862<dl> 1863<dt class="hdlist1">Ensures: </dt> 1864<dd> 1865<p><code>*this == make_error_condition( e )</code>.</p> 1866</dd> 1867<dt class="hdlist1">Remarks: </dt> 1868<dd> 1869<p>This constructor is only enabled when <code>is_error_condition_enum<ErrorConditionEnum>::value</code> is <code>true</code>.</p> 1870</dd> 1871</dl> 1872</div> 1873</li> 1874</ul> 1875</div> 1876</div> 1877<div class="sect4"> 1878<h5 id="ref_modifiers_2">Modifiers</h5> 1879<div class="listingblock"> 1880<div class="content"> 1881<pre class="highlight"><code>constexpr void assign( int val, const error_category & cat ) noexcept;</code></pre> 1882</div> 1883</div> 1884<div class="ulist none"> 1885<ul class="none"> 1886<li> 1887<p></p> 1888<div class="dlist"> 1889<dl> 1890<dt class="hdlist1">Ensures: </dt> 1891<dd> 1892<p><code>val_ == val</code>; <code>cat_ == &cat</code>.</p> 1893</dd> 1894</dl> 1895</div> 1896</li> 1897</ul> 1898</div> 1899<div class="listingblock"> 1900<div class="content"> 1901<pre class="highlight"><code>template <class ErrorConditionEnum> 1902 constexpr error_condition & operator=( ErrorConditionEnum e ) noexcept;</code></pre> 1903</div> 1904</div> 1905<div class="ulist none"> 1906<ul class="none"> 1907<li> 1908<p></p> 1909<div class="dlist"> 1910<dl> 1911<dt class="hdlist1">Ensures: </dt> 1912<dd> 1913<p><code>*this == make_error_condition( e )</code>.</p> 1914</dd> 1915<dt class="hdlist1">Remarks: </dt> 1916<dd> 1917<p>This operator is only enabled when <code>is_error_condition_enum<ErrorConditionEnum>::value</code> is <code>true</code>.</p> 1918</dd> 1919</dl> 1920</div> 1921</li> 1922</ul> 1923</div> 1924<div class="listingblock"> 1925<div class="content"> 1926<pre class="highlight"><code>constexpr void clear() noexcept;</code></pre> 1927</div> 1928</div> 1929<div class="ulist none"> 1930<ul class="none"> 1931<li> 1932<p></p> 1933<div class="dlist"> 1934<dl> 1935<dt class="hdlist1">Ensures: </dt> 1936<dd> 1937<p><code>val_ == 0</code>; <code>*cat_ == generic_category()</code>.</p> 1938</dd> 1939</dl> 1940</div> 1941</li> 1942</ul> 1943</div> 1944</div> 1945<div class="sect4"> 1946<h5 id="ref_observers_2">Observers</h5> 1947<div class="listingblock"> 1948<div class="content"> 1949<pre class="highlight"><code>constexpr int value() const noexcept;</code></pre> 1950</div> 1951</div> 1952<div class="ulist none"> 1953<ul class="none"> 1954<li> 1955<p></p> 1956<div class="dlist"> 1957<dl> 1958<dt class="hdlist1">Returns: </dt> 1959<dd> 1960<p><code>val_</code>.</p> 1961</dd> 1962</dl> 1963</div> 1964</li> 1965</ul> 1966</div> 1967<div class="listingblock"> 1968<div class="content"> 1969<pre class="highlight"><code>constexpr const error_category & category() const noexcept;</code></pre> 1970</div> 1971</div> 1972<div class="ulist none"> 1973<ul class="none"> 1974<li> 1975<p></p> 1976<div class="dlist"> 1977<dl> 1978<dt class="hdlist1">Returns: </dt> 1979<dd> 1980<p><code>*cat_</code>.</p> 1981</dd> 1982</dl> 1983</div> 1984</li> 1985</ul> 1986</div> 1987<div class="listingblock"> 1988<div class="content"> 1989<pre class="highlight"><code>std::string message() const;</code></pre> 1990</div> 1991</div> 1992<div class="ulist none"> 1993<ul class="none"> 1994<li> 1995<p></p> 1996<div class="dlist"> 1997<dl> 1998<dt class="hdlist1">Returns: </dt> 1999<dd> 2000<p><code>cat_->message( val_ )</code>.</p> 2001</dd> 2002</dl> 2003</div> 2004</li> 2005</ul> 2006</div> 2007<div class="listingblock"> 2008<div class="content"> 2009<pre class="highlight"><code>char const * message( char * buffer, std::size_t len ) const noexcept;</code></pre> 2010</div> 2011</div> 2012<div class="ulist none"> 2013<ul class="none"> 2014<li> 2015<p></p> 2016<div class="dlist"> 2017<dl> 2018<dt class="hdlist1">Returns: </dt> 2019<dd> 2020<p><code>cat_->message( val_, buffer, len )</code>.</p> 2021</dd> 2022</dl> 2023</div> 2024</li> 2025</ul> 2026</div> 2027<div class="listingblock"> 2028<div class="content"> 2029<pre class="highlight"><code>constexpr bool failed() const noexcept;</code></pre> 2030</div> 2031</div> 2032<div class="ulist none"> 2033<ul class="none"> 2034<li> 2035<p></p> 2036<div class="dlist"> 2037<dl> 2038<dt class="hdlist1">Returns: </dt> 2039<dd> 2040<p><code>cat_->failed( val_ )</code>.</p> 2041</dd> 2042</dl> 2043</div> 2044</li> 2045</ul> 2046</div> 2047<div class="listingblock"> 2048<div class="content"> 2049<pre class="highlight"><code>constexpr explicit operator bool() const noexcept;</code></pre> 2050</div> 2051</div> 2052<div class="ulist none"> 2053<ul class="none"> 2054<li> 2055<p></p> 2056<div class="dlist"> 2057<dl> 2058<dt class="hdlist1">Returns: </dt> 2059<dd> 2060<p><code>failed()</code>.</p> 2061</dd> 2062</dl> 2063</div> 2064</li> 2065</ul> 2066</div> 2067<div class="listingblock"> 2068<div class="content"> 2069<pre class="highlight"><code>operator std::error_condition() const;</code></pre> 2070</div> 2071</div> 2072<div class="ulist none"> 2073<ul class="none"> 2074<li> 2075<p></p> 2076<div class="dlist"> 2077<dl> 2078<dt class="hdlist1">Returns: </dt> 2079<dd> 2080<p><code>std::error_condition( val_, *cat_ )</code>.</p> 2081</dd> 2082</dl> 2083</div> 2084</li> 2085</ul> 2086</div> 2087</div> 2088</div> 2089<div class="sect3"> 2090<h4 id="ref_nonmember_functions">Nonmember functions</h4> 2091<div class="listingblock"> 2092<div class="content"> 2093<pre class="highlight"><code>constexpr bool operator==( const error_code & lhs, 2094 const error_code & rhs ) noexcept; 2095constexpr bool operator==( const error_condition & lhs, 2096 const error_condition & rhs ) noexcept;</code></pre> 2097</div> 2098</div> 2099<div class="ulist none"> 2100<ul class="none"> 2101<li> 2102<p></p> 2103<div class="dlist"> 2104<dl> 2105<dt class="hdlist1">Returns: </dt> 2106<dd> 2107<p><code>lhs.value() == rhs.value() && lhs.category() == rhs.category()</code>.</p> 2108</dd> 2109</dl> 2110</div> 2111</li> 2112</ul> 2113</div> 2114<div class="listingblock"> 2115<div class="content"> 2116<pre class="highlight"><code>bool operator==( const error_code & code, 2117 const error_condition & condition ) noexcept; 2118bool operator==( const error_condition & condition, 2119 const error_code & code ) noexcept;</code></pre> 2120</div> 2121</div> 2122<div class="ulist none"> 2123<ul class="none"> 2124<li> 2125<p></p> 2126<div class="dlist"> 2127<dl> 2128<dt class="hdlist1">Returns: </dt> 2129<dd> 2130<p><code>code.category().equivalent( code.value(), condition ) || condition.category().equivalent( code, condition.value() )</code>.</p> 2131</dd> 2132</dl> 2133</div> 2134</li> 2135</ul> 2136</div> 2137<div class="listingblock"> 2138<div class="content"> 2139<pre class="highlight"><code>constexpr bool operator!=( const error_code & lhs, 2140 const error_code & rhs ) noexcept; 2141constexpr bool operator!=( const error_condition & lhs, 2142 const error_condition & rhs ) noexcept; 2143bool operator!=( const error_code & code, 2144 const error_condition & condition ) noexcept; 2145bool operator!=( const error_condition & condition, 2146 const error_code & code ) noexcept;</code></pre> 2147</div> 2148</div> 2149<div class="ulist none"> 2150<ul class="none"> 2151<li> 2152<p></p> 2153<div class="dlist"> 2154<dl> 2155<dt class="hdlist1">Returns: </dt> 2156<dd> 2157<p><code>!( lhs == rhs )</code>.</p> 2158</dd> 2159</dl> 2160</div> 2161</li> 2162</ul> 2163</div> 2164<div class="listingblock"> 2165<div class="content"> 2166<pre class="highlight"><code>constexpr bool operator<( const error_code & lhs, 2167 const error_code & rhs ) noexcept; 2168constexpr bool operator<( const error_condition & lhs, 2169 const error_condition & rhs ) noexcept;</code></pre> 2170</div> 2171</div> 2172<div class="ulist none"> 2173<ul class="none"> 2174<li> 2175<p></p> 2176<div class="dlist"> 2177<dl> 2178<dt class="hdlist1">Returns: </dt> 2179<dd> 2180<p><code>lhs.category() < rhs.category() || ( lhs.category() == rhs.category() && lhs.value() < rhs.value() )</code>.</p> 2181</dd> 2182</dl> 2183</div> 2184</li> 2185</ul> 2186</div> 2187<div class="listingblock"> 2188<div class="content"> 2189<pre class="highlight"><code>constexpr error_code make_error_code( errc::errc_t e ) noexcept;</code></pre> 2190</div> 2191</div> 2192<div class="ulist none"> 2193<ul class="none"> 2194<li> 2195<p></p> 2196<div class="dlist"> 2197<dl> 2198<dt class="hdlist1">Returns: </dt> 2199<dd> 2200<p><code>error_code( e, generic_category() )</code>.</p> 2201</dd> 2202</dl> 2203</div> 2204</li> 2205</ul> 2206</div> 2207<div class="listingblock"> 2208<div class="content"> 2209<pre class="highlight"><code>constexpr error_condition make_error_condition( errc::errc_t e ) noexcept;</code></pre> 2210</div> 2211</div> 2212<div class="ulist none"> 2213<ul class="none"> 2214<li> 2215<p></p> 2216<div class="dlist"> 2217<dl> 2218<dt class="hdlist1">Returns: </dt> 2219<dd> 2220<p><code>error_condition( e, generic_category() )</code>.</p> 2221</dd> 2222</dl> 2223</div> 2224</li> 2225</ul> 2226</div> 2227<div class="listingblock"> 2228<div class="content"> 2229<pre class="highlight"><code>template <class charT, class traits> 2230 std::basic_ostream<charT, traits>& 2231 operator<<( basic_ostream<charT, traits>& os, const error_code & ec );</code></pre> 2232</div> 2233</div> 2234<div class="ulist none"> 2235<ul class="none"> 2236<li> 2237<p></p> 2238<div class="dlist"> 2239<dl> 2240<dt class="hdlist1">Effects: </dt> 2241<dd> 2242<p><code>os << ec.category().name() << ':' << ec.value()</code>.</p> 2243</dd> 2244<dt class="hdlist1">Returns: </dt> 2245<dd> 2246<p><code>os</code>.</p> 2247</dd> 2248</dl> 2249</div> 2250</li> 2251</ul> 2252</div> 2253<div class="listingblock"> 2254<div class="content"> 2255<pre class="highlight"><code>std::size_t hash_value( const error_code & ec );</code></pre> 2256</div> 2257</div> 2258<div class="ulist none"> 2259<ul class="none"> 2260<li> 2261<p></p> 2262<div class="dlist"> 2263<dl> 2264<dt class="hdlist1">Returns: </dt> 2265<dd> 2266<p>A hash value representing <code>ec</code>.</p> 2267</dd> 2268</dl> 2269</div> 2270</li> 2271</ul> 2272</div> 2273</div> 2274</div> 2275<div class="sect2"> 2276<h3 id="ref_boostsystemsystem_error_hpp"><boost/system/system_error.hpp></h3> 2277<div class="sect3"> 2278<h4 id="ref_class_system_error">Class system_error</h4> 2279<div class="paragraph"> 2280<p>The class <code>system_error</code> describes an exception object used to 2281report errors that have an associated <code>error_code</code>. Such errors 2282typically originate from operating system or other low-level 2283application program interfaces.</p> 2284</div> 2285<div class="listingblock"> 2286<div class="content"> 2287<pre class="highlight"><code>namespace boost 2288{ 2289 namespace system 2290 { 2291 class system_error: public std::runtime_error 2292 { 2293 public: 2294 2295 explicit system_error( error_code ec ); 2296 system_error( error_code ec, const char * what_arg ); 2297 system_error( error_code ec, const std::string & what_arg ); 2298 2299 system_error( int ev, const error_category & ecat ); 2300 system_error( int ev, const error_category & ecat, 2301 const char * what_arg ); 2302 system_error( int ev, const error_category & ecat, 2303 const std::string & what_arg ); 2304 2305 error_code code() const noexcept; 2306 const char * what() const noexcept; 2307 }; 2308 } 2309}</code></pre> 2310</div> 2311</div> 2312<div class="sect4"> 2313<h5 id="ref_constructors_4">Constructors</h5> 2314<div class="listingblock"> 2315<div class="content"> 2316<pre class="highlight"><code>explicit system_error( error_code ec ); 2317system_error( error_code ec, const char * what_arg ); 2318system_error( error_code ec, const std::string & what_arg );</code></pre> 2319</div> 2320</div> 2321<div class="ulist none"> 2322<ul class="none"> 2323<li> 2324<p></p> 2325<div class="dlist"> 2326<dl> 2327<dt class="hdlist1">Ensures: </dt> 2328<dd> 2329<p><code>code() == ec</code>.</p> 2330</dd> 2331</dl> 2332</div> 2333</li> 2334</ul> 2335</div> 2336<div class="listingblock"> 2337<div class="content"> 2338<pre class="highlight"><code>system_error( int ev, const error_category & ecat, 2339 const char * what_arg ); 2340system_error( int ev, const error_category & ecat, 2341 const std::string & what_arg ); 2342system_error( int ev, const error_category & ecat );</code></pre> 2343</div> 2344</div> 2345<div class="ulist none"> 2346<ul class="none"> 2347<li> 2348<p></p> 2349<div class="dlist"> 2350<dl> 2351<dt class="hdlist1">Ensures: </dt> 2352<dd> 2353<p><code>code() == error_code( ev, ecat )</code>.</p> 2354</dd> 2355</dl> 2356</div> 2357</li> 2358</ul> 2359</div> 2360</div> 2361<div class="sect4"> 2362<h5 id="ref_observers_3">Observers</h5> 2363<div class="listingblock"> 2364<div class="content"> 2365<pre class="highlight"><code>error_code code() const noexcept;</code></pre> 2366</div> 2367</div> 2368<div class="ulist none"> 2369<ul class="none"> 2370<li> 2371<p></p> 2372<div class="dlist"> 2373<dl> 2374<dt class="hdlist1">Returns: </dt> 2375<dd> 2376<p><code>ec</code> or <code>error_code( ev, ecat )</code>, from the constructor, as appropriate.</p> 2377</dd> 2378</dl> 2379</div> 2380</li> 2381</ul> 2382</div> 2383<div class="listingblock"> 2384<div class="content"> 2385<pre class="highlight"><code>const char * what() const noexcept;</code></pre> 2386</div> 2387</div> 2388<div class="ulist none"> 2389<ul class="none"> 2390<li> 2391<p></p> 2392<div class="dlist"> 2393<dl> 2394<dt class="hdlist1">Returns: </dt> 2395<dd> 2396<p>A null-terminated character string incorporating the arguments supplied 2397in the constructor, typically of the form <code>what_arg + ": " + code.message()</code>.</p> 2398</dd> 2399</dl> 2400</div> 2401</li> 2402</ul> 2403</div> 2404</div> 2405</div> 2406</div> 2407</div> 2408</div> 2409<div class="sect1"> 2410<h2 id="history">History</h2> 2411<div class="sectionbody"> 2412<div class="paragraph"> 2413<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1975.html">N1975</a>, 2414Filesystem Library Proposal for TR2, accepted for Library Technical 2415Report 2 (TR2) at the Berlin meeting, included additional components to 2416supplement the Standard Library’s Diagnostics clause. Since then, these error 2417reporting components have received wider public scrutiny and enhancements have 2418been made to the design. The enhanced version has been used by 2419<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2054.pdf">N2054</a>, 2420Networking Library Proposal for TR2, demonstrating that these error reporting 2421components are useful beyond the original Filesystem Library.</p> 2422</div> 2423<div class="paragraph"> 2424<p>The original proposal viewed error categories as a binary choice between 2425<code>errno</code> (i.e. POSIX-style) and the native operating system’s error 2426codes. The proposed components now allow as many additional error categories as 2427are needed by either implementations or by users. The need to support additional 2428error categories, for example, occurs in some networking library implementations 2429because they are built on top of the POSIX <code>getaddrinfo</code> API that 2430uses error codes not based on <code>errno</code>.</p> 2431</div> 2432</div> 2433</div> 2434<div class="sect1"> 2435<h2 id="acknowledgments">Acknowledgments</h2> 2436<div class="sectionbody"> 2437<div class="paragraph"> 2438<p>Christopher Kohlhoff and Peter Dimov made important contributions to the 2439design. Comments and suggestions were also received from Pavel Vozenilek, 2440Gennaro Prota, Dave Abrahams, Jeff Garland, Iain Hanson, Oliver Kowalke, and 2441Oleg Abrosimov. Christopher Kohlhoff suggested several improvements to the 2442<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2066.html">N2066</a> 2443paper. Johan Nilsson’s comments led to several of the refinements in N2066.</p> 2444</div> 2445</div> 2446</div> 2447<div class="sect1"> 2448<h2 id="copyright">Copyright and License</h2> 2449<div class="sectionbody"> 2450<div class="paragraph"> 2451<p>This documentation is</p> 2452</div> 2453<div class="ulist"> 2454<ul> 2455<li> 2456<p>Copyright 2003-2017 Beman Dawes</p> 2457</li> 2458<li> 2459<p>Copyright 2018 Peter Dimov</p> 2460</li> 2461</ul> 2462</div> 2463<div class="paragraph"> 2464<p>and is distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</p> 2465</div> 2466</div> 2467</div> 2468</div> 2469<div id="footer"> 2470<div id="footer-text"> 2471Last updated 2020-08-11 14:57:22 UTC 2472</div> 2473</div> 2474<style> 2475 2476*:not(pre)>code { background: none; color: #600000; } 2477:not(pre):not([class^=L])>code { background: none; color: #600000; } 2478 2479</style> 2480</body> 2481</html>