• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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="Daryle Walker, Beman Dawes, Glen Joseph Fernandes &lt;glenjofe@gmail.com&gt;">
9<title>Boost.IO</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.IO</h1>
437<div class="details">
438<span id="author" class="author">Daryle Walker, Beman Dawes, Glen Joseph Fernandes &lt;glenjofe@gmail.com&gt;</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="#io_state_savers_boostioios_state_hpp">IO State Savers, &lt;boost/io/ios_state.hpp&gt;</a>
444<ul class="sectlevel2">
445<li><a href="#description">Description</a></li>
446<li><a href="#rationale">Rationale</a></li>
447<li><a href="#header_synopsis">Header Synopsis</a></li>
448<li><a href="#savers_for_basic_standard_attributes">Savers for Basic Standard Attributes</a></li>
449<li><a href="#savers_for_advanced_standard_attributes">Savers for Advanced Standard Attributes</a></li>
450<li><a href="#savers_for_user_defined_attributes">Savers for User-Defined Attributes</a></li>
451<li><a href="#example">Example</a></li>
452<li><a href="#credits">Credits</a></li>
453<li><a href="#history">History</a></li>
454</ul>
455</li>
456<li><a href="#quoted_manipulators_boostioquoted_hpp">Quoted Manipulators, &lt;boost/io/quoted.hpp&gt;</a>
457<ul class="sectlevel2">
458<li><a href="#introduction">Introduction</a></li>
459<li><a href="#header_synopsis_2">Header synopsis</a></li>
460<li><a href="#acknowledgements">Acknowledgements</a></li>
461</ul>
462</li>
463<li><a href="#delimited_iterators_boostioostream_joiner_hpp">Delimited Iterators, &lt;boost/io/ostream_joiner.hpp&gt;</a>
464<ul class="sectlevel2">
465<li><a href="#description_2">Description</a></li>
466<li><a href="#example_2">Example</a></li>
467<li><a href="#reference">Reference</a></li>
468<li><a href="#acknowledgments">Acknowledgments</a></li>
469</ul>
470</li>
471<li><a href="#insert_formatted_output_boostioostream_put_hpp">Insert Formatted Output, &lt;boost/io/ostream_put.hpp&gt;</a>
472<ul class="sectlevel2">
473<li><a href="#description_3">Description</a></li>
474<li><a href="#example_3">Example</a></li>
475<li><a href="#reference_2">Reference</a></li>
476<li><a href="#acknowledgments_2">Acknowledgments</a></li>
477</ul>
478</li>
479<li><a href="#copyright_and_license">Copyright and License</a></li>
480</ul>
481</div>
482</div>
483<div id="content">
484<div id="preamble">
485<div class="sectionbody">
486<div class="paragraph">
487<p>This library contains various utilities for the standard I/O library.</p>
488</div>
489</div>
490</div>
491<div class="sect1">
492<h2 id="io_state_savers_boostioios_state_hpp">IO State Savers, &lt;boost/io/ios_state.hpp&gt;</h2>
493<div class="sectionbody">
494<div class="sect2">
495<h3 id="description">Description</h3>
496<div class="paragraph">
497<p>The header <code>&lt;boost/io/ios_state.hpp&gt;</code> covers saving the stream state of objects
498in the C&#43;&#43; IOStreams system.</p>
499</div>
500</div>
501<div class="sect2">
502<h3 id="rationale">Rationale</h3>
503<div class="paragraph">
504<p>Sometimes a certain value has to change only for a limited scope. Saver classes
505save a copy of the current state of some object (or an aspect of an object),
506and reset the object&#8217;s state at destruction time, undoing any change the object
507may have gone through.</p>
508</div>
509<div class="paragraph">
510<p>The saver class strategy is helpful when using I/O stream objects. Manipulator
511objects can change some aspect of a stream during input or output. The state
512changed by the manipulator usually sticks to its new value after the I/O
513transaction. This can be a problem if manipulators are used in a function that
514is not supposed to externally change a stream&#8217;s state.</p>
515</div>
516<div class="listingblock">
517<div class="content">
518<pre class="highlight"><code class="language-cpp" data-lang="cpp">#include &lt;ostream&gt;
519#include &lt;ios&gt;
520
521void hex_my_byte(std::ostream&amp; os, char byte)
522{
523    os &lt;&lt; std::hex &lt;&lt; static_cast&lt;unsigned&gt;(byte);
524}</code></pre>
525</div>
526</div>
527<div class="paragraph">
528<p>The <code>os</code> stream will retain its new hexadecimal printing mode after the call to
529<code>hex_my_byte</code>. The stream&#8217;s printing mode can be saved and restored with manual
530calls to the stream&#8217;s state inspecting and mutating member functions. The
531manual method becomes unwieldy if the main functionality is complex and/or
532needs to be exception safe. A saver class can implement the better
533"resource acquisition is initialization" strategy.</p>
534</div>
535<div class="paragraph">
536<p>See the example below for better code, using saver classes.</p>
537</div>
538</div>
539<div class="sect2">
540<h3 id="header_synopsis">Header Synopsis</h3>
541<div class="listingblock">
542<div class="content">
543<pre class="highlight"><code class="language-cpp" data-lang="cpp">namespace boost {
544namespace io {
545
546class ios_flags_saver;
547class ios_precision_saver;
548class ios_width_saver;
549class ios_base_all_saver;
550
551template&lt;class Ch, class Tr = std::char_traits&lt;Ch&gt; &gt;
552class basic_ios_iostate_saver;
553
554template&lt;class Ch, class Tr = std::char_traits&lt;Ch&gt; &gt;
555class basic_ios_exception_saver;
556
557template&lt;class Ch, class Tr = std::char_traits&lt;Ch&gt; &gt;
558class basic_ios_tie_saver;
559
560template&lt;class Ch, class Tr = std::char_traits&lt;Ch&gt; &gt;
561class basic_ios_rdbuf_saver;
562
563template&lt;class Ch, class Tr = std::char_traits&lt;Ch&gt; &gt;
564class basic_ios_fill_saver;
565
566template&lt;class Ch, class Tr = std::char_traits&lt;Ch&gt; &gt;
567class basic_ios_locale_saver;
568
569template&lt;class Ch, class Tr = std::char_traits&lt;Ch&gt; &gt;
570class basic_ios_all_saver;
571
572typedef basic_ios_iostate_saver&lt;char&gt;      ios_iostate_saver;
573typedef basic_ios_iostate_saver&lt;wchar_t&gt;   wios_iostate_saver;
574typedef basic_ios_exception_saver&lt;char&gt;    ios_exception_saver;
575typedef basic_ios_exception_saver&lt;wchar_t&gt; wios_exception_saver;
576typedef basic_ios_tie_saver&lt;char&gt;          ios_tie_saver;
577typedef basic_ios_tie_saver&lt;wchar_t&gt;       wios_tie_saver;
578typedef basic_ios_rdbuf_saver&lt;char&gt;        ios_rdbuf_saver;
579typedef basic_ios_rdbuf_saver&lt;wchar_t&gt;     wios_rdbuf_saver;
580typedef basic_ios_fill_saver&lt;char&gt;         ios_fill_saver;
581typedef basic_ios_fill_saver&lt;wchar_t&gt;      wios_fill_saver;
582typedef basic_ios_locale_saver&lt;char&gt;       ios_locale_saver;
583typedef basic_ios_locale_saver&lt;wchar_t&gt;    wios_locale_saver;
584typedef basic_ios_all_saver&lt;char&gt;          ios_all_saver;
585typedef basic_ios_all_saver&lt;wchar_t&gt;       wios_all_saver;
586
587class ios_iword_saver;
588class ios_pword_saver;
589class ios_all_word_saver;
590
591} // io
592} // boost</code></pre>
593</div>
594</div>
595</div>
596<div class="sect2">
597<h3 id="savers_for_basic_standard_attributes">Savers for Basic Standard Attributes</h3>
598<div class="paragraph">
599<p>The basic saver classes have this format:</p>
600</div>
601<div class="listingblock">
602<div class="content">
603<pre class="highlight"><code class="language-cpp" data-lang="cpp">class saver {
604public:
605    typedef std::ios_base state_type;
606    typedef <code>implementation_defined</code> aspect_type;
607
608    explicit saver(state_type&amp; s);
609    saver(state_type&amp; s, const aspect_type&amp; new_value);
610    ~saver();
611
612    void restore();
613};</code></pre>
614</div>
615</div>
616<div class="paragraph">
617<p>The <code>state_type</code> is the IOStreams base class <code>std::ios_base</code>. The user would
618usually place an actual input, output, or combined stream object for the
619state-type parameter, and not a base class object. The first constructor takes
620a stream object and saves a reference to the stream and the current value of a
621particular stream attribute. The second constructor works like the first, and
622uses its second argument to change the stream&#8217;s attribute to the new
623<code>aspect_type</code> value given. The destructor restores the stream&#8217;s attribute to
624the saved value. The restoration can be activated early (and often) with the
625<code>restore</code> member function.</p>
626</div>
627<table class="tableblock frame-all grid-all stretch">
628<caption class="title">Table 1. Basic IOStreams State Saver Classes</caption>
629<colgroup>
630<col style="width: 20%;">
631<col style="width: 20%;">
632<col style="width: 20%;">
633<col style="width: 20%;">
634<col style="width: 20%;">
635</colgroup>
636<thead>
637<tr>
638<th class="tableblock halign-left valign-top">Class</th>
639<th class="tableblock halign-left valign-top">Saved Attribute</th>
640<th class="tableblock halign-left valign-top">Attribute Type</th>
641<th class="tableblock halign-left valign-top">Reading Method</th>
642<th class="tableblock halign-left valign-top">Writing Method</th>
643</tr>
644</thead>
645<tbody>
646<tr>
647<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ios_flags_saver</code></p></td>
648<td class="tableblock halign-left valign-top"><p class="tableblock">Format control flags</p></td>
649<td class="tableblock halign-left valign-top"><p class="tableblock"><code>std::ios_base::fmtflags</code></p></td>
650<td class="tableblock halign-left valign-top"><p class="tableblock"><code>flags</code></p></td>
651<td class="tableblock halign-left valign-top"><p class="tableblock"><code>flags</code></p></td>
652</tr>
653<tr>
654<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ios_precision_saver</code></p></td>
655<td class="tableblock halign-left valign-top"><p class="tableblock">Number of digits to print after decimal point</p></td>
656<td class="tableblock halign-left valign-top"><p class="tableblock"><code>std::streamsize</code></p></td>
657<td class="tableblock halign-left valign-top"><p class="tableblock"><code>precision</code></p></td>
658<td class="tableblock halign-left valign-top"><p class="tableblock"><code>precision</code></p></td>
659</tr>
660<tr>
661<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ios_width_saver</code></p></td>
662<td class="tableblock halign-left valign-top"><p class="tableblock">Minimum field width for printing objects</p></td>
663<td class="tableblock halign-left valign-top"><p class="tableblock"><code>std::streamsize</code></p></td>
664<td class="tableblock halign-left valign-top"><p class="tableblock"><code>width</code></p></td>
665<td class="tableblock halign-left valign-top"><p class="tableblock"><code>width</code></p></td>
666</tr>
667</tbody>
668</table>
669</div>
670<div class="sect2">
671<h3 id="savers_for_advanced_standard_attributes">Savers for Advanced Standard Attributes</h3>
672<div class="paragraph">
673<p>The saver class templates have this format:</p>
674</div>
675<div class="listingblock">
676<div class="content">
677<pre class="highlight"><code class="language-cpp" data-lang="cpp">template&lt;class Ch, class Tr&gt;
678class saver {
679public:
680    typedef std::basic_ios&lt;Ch, Tr&gt; state_type;
681    typedef <code>implementation-defined</code> aspect_type;
682
683    explicit saver(state_type&amp; s);
684    saver(state_type&amp; s, const aspect_type&amp; new_value);
685    ~saver();
686
687    void restore();
688};</code></pre>
689</div>
690</div>
691<div class="paragraph">
692<p>The <code>state_type</code> is a version of the IOStreams base class template
693<code>std::basic_ios&lt;Ch, Tr&gt;</code>, where <code>Ch</code> is a character type and <code>Tr</code> is a
694character traits class. The user would usually place an actual input,
695output, or combined stream object for the state-type parameter, and not a base
696class object. The first constructor takes a stream object and saves a reference
697to the stream and the current value of a particular stream attribute. The
698second constructor works like the first, and uses its second argument to change
699the stream&#8217;s attribute to the new <code>aspect_type</code> value given. The destructor
700restores the stream&#8217;s attribute to the saved value. The restoration can be
701activated early (and often) with the <code>restore</code> member function.</p>
702</div>
703<table class="tableblock frame-all grid-all stretch">
704<caption class="title">Table 2. Advanced IOStreams State Saver Class Templates</caption>
705<colgroup>
706<col style="width: 20%;">
707<col style="width: 20%;">
708<col style="width: 20%;">
709<col style="width: 20%;">
710<col style="width: 20%;">
711</colgroup>
712<thead>
713<tr>
714<th class="tableblock halign-left valign-top">Class</th>
715<th class="tableblock halign-left valign-top">Saved Attribute</th>
716<th class="tableblock halign-left valign-top">Attribute Type</th>
717<th class="tableblock halign-left valign-top">Reading Method</th>
718<th class="tableblock halign-left valign-top">Writing Method</th>
719</tr>
720</thead>
721<tbody>
722<tr>
723<td class="tableblock halign-left valign-top"><p class="tableblock"><code>basic_ios_iostate_saver&lt;Ch, Tr&gt;</code></p></td>
724<td class="tableblock halign-left valign-top"><p class="tableblock">Failure state of the stream [1], [2]</p></td>
725<td class="tableblock halign-left valign-top"><p class="tableblock"><code>std::ios_base::iostate</code></p></td>
726<td class="tableblock halign-left valign-top"><p class="tableblock"><code>rdstate</code></p></td>
727<td class="tableblock halign-left valign-top"><p class="tableblock"><code>clear</code></p></td>
728</tr>
729<tr>
730<td class="tableblock halign-left valign-top"><p class="tableblock"><code>basic_ios_exception_saver&lt;Ch, Tr&gt;</code></p></td>
731<td class="tableblock halign-left valign-top"><p class="tableblock">Which failure states trigger an exception [1]</p></td>
732<td class="tableblock halign-left valign-top"><p class="tableblock"><code>std::ios_base::iostate</code></p></td>
733<td class="tableblock halign-left valign-top"><p class="tableblock"><code>exceptions</code></p></td>
734<td class="tableblock halign-left valign-top"><p class="tableblock"><code>exceptions</code></p></td>
735</tr>
736<tr>
737<td class="tableblock halign-left valign-top"><p class="tableblock"><code>basic_ios_tie_saver&lt;Ch, Tr&gt;</code></p></td>
738<td class="tableblock halign-left valign-top"><p class="tableblock">Output stream synchronized with the stream</p></td>
739<td class="tableblock halign-left valign-top"><p class="tableblock"><code>std::basic_ostream&lt;Ch, Tr&gt;*</code></p></td>
740<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tie</code></p></td>
741<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tie</code></p></td>
742</tr>
743<tr>
744<td class="tableblock halign-left valign-top"><p class="tableblock"><code>basic_ios_rdbuf_saver&lt;Ch, Tr&gt;</code></p></td>
745<td class="tableblock halign-left valign-top"><p class="tableblock">Stream buffer associated with the stream [2]</p></td>
746<td class="tableblock halign-left valign-top"><p class="tableblock"><code>std::basic_streambuf&lt;Ch, Tr&gt;*</code></p></td>
747<td class="tableblock halign-left valign-top"><p class="tableblock"><code>rdbuf</code></p></td>
748<td class="tableblock halign-left valign-top"><p class="tableblock"><code>rdbuf</code></p></td>
749</tr>
750<tr>
751<td class="tableblock halign-left valign-top"><p class="tableblock"><code>basic_ios_fill_saver&lt;Ch, Tr&gt;</code></p></td>
752<td class="tableblock halign-left valign-top"><p class="tableblock">Character used to pad oversized field widths</p></td>
753<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Ch</code></p></td>
754<td class="tableblock halign-left valign-top"><p class="tableblock"><code>fill</code></p></td>
755<td class="tableblock halign-left valign-top"><p class="tableblock"><code>fill</code></p></td>
756</tr>
757<tr>
758<td class="tableblock halign-left valign-top"><p class="tableblock"><code>basic_ios_locale_saver&lt;Ch, Tr&gt;</code></p></td>
759<td class="tableblock halign-left valign-top"><p class="tableblock">Locale information associated with the stream [3]</p></td>
760<td class="tableblock halign-left valign-top"><p class="tableblock"><code>std::locale</code></p></td>
761<td class="tableblock halign-left valign-top"><p class="tableblock"><code>getloc</code> (from <code>std::ios_base</code>)</p></td>
762<td class="tableblock halign-left valign-top"><p class="tableblock"><code>imbue</code> (from <code>std::basic_ios&lt;Ch, Tr&gt;</code>)</p></td>
763</tr>
764</tbody>
765</table>
766<div class="sect3">
767<h4 id="notes">Notes</h4>
768<div class="olist arabic">
769<ol class="arabic">
770<li>
771<p>When the failure state flags and/or the failure state exception watching
772flags are changed, an exception is thrown if a match occurs among the two sets
773of flags. This could mean that the constructor or destructor of these class
774templates may throw.</p>
775</li>
776<li>
777<p>When the associated stream buffer is changed, the stream&#8217;s failure state set
778is reset to "good" if the given stream buffer&#8217;s address is non-NULL, but the
779"bad" failure state is set if that address is NULL. This means that a saved
780failure state of "good" may be restored as "bad" if the stream is stripped of
781an associated stream buffer. Worse, given a NULL stream buffer address, an
782exception is thrown if the "bad" failure state is being watched. This could
783mean that the constructor or destructor of these class templates may throw.</p>
784</li>
785<li>
786<p>The saver for the locale uses the <code>std::basic_ios&lt;Ch, Tr&gt;</code> class to extract
787their information, although it could have used the functionality in
788<code>std::ios_base</code>. The problem is that the versions of the needed member
789functions in <code>ios_base</code> are not polymorphically related to the ones in
790<code>basic_ios</code>. The stream classes that will be used with the saver classes should
791use the versions of the member functions closest to them by inheritance, which
792means the ones in <code>basic_ios</code>.</p>
793</li>
794</ol>
795</div>
796</div>
797</div>
798<div class="sect2">
799<h3 id="savers_for_user_defined_attributes">Savers for User-Defined Attributes</h3>
800<div class="paragraph">
801<p>There are three class (templates) for combined attribute savers. The
802<code>ios_base_all_saver</code> saver class combines the functionality of all the basic
803attribute saver classes. It has a constructor that takes the stream to have its
804state preserved. The <code>basic_ios_all_saver</code> combines the functionality of all
805the advanced attribute saver class templates and the combined basic attribute
806saver class. It has a constructor that takes the stream to have its state
807preserved. The <code>ios_all_word_saver</code> saver class combines the saver classes that
808preserve user-defined formatting information. Its constructor takes the stream
809to have its attributes saved and the index of the user-defined attributes. The
810destructor for each class restores the saved state. Restoration can be
811activated early (and often) for a class with the restore member function.</p>
812</div>
813</div>
814<div class="sect2">
815<h3 id="example">Example</h3>
816<div class="paragraph">
817<p>The code used in the rationale can be improved at two places. The printing
818function could use a saver around the code that changes the formatting state.
819Or the calling function can surround the call with a saver. Or both can be
820done, especially if the user does not know if the printing function uses a
821state saver. If the user wants a series of changes back and forth, without
822surrounding each change within a separate block, the restore member function
823can be called between each trial.</p>
824</div>
825<div class="listingblock">
826<div class="content">
827<pre class="highlight"><code class="language-cpp" data-lang="cpp">#include &lt;boost/io/ios_state.hpp&gt;
828#include &lt;ios&gt;
829#include &lt;iostream&gt;
830#include &lt;ostream&gt;
831
832void new_hex_my_byte(std::ostream&amp; os, char byte)
833{
834    boost::io::ios_flags_saver ifs(os);
835    os &lt;&lt; std::hex &lt;&lt; static_cast&lt;unsigned&gt;(byte);
836}
837
838int main()
839{
840    // ...
841    {
842        boost::io::ios_all_saver ias(std::cout);
843        new_hex_my_byte(std::cout, 'A');
844    }
845    // ...
846    {
847        boost::io::ios_all_saver ias(std::cerr);
848        new_hex_my_byte(std::cerr, 'b');
849        ias.restore();
850        new_hex_my_byte(std::cerr, 'C');
851    }
852    // ...
853}</code></pre>
854</div>
855</div>
856</div>
857<div class="sect2">
858<h3 id="credits">Credits</h3>
859<div class="sect3">
860<h4 id="daryle_walker">Daryle Walker</h4>
861<div class="paragraph">
862<p>Started the library. Contributed the initial versions of the format flags,
863precision, width, and user-defined format flags saver classes. Contributed the
864initial versions of the success state, success state exception flags, output
865stream tie, stream buffer, character fill, and locale saver class templates.
866Contributed the combined attribute classes and class template. Contributed the
867test file <code>ios_state_test.cpp</code>.</p>
868</div>
869</div>
870</div>
871<div class="sect2">
872<h3 id="history">History</h3>
873<div class="sect3">
874<h4 id="20_dec_2019">20 Dec 2019</h4>
875<div class="paragraph">
876<p>Glen Fernandes made all the saver classes non-copyable.</p>
877</div>
878</div>
879<div class="sect3">
880<h4 id="28_feb_2005">28 Feb 2005</h4>
881<div class="paragraph">
882<p>Daryle Walker added the restore member functions, based on suggestions by
883Gennadiy Rozental and Rob Stewart.</p>
884</div>
885</div>
886<div class="sect3">
887<h4 id="13_mar_2002">13 Mar 2002</h4>
888<div class="paragraph">
889<p>Daryle Walker implemented the initial version.</p>
890</div>
891</div>
892</div>
893</div>
894</div>
895<div class="sect1">
896<h2 id="quoted_manipulators_boostioquoted_hpp">Quoted Manipulators, &lt;boost/io/quoted.hpp&gt;</h2>
897<div class="sectionbody">
898<div class="sect2">
899<h3 id="introduction">Introduction</h3>
900<div class="paragraph">
901<p>C++ Standard library stream I/O for strings that contain embedded spaces can
902produce unexpected results. For example,</p>
903</div>
904<div class="listingblock">
905<div class="content">
906<pre class="highlight"><code class="language-cpp" data-lang="cpp">std::stringstream ss;
907std::string original = "fooled you";
908std::string roundtrip;
909
910ss &lt;&lt; original;
911ss &gt;&gt; roundtrip;
912
913std::cout &lt;&lt; original;   // outputs: fooled you
914std::cout &lt;&lt; roundtrip; // outputs: fooled
915
916assert(original == roundtrip); // assert will fire</code></pre>
917</div>
918</div>
919<div class="paragraph">
920<p>The Boost quoted stream I/O manipulator places delimiters, defaulted to the
921double-quote ("), around strings on output, and strips off the delimiters on
922input. This ensures strings with embedded spaces round-trip as desired. For
923example,</p>
924</div>
925<div class="listingblock">
926<div class="content">
927<pre class="highlight"><code class="language-cpp" data-lang="cpp">std::stringstream ss;
928std::string original = "fooled you";
929std::string roundtrip;
930
931ss &lt;&lt; quoted(original);
932ss &gt;&gt; quoted(roundtrip);
933
934std::cout &lt;&lt; quoted(original); // outputs: "fooled you"
935std::cout &lt;&lt; roundtrip;       // outputs: fooled you
936
937assert(original == roundtrip); // assert will not fire</code></pre>
938</div>
939</div>
940<div class="paragraph">
941<p>If the string contains the delimiter character, on output that character will
942be preceded by an escape character, as will the escape character itself:</p>
943</div>
944<div class="listingblock">
945<div class="content">
946<pre class="highlight"><code class="language-cpp" data-lang="cpp">std::cout &lt;&lt; quoted("'Jack &amp; Jill'", '&amp;', '\''); // outputs: '&amp;'Jack &amp;&amp; Jill&amp;''</code></pre>
947</div>
948</div>
949</div>
950<div class="sect2">
951<h3 id="header_synopsis_2">Header synopsis</h3>
952<div class="listingblock">
953<div class="content">
954<pre class="highlight"><code class="language-cpp" data-lang="cpp">namespace boost {
955namespace io {
956
957template&lt;class Char, class Traits, class Alloc&gt;
958<code>unspecified-type1</code>
959quoted(const std::basic_string&lt;Char, Traits, Alloc&gt;&amp; string,
960       Char escape='\\', Char delim='\"');
961
962template&lt;class Char&gt;
963<code>unspecified-type2</code>
964quoted(const Char* string, Char escape='\\', Char delim='\"');
965
966template&lt;class Char, class Traits, class Alloc&gt;
967<code>unspecified-type3</code>
968quoted(std::basic_string&lt;Char, Traits, Alloc&gt;&amp; string,
969       Char escape='\\', Char delim='\"');
970
971} // io
972} // boost</code></pre>
973</div>
974</div>
975<div class="paragraph">
976<p><strong>unspecified-type1</strong>, <strong>unspecified-type2</strong>, and <strong>unspecified-type3</strong> are
977implementation supplied types with implementation supplied <code>operator&lt;&lt;</code>:</p>
978</div>
979<div class="listingblock">
980<div class="content">
981<pre class="highlight"><code class="language-cpp" data-lang="cpp">template&lt;class Char, class Traits&gt;
982std::basic_ostream&lt;Char, Traits&gt;&amp;
983operator&lt;&lt;(std::basic_ostream&lt;Char, Traits&gt;&amp; os,
984           const <code>unspecified-typeN</code>&amp; proxy);</code></pre>
985</div>
986</div>
987<div class="dlist">
988<dl>
989<dt class="hdlist1">Effects</dt>
990<dd>
991<p>Inserts characters into <code>os</code>:</p>
992<div class="ulist">
993<ul>
994<li>
995<p><code>delim</code></p>
996</li>
997<li>
998<p>Each character in <code>string</code>. If the character to be output is equal to
999<code>escape</code> or <code>delim</code>, as determined by <code>operator==</code>, first output <code>escape</code>.</p>
1000</li>
1001<li>
1002<p><code>delim</code></p>
1003</li>
1004</ul>
1005</div>
1006</dd>
1007<dt class="hdlist1">Remarks</dt>
1008<dd>
1009<p><code>string</code>, <code>escape</code>, and <code>delim</code> have the type and value of the
1010corresponding arguments of the call to the <code>quoted</code> function that constructed
1011<code>proxy</code>.</p>
1012</dd>
1013<dt class="hdlist1">Returns</dt>
1014<dd>
1015<p><code>os</code>.</p>
1016</dd>
1017</dl>
1018</div>
1019<div class="paragraph">
1020<p><strong>unspecified-type3</strong> is an implementation supplied type with an implementation
1021supplied <code>operator&gt;&gt;</code>:</p>
1022</div>
1023<div class="listingblock">
1024<div class="content">
1025<pre class="highlight"><code class="language-cpp" data-lang="cpp">template&lt;class Char, class Traits&gt;
1026std::basic_istream&lt;Char, Traits&gt;&amp;
1027operator&gt;&gt;(std::basic_istream&lt;Char, Traits&gt;&amp; is,
1028           const <code>unspecified-type3</code>&amp; proxy);</code></pre>
1029</div>
1030</div>
1031<div class="dlist">
1032<dl>
1033<dt class="hdlist1">Effects</dt>
1034<dd>
1035<p>Extracts characters from <code>os</code>:</p>
1036<div class="ulist">
1037<ul>
1038<li>
1039<p>If the first character extracted is equal to <code>delim</code>, as determined by
1040<code>operator==</code>, then:</p>
1041<div class="ulist">
1042<ul>
1043<li>
1044<p>Turn off the <code>skipws</code> flag.</p>
1045</li>
1046<li>
1047<p><code>string.clear()</code></p>
1048</li>
1049<li>
1050<p>Until an unescaped <code>delim</code> character is reached or <code>is.not_good()</code>, extract
1051characters from <code>os</code> and append them to string, except that if an escape is
1052reached, ignore it and append the next character to string.</p>
1053</li>
1054<li>
1055<p>Discard the final <code>delim</code> character.</p>
1056</li>
1057<li>
1058<p>Restore the <code>skipws</code> flag to its original value.</p>
1059</li>
1060</ul>
1061</div>
1062</li>
1063<li>
1064<p>Otherwise, <code>os &gt;&gt; string</code>.</p>
1065</li>
1066</ul>
1067</div>
1068</dd>
1069<dt class="hdlist1">Remarks</dt>
1070<dd>
1071<p><code>string</code>, <code>escape</code>, and <code>delim</code> have the type and value of the
1072corresponding arguments of the call to the <code>quoted</code> function that constructed
1073<code>proxy</code>.</p>
1074</dd>
1075<dt class="hdlist1">Returns</dt>
1076<dd>
1077<p><code>is</code>.</p>
1078</dd>
1079</dl>
1080</div>
1081</div>
1082<div class="sect2">
1083<h3 id="acknowledgements">Acknowledgements</h3>
1084<div class="paragraph">
1085<p>The <code>quoted()</code> stream manipulator emerged from discussions on the Boost
1086developers mailing list. Participants included Beman Dawes, Rob Stewart,
1087Alexander Lamaison, Eric Niebler, Vicente Botet, Andrey Semashev,
1088Phil Richards, and Rob Murray. Eric Niebler&#8217;s suggestions provided the basis
1089for the name and form of the templates.</p>
1090</div>
1091<div class="paragraph">
1092<p>Beman Dawes started the implementation of <code>quoted()</code> as a private detail
1093header. Glen Fernandes updated the implementation and also made it public.</p>
1094</div>
1095<div class="paragraph">
1096<p>Glen Fernandes corrected the implementation to properly account for stream
1097width and fill, and optimized it to write directly to the stream buffer.</p>
1098</div>
1099</div>
1100</div>
1101</div>
1102<div class="sect1">
1103<h2 id="delimited_iterators_boostioostream_joiner_hpp">Delimited Iterators, &lt;boost/io/ostream_joiner.hpp&gt;</h2>
1104<div class="sectionbody">
1105<div class="sect2">
1106<h3 id="description_2">Description</h3>
1107<div class="paragraph">
1108<p>The header <code>&lt;boost/io/ostream_joiner.hpp&gt;</code> provides the class template
1109<code>boost::io::ostream_joiner</code> which is an output iterator that writes objects to
1110a <code>std::basic_ostream</code> separated by a delimiter. It is an implementation of
1111the Library Fundamentals TS <code>std::ostream_joiner</code> which supports C&#43;&#43;03 and
1112higher.</p>
1113</div>
1114</div>
1115<div class="sect2">
1116<h3 id="example_2">Example</h3>
1117<div class="paragraph">
1118<p>The following program writes the contents of a vector to standard output, with
1119each element separated by a comma.</p>
1120</div>
1121<div class="listingblock">
1122<div class="content">
1123<pre class="highlight"><code class="language-cpp" data-lang="cpp">#include &lt;boost/io/ostream_joiner.hpp&gt;
1124#include &lt;algorithm&gt;
1125#include &lt;iostream&gt;
1126#include &lt;vector&gt;
1127
1128int main()
1129{
1130    std::vector&lt;int&gt; v;
1131    v.push_back(2);
1132    v.push_back(4);
1133    v.push_back(6);
1134    v.push_back(8);
1135    std::copy(v.begin(), v.end(), boost::make_ostream_joiner(std::cout, ','));
1136}</code></pre>
1137</div>
1138</div>
1139</div>
1140<div class="sect2">
1141<h3 id="reference">Reference</h3>
1142<div class="sect3">
1143<h4 id="header_synopsis_3">Header Synopsis</h4>
1144<div class="listingblock">
1145<div class="content">
1146<pre class="highlight"><code class="language-cpp" data-lang="cpp">namespace boost {
1147namespace io {
1148
1149template&lt;class Delim, class Char = char,
1150    class Traits = std::char_traits&lt;Char&gt; &gt;
1151class ostream_joiner {
1152public:
1153    typedef Char char_type;
1154    typedef Traits traits_type;
1155    typedef std::basic_ostream&lt;Char, Traits&gt; ostream_type;
1156    typedef std::output_iterator_tag iterator_category;
1157    typedef void value_type;
1158    typedef void difference_type;
1159    typedef void pointer;
1160    typedef void reference;
1161
1162    ostream_joiner(ostream_type&amp; output, const Delim&amp; delim);
1163    ostream_joiner(ostream_type&amp; output, Delim&amp;&amp; delim);
1164
1165    template&lt;class T&gt;
1166    ostream_joiner&amp; operator=(const T&amp; value);
1167
1168    ostream_joiner&amp; operator*() noexcept;
1169    ostream_joiner&amp; operator++() noexcept;
1170    ostream_joiner&amp; operator++(int) noexcept;
1171};
1172
1173template&lt;class Char, class Traits, class Delim&gt;
1174ostream_joiner&lt;std::decay_t&lt;Delim&gt;, Char, Traits&gt;
1175make_ostream_joiner(std::basic_ostream&lt;Char, Traits&gt;&amp; output, Delim&amp;&amp; delim);
1176
1177} // io
1178} // boost</code></pre>
1179</div>
1180</div>
1181</div>
1182<div class="sect3">
1183<h4 id="constructors">Constructors</h4>
1184<div class="listingblock">
1185<div class="content">
1186<pre class="highlight"><code class="language-cpp" data-lang="cpp">ostream_joiner(ostream_type&amp; output, const Delim&amp; delim);</code></pre>
1187</div>
1188</div>
1189<div class="dlist specification">
1190<dl>
1191<dt class="hdlist1">EFfects</dt>
1192<dd>
1193<p>Initializes the stored reference to the stream with
1194<code>std::addressof(output)</code> and the stored delimiter with <code>delim</code>.</p>
1195</dd>
1196</dl>
1197</div>
1198<div class="listingblock">
1199<div class="content">
1200<pre class="highlight"><code class="language-cpp" data-lang="cpp">ostream_joiner(ostream_type&amp; output, Delim&amp;&amp; delim);</code></pre>
1201</div>
1202</div>
1203<div class="dlist specification">
1204<dl>
1205<dt class="hdlist1">EFfects</dt>
1206<dd>
1207<p>Initializes the stored reference to the stream with
1208<code>std::addressof(output)</code> and the stored delimiter with <code>std::move(delim)</code>.</p>
1209</dd>
1210</dl>
1211</div>
1212</div>
1213<div class="sect3">
1214<h4 id="member_functions">Member functions</h4>
1215<div class="listingblock">
1216<div class="content">
1217<pre class="highlight"><code class="language-cpp" data-lang="cpp">template&lt;class T&gt;
1218ostream_joiner&amp; operator=(const T&amp; value);</code></pre>
1219</div>
1220</div>
1221<div class="dlist specification">
1222<dl>
1223<dt class="hdlist1">Effects</dt>
1224<dd>
1225<p>If the is the first call to this member function, write the stored
1226delimiter to the stored stream reference. Writes <code>value</code> to the stored stream
1227reference.</p>
1228</dd>
1229<dt class="hdlist1">Returns</dt>
1230<dd>
1231<p><code>*this</code>.</p>
1232</dd>
1233</dl>
1234</div>
1235<div class="listingblock">
1236<div class="content">
1237<pre class="highlight"><code class="language-cpp" data-lang="cpp">ostream_joiner&amp; operator*() noexcept;</code></pre>
1238</div>
1239</div>
1240<div class="listingblock">
1241<div class="content">
1242<pre class="highlight"><code class="language-cpp" data-lang="cpp">ostream_joiner&amp; operator++() noexcept;</code></pre>
1243</div>
1244</div>
1245<div class="listingblock">
1246<div class="content">
1247<pre class="highlight"><code class="language-cpp" data-lang="cpp">ostream_joiner&amp; operator++(int) noexcept;</code></pre>
1248</div>
1249</div>
1250<div class="dlist specification">
1251<dl>
1252<dt class="hdlist1">Returns</dt>
1253<dd>
1254<p><code>*this</code>.</p>
1255</dd>
1256</dl>
1257</div>
1258</div>
1259<div class="sect3">
1260<h4 id="free_functions">Free functions</h4>
1261<div class="listingblock">
1262<div class="content">
1263<pre class="highlight"><code class="language-cpp" data-lang="cpp">template&lt;class Char, class Traits, class Delim&gt;
1264ostream_joiner&lt;decay_t&lt;Delim&gt;, Char, Traits&gt;
1265make_ostream_joiner(std::basic_ostream&lt;Char, Traits&gt;&amp; output, Delim&amp;&amp; delim);</code></pre>
1266</div>
1267</div>
1268<div class="dlist specification">
1269<dl>
1270<dt class="hdlist1">Returns</dt>
1271<dd>
1272<p><code>ostream_joiner&lt;std::decay_t&lt;Delim&gt;, Char, Traits&gt;(output,
1273std::forward&lt;Delim&gt;(delim))</code>.</p>
1274</dd>
1275</dl>
1276</div>
1277</div>
1278</div>
1279<div class="sect2">
1280<h3 id="acknowledgments">Acknowledgments</h3>
1281<div class="paragraph">
1282<p>Glen Fernandes implemented <code>ostream_joiner</code> and <code>make_ostream_joiner</code>.</p>
1283</div>
1284</div>
1285</div>
1286</div>
1287<div class="sect1">
1288<h2 id="insert_formatted_output_boostioostream_put_hpp">Insert Formatted Output, &lt;boost/io/ostream_put.hpp&gt;</h2>
1289<div class="sectionbody">
1290<div class="sect2">
1291<h3 id="description_3">Description</h3>
1292<div class="paragraph">
1293<p>The header <code>&lt;boost/io/ostream_put.hpp&gt;</code> provides the function template
1294<code>boost::io::ostream_put</code> for formatted output that satisfies the requirements
1295of [ostream.formatted.reqmts].</p>
1296</div>
1297</div>
1298<div class="sect2">
1299<h3 id="example_3">Example</h3>
1300<div class="paragraph">
1301<p>The inserter for class template <code>basic_string_view</code> could be implemented as
1302follows:</p>
1303</div>
1304<div class="listingblock">
1305<div class="content">
1306<pre class="highlight"><code class="language-cpp" data-lang="cpp">template&lt;class charT, class traits&gt;
1307std::basic_ostream&lt;charT, traits&gt;&amp;
1308operator&lt;&lt;(std::basic_ostream&lt;charT, traits&gt;&amp; os,
1309    const basic_string_view&lt;charT, traits&gt;&amp; str)
1310{
1311    return boost::io::ostream_put(os, str.data(), str.size());
1312}</code></pre>
1313</div>
1314</div>
1315</div>
1316<div class="sect2">
1317<h3 id="reference_2">Reference</h3>
1318<div class="sect3">
1319<h4 id="header_synopsis_4">Header Synopsis</h4>
1320<div class="listingblock">
1321<div class="content">
1322<pre class="highlight"><code class="language-cpp" data-lang="cpp">namespace boost {
1323namespace io {
1324
1325template&lt;class charT, class traits&gt;
1326std::basic_ostream&lt;charT, traits&gt;&amp;
1327ostream_put(std::basic_ostream&lt;charT, traits&gt;&amp; os,
1328    const charT* data, std::size_t size);
1329
1330} // io
1331} // boost</code></pre>
1332</div>
1333</div>
1334</div>
1335<div class="sect3">
1336<h4 id="free_functions_2">Free functions</h4>
1337<div class="listingblock">
1338<div class="content">
1339<pre class="highlight"><code class="language-cpp" data-lang="cpp">template&lt;class charT, class traits&gt;
1340std::basic_ostream&lt;charT, traits&gt;&amp;
1341ostream_put(std::basic_ostream&lt;charT, traits&gt;&amp; os,
1342    const charT* data, std::size_t size);</code></pre>
1343</div>
1344</div>
1345<div class="dlist specification">
1346<dl>
1347<dt class="hdlist1">Effects</dt>
1348<dd>
1349<p>Behaves like a formatted inserter (as described in
1350[ostream.formatted.reqmts]) of <code>os</code>. Creates a character sequence <code>seq</code> of size
1351characters starting at <code>data</code>, each widened using <code>os.widen()</code>
1352([basic.ios.members]). Determines padding for <code>seq</code> as described in
1353[ostream.formatted.reqmts]. Inserts <code>seq</code> into <code>os</code>. Calls <code>width(0)</code>.</p>
1354</dd>
1355<dt class="hdlist1">Returns</dt>
1356<dd>
1357<p><code>os</code>.</p>
1358</dd>
1359</dl>
1360</div>
1361</div>
1362</div>
1363<div class="sect2">
1364<h3 id="acknowledgments_2">Acknowledgments</h3>
1365<div class="paragraph">
1366<p>Glen Fernandes updated the implementation of the <code>basic_string_ref</code> and
1367<code>basic_string_view</code> stream insertion operators to write directly to the
1368<code>basic_streambuf</code> and refactored that functionality into this common utility.</p>
1369</div>
1370</div>
1371</div>
1372</div>
1373<div class="sect1">
1374<h2 id="copyright_and_license">Copyright and License</h2>
1375<div class="sectionbody">
1376<div class="ulist">
1377<ul>
1378<li>
1379<p>Copyright 2002 Daryle Walker</p>
1380</li>
1381<li>
1382<p>Copyright 2002, 2006, 2007, 2009, 2010 Beman Dawes</p>
1383</li>
1384<li>
1385<p>Copyright 2019 Glen Joseph Fernandes</p>
1386</li>
1387</ul>
1388</div>
1389<div class="paragraph">
1390<p>Distributed under the
1391<a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</p>
1392</div>
1393</div>
1394</div>
1395</div>
1396<div id="footer">
1397<div id="footer-text">
1398Last updated 2020-08-11 14:56:17 UTC
1399</div>
1400</div>
1401<style>
1402.specification {
1403margin-left: 2em;
1404}
1405</style>
1406</body>
1407</html>