<!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="mobile-web-app-capable" content="yes">
    <title>
        static_vector
    </title>

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css" integrity="sha256-3iu9jgsy9TpTwXKb7bNQzqWekRX7pPK+2OLj3R922fo=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css" integrity="sha256-QiWfLIsCT02Sdwkogf6YMiQlj4NE84MKkzEMkZnMGdg=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/themes/prism.min.css" integrity="sha256-vtR0hSWRc3Tb26iuN2oZHt3KRUomwTufNIf5/4oeCyg=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@hackmd/emojify.js@2.1.0/dist/css/basic/emojify.min.css" integrity="sha256-UOrvMOsSDSrW6szVLe8ZDZezBxh5IoIfgTwdNDgTjiU=" crossorigin="anonymous" />
    <style>
        @import url(https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i|Source+Code+Pro:300,400,500|Source+Sans+Pro:300,300i,400,400i,600,600i|Source+Serif+Pro&subset=latin-ext);.hljs{background:#fff;color:#333;display:block;overflow-x:auto;padding:.5em}.hljs-comment,.hljs-meta{color:#969896}.hljs-emphasis,.hljs-quote,.hljs-string,.hljs-strong,.hljs-template-variable,.hljs-variable{color:#df5000}.hljs-keyword,.hljs-selector-tag,.hljs-type{color:#a71d5d}.hljs-attribute,.hljs-bullet,.hljs-literal,.hljs-number,.hljs-symbol{color:#0086b3}.hljs-built_in,.hljs-builtin-name{color:#005cc5}.hljs-name,.hljs-section{color:#63a35c}.hljs-tag{color:#333}.hljs-attr,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-selector-pseudo,.hljs-title{color:#795da3}.hljs-addition{background-color:#eaffea;color:#55a532}.hljs-deletion{background-color:#ffecec;color:#bd2c00}.hljs-link{text-decoration:underline}.markdown-body{word-wrap:break-word;font-size:16px;line-height:1.5}.markdown-body:after,.markdown-body:before{content:"";display:table}.markdown-body:after{clear:both}.markdown-body>:first-child{margin-top:0!important}.markdown-body>:last-child{margin-bottom:0!important}.markdown-body a:not([href]){color:inherit;text-decoration:none}.markdown-body .absent{color:#c00}.markdown-body .anchor{float:left;line-height:1;margin-left:-20px;padding-right:4px}.markdown-body .anchor:focus{outline:none}.markdown-body blockquote,.markdown-body dl,.markdown-body ol,.markdown-body p,.markdown-body pre,.markdown-body table,.markdown-body ul{margin-bottom:16px;margin-top:0}.markdown-body hr{background-color:#e7e7e7;border:0;height:.25em;margin:24px 0;padding:0}.markdown-body blockquote{border-left:.25em solid #ddd;color:#777;font-size:16px;padding:0 1em}.markdown-body blockquote>:first-child{margin-top:0}.markdown-body blockquote>:last-child{margin-bottom:0}.markdown-body kbd,.popover kbd{background-color:#fcfcfc;border:1px solid;border-color:#ccc #ccc #bbb;border-radius:3px;box-shadow:inset 0 -1px 0 #bbb;color:#555;display:inline-block;font-size:11px;line-height:10px;padding:3px 5px;vertical-align:middle}.markdown-body .loweralpha{list-style-type:lower-alpha}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{font-weight:600;line-height:1.25;margin-bottom:16px;margin-top:24px}.markdown-body h1 .octicon-link,.markdown-body h2 .octicon-link,.markdown-body h3 .octicon-link,.markdown-body h4 .octicon-link,.markdown-body h5 .octicon-link,.markdown-body h6 .octicon-link{color:#000;vertical-align:middle;visibility:hidden}.markdown-body h1:hover .anchor,.markdown-body h2:hover .anchor,.markdown-body h3:hover .anchor,.markdown-body h4:hover .anchor,.markdown-body h5:hover .anchor,.markdown-body h6:hover .anchor{text-decoration:none}.markdown-body h1:hover .anchor .octicon-link,.markdown-body h2:hover .anchor .octicon-link,.markdown-body h3:hover .anchor .octicon-link,.markdown-body h4:hover .anchor .octicon-link,.markdown-body h5:hover .anchor .octicon-link,.markdown-body h6:hover .anchor .octicon-link{visibility:visible}.markdown-body h1 code,.markdown-body h1 tt,.markdown-body h2 code,.markdown-body h2 tt,.markdown-body h3 code,.markdown-body h3 tt,.markdown-body h4 code,.markdown-body h4 tt,.markdown-body h5 code,.markdown-body h5 tt,.markdown-body h6 code,.markdown-body h6 tt{font-size:inherit}.markdown-body h1{font-size:2em}.markdown-body h1,.markdown-body h2{border-bottom:1px solid #eee;padding-bottom:.3em}.markdown-body h2{font-size:1.5em}.markdown-body h3{font-size:1.25em}.markdown-body h4{font-size:1em}.markdown-body h5{font-size:.875em}.markdown-body h6{color:#777;font-size:.85em}.markdown-body ol,.markdown-body ul{padding-left:2em}.markdown-body ol.no-list,.markdown-body ul.no-list{list-style-type:none;padding:0}.markdown-body ol ol,.markdown-body ol ul,.markdown-body ul ol,.markdown-body ul ul{margin-bottom:0;margin-top:0}.markdown-body li>p{margin-top:16px}.markdown-body li+li{padding-top:.25em}.markdown-body dl{padding:0}.markdown-body dl dt{font-size:1em;font-style:italic;font-weight:700;margin-top:16px;padding:0}.markdown-body dl dd{margin-bottom:16px;padding:0 16px}.markdown-body table{display:block;overflow:auto;width:100%;word-break:normal;word-break:keep-all}.markdown-body table th{font-weight:700}.markdown-body table td,.markdown-body table th{border:1px solid #ddd;padding:6px 13px}.markdown-body table tr{background-color:#fff;border-top:1px solid #ccc}.markdown-body table tr:nth-child(2n){background-color:#f8f8f8}.markdown-body img{background-color:#fff;box-sizing:initial;max-width:100%}.markdown-body img[align=right]{padding-left:20px}.markdown-body img[align=left]{padding-right:20px}.markdown-body .emoji{background-color:initial;max-width:none;vertical-align:text-top}.markdown-body span.frame{display:block;overflow:hidden}.markdown-body span.frame>span{border:1px solid #ddd;display:block;float:left;margin:13px 0 0;overflow:hidden;padding:7px;width:auto}.markdown-body span.frame span img{display:block;float:left}.markdown-body span.frame span span{clear:both;color:#333;display:block;padding:5px 0 0}.markdown-body span.align-center{clear:both;display:block;overflow:hidden}.markdown-body span.align-center>span{display:block;margin:13px auto 0;overflow:hidden;text-align:center}.markdown-body span.align-center span img{margin:0 auto;text-align:center}.markdown-body span.align-right{clear:both;display:block;overflow:hidden}.markdown-body span.align-right>span{display:block;margin:13px 0 0;overflow:hidden;text-align:right}.markdown-body span.align-right span img{margin:0;text-align:right}.markdown-body span.float-left{display:block;float:left;margin-right:13px;overflow:hidden}.markdown-body span.float-left span{margin:13px 0 0}.markdown-body span.float-right{display:block;float:right;margin-left:13px;overflow:hidden}.markdown-body span.float-right>span{display:block;margin:13px auto 0;overflow:hidden;text-align:right}.markdown-body code,.markdown-body tt{background-color:#0000000a;border-radius:3px;font-size:85%;margin:0;padding:.2em 0}.markdown-body code:after,.markdown-body code:before,.markdown-body tt:after,.markdown-body tt:before{content:"\00a0";letter-spacing:-.2em}.markdown-body code br,.markdown-body tt br{display:none}.markdown-body del code{text-decoration:inherit}.markdown-body pre{word-wrap:normal}.markdown-body pre>code{background:#0000;border:0;font-size:100%;margin:0;padding:0;white-space:pre;word-break:normal}.markdown-body .highlight{margin-bottom:16px}.markdown-body .highlight pre{margin-bottom:0;word-break:normal}.markdown-body .highlight pre,.markdown-body pre{background-color:#f7f7f7;border-radius:3px;font-size:85%;line-height:1.45;overflow:auto;padding:16px}.markdown-body pre code,.markdown-body pre tt{word-wrap:normal;background-color:initial;border:0;display:inline;line-height:inherit;margin:0;max-width:auto;overflow:visible;padding:0}.markdown-body pre code:after,.markdown-body pre code:before,.markdown-body pre tt:after,.markdown-body pre tt:before{content:normal}.markdown-body .csv-data td,.markdown-body .csv-data th{font-size:12px;line-height:1;overflow:hidden;padding:5px;text-align:left;white-space:nowrap}.markdown-body .csv-data .blob-line-num{background:#fff;border:0;padding:10px 8px 9px;text-align:right}.markdown-body .csv-data tr{border-top:0}.markdown-body .csv-data th{background:#f8f8f8;border-top:0;font-weight:700}.news .alert .markdown-body blockquote{border:0;padding:0 0 0 40px}.activity-tab .news .alert .commits,.activity-tab .news .markdown-body blockquote{padding-left:0}.task-list-item{list-style-type:none}.task-list-item label{font-weight:400}.task-list-item.enabled label{cursor:pointer}.task-list-item+.task-list-item{margin-top:3px}.task-list-item-checkbox{cursor:default!important;float:left;margin:.31em 0 .2em -1.3em!important;vertical-align:middle}.markdown-body{max-width:758px;overflow:visible!important;padding-bottom:40px;padding-top:40px;position:relative}.markdown-body.next-editor{overflow-x:hidden!important}.markdown-body .emoji{vertical-align:top}.markdown-body pre{border:inherit!important}.markdown-body code{color:inherit!important}.markdown-body pre code .wrapper{display:-moz-inline-flex;display:-ms-inline-flex;display:-o-inline-flex;display:inline-flex}.markdown-body pre code .gutter{float:left;overflow:hidden;-webkit-user-select:none;user-select:none}.markdown-body pre code .gutter.linenumber{border-right:3px solid #6ce26c!important;box-sizing:initial;color:#afafaf!important;cursor:default;display:inline-block;min-width:20px;padding:0 8px 0 0;position:relative;text-align:right;z-index:4}.markdown-body pre code .gutter.linenumber>span:before{content:attr(data-linenumber)}.markdown-body pre code .code{float:left;margin:0 0 0 16px}.markdown-body .gist .line-numbers{border-bottom:none;border-left:none;border-top:none}.markdown-body .gist .line-data{border:none}.markdown-body .gist table{border-collapse:inherit!important;border-spacing:0}.markdown-body code[data-gist-id]{background:none;padding:0}.markdown-body code[data-gist-id]:after,.markdown-body code[data-gist-id]:before{content:""}.markdown-body code[data-gist-id] .blob-num{border:unset}.markdown-body code[data-gist-id] table{margin-bottom:unset;overflow:unset}.markdown-body code[data-gist-id] table tr{background:unset}.markdown-body[dir=rtl] pre{direction:ltr}.markdown-body[dir=rtl] code{direction:ltr;unicode-bidi:embed}.markdown-body .alert>p:last-child{margin-bottom:0}.markdown-body pre.abc,.markdown-body pre.flow-chart,.markdown-body pre.graphviz,.markdown-body pre.mermaid,.markdown-body pre.sequence-diagram,.markdown-body pre.vega{background-color:inherit;border-radius:0;overflow:visible;text-align:center;white-space:inherit}.markdown-body pre.abc>code,.markdown-body pre.flow-chart>code,.markdown-body pre.graphviz>code,.markdown-body pre.mermaid>code,.markdown-body pre.sequence-diagram>code,.markdown-body pre.vega>code{text-align:left}.markdown-body pre.abc>svg,.markdown-body pre.flow-chart>svg,.markdown-body pre.graphviz>svg,.markdown-body pre.mermaid>svg,.markdown-body pre.sequence-diagram>svg,.markdown-body pre.vega>svg{height:100%;max-width:100%}.markdown-body pre>code.wrap{word-wrap:break-word;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap}.markdown-body .alert>p:last-child,.markdown-body .alert>ul:last-child{margin-bottom:0}.markdown-body summary{display:list-item}.markdown-body summary:focus{outline:none}.markdown-body details summary{cursor:pointer}.markdown-body details:not([open])>:not(summary){display:none}.markdown-body figure{margin:1em 40px}.markdown-body .mark,.markdown-body mark{background-color:#fff1a7}.vimeo,.youtube{background-color:#000;background-position:50%;background-repeat:no-repeat;background-size:contain;cursor:pointer;display:table;overflow:hidden;text-align:center}.vimeo,.youtube{position:relative;width:100%}.youtube{padding-bottom:56.25%}.vimeo img{object-fit:contain;width:100%;z-index:0}.youtube img{object-fit:cover;z-index:0}.vimeo iframe,.youtube iframe,.youtube img{height:100%;left:0;position:absolute;top:0;width:100%}.vimeo iframe,.youtube iframe{vertical-align:middle;z-index:1}.vimeo .icon,.youtube .icon{color:#fff;height:auto;left:50%;opacity:.3;position:absolute;top:50%;transform:translate(-50%,-50%);transition:opacity .2s;width:auto;z-index:0}.vimeo:hover .icon,.youtube:hover .icon{opacity:.6;transition:opacity .2s}.slideshare .inner,.speakerdeck .inner{position:relative;width:100%}.slideshare .inner iframe,.speakerdeck .inner iframe{bottom:0;height:100%;left:0;position:absolute;right:0;top:0;width:100%}.figma{display:table;padding-bottom:56.25%;position:relative;width:100%}.figma iframe{border:1px solid #eee;bottom:0;height:100%;left:0;position:absolute;right:0;top:0;width:100%}.markmap-container{height:300px}.markmap-container>svg{height:100%;width:100%}.MJX_Assistive_MathML{display:none}#MathJax_Message{z-index:1000!important}.ui-infobar{color:#777;margin:25px auto -25px;max-width:760px;position:relative;z-index:2}.toc .invisable-node{list-style-type:none}.ui-toc{bottom:20px;position:fixed;z-index:998}.ui-toc.both-mode{margin-left:8px}.ui-toc.both-mode .ui-toc-label{border-bottom-left-radius:0;border-top-left-radius:0;height:40px;padding:10px 4px}.ui-toc-label{background-color:#e6e6e6;border:none;color:#868686;transition:opacity .2s}.ui-toc .open .ui-toc-label{color:#fff;opacity:1;transition:opacity .2s}.ui-toc-label:focus{background-color:#ccc;color:#000;opacity:.3}.ui-toc-label:hover{background-color:#ccc;opacity:1;transition:opacity .2s}.ui-toc-dropdown{margin-bottom:20px;margin-top:20px;max-height:70vh;max-width:45vw;overflow:auto;padding-left:10px;padding-right:10px;text-align:inherit;width:25vw}.ui-toc-dropdown>.toc{max-height:calc(70vh - 100px);overflow:auto}.ui-toc-dropdown[dir=rtl] .nav{letter-spacing:.0029em;padding-right:0}.ui-toc-dropdown a{overflow:hidden;text-overflow:ellipsis;white-space:pre}.ui-toc-dropdown .nav>li>a{color:#767676;display:block;font-size:13px;font-weight:500;padding:4px 20px}.ui-toc-dropdown .nav>li:first-child:last-child>ul,.ui-toc-dropdown .toc.expand ul{display:block}.ui-toc-dropdown .nav>li>a:focus,.ui-toc-dropdown .nav>li>a:hover{background-color:initial;border-left:1px solid #000;color:#000;padding-left:19px;text-decoration:none}.ui-toc-dropdown[dir=rtl] .nav>li>a:focus,.ui-toc-dropdown[dir=rtl] .nav>li>a:hover{border-left:none;border-right:1px solid #000;padding-right:19px}.ui-toc-dropdown .nav>.active:focus>a,.ui-toc-dropdown .nav>.active:hover>a,.ui-toc-dropdown .nav>.active>a{background-color:initial;border-left:2px solid #000;color:#000;font-weight:700;padding-left:18px}.ui-toc-dropdown[dir=rtl] .nav>.active:focus>a,.ui-toc-dropdown[dir=rtl] .nav>.active:hover>a,.ui-toc-dropdown[dir=rtl] .nav>.active>a{border-left:none;border-right:2px solid #000;padding-right:18px}.ui-toc-dropdown .nav .nav{display:none;padding-bottom:10px}.ui-toc-dropdown .nav>.active>ul{display:block}.ui-toc-dropdown .nav .nav>li>a{font-size:12px;font-weight:400;padding-bottom:1px;padding-left:30px;padding-top:1px}.ui-toc-dropdown[dir=rtl] .nav .nav>li>a{padding-right:30px}.ui-toc-dropdown .nav .nav>li>ul>li>a{font-size:12px;font-weight:400;padding-bottom:1px;padding-left:40px;padding-top:1px}.ui-toc-dropdown[dir=rtl] .nav .nav>li>ul>li>a{padding-right:40px}.ui-toc-dropdown .nav .nav>li>a:focus,.ui-toc-dropdown .nav .nav>li>a:hover{padding-left:29px}.ui-toc-dropdown[dir=rtl] .nav .nav>li>a:focus,.ui-toc-dropdown[dir=rtl] .nav .nav>li>a:hover{padding-right:29px}.ui-toc-dropdown .nav .nav>li>ul>li>a:focus,.ui-toc-dropdown .nav .nav>li>ul>li>a:hover{padding-left:39px}.ui-toc-dropdown[dir=rtl] .nav .nav>li>ul>li>a:focus,.ui-toc-dropdown[dir=rtl] .nav .nav>li>ul>li>a:hover{padding-right:39px}.ui-toc-dropdown .nav .nav>.active:focus>a,.ui-toc-dropdown .nav .nav>.active:hover>a,.ui-toc-dropdown .nav .nav>.active>a{font-weight:500;padding-left:28px}.ui-toc-dropdown[dir=rtl] .nav .nav>.active:focus>a,.ui-toc-dropdown[dir=rtl] .nav .nav>.active:hover>a,.ui-toc-dropdown[dir=rtl] .nav .nav>.active>a{padding-right:28px}.ui-toc-dropdown .nav .nav>.active>.nav>.active:focus>a,.ui-toc-dropdown .nav .nav>.active>.nav>.active:hover>a,.ui-toc-dropdown .nav .nav>.active>.nav>.active>a{font-weight:500;padding-left:38px}.ui-toc-dropdown[dir=rtl] .nav .nav>.active>.nav>.active:focus>a,.ui-toc-dropdown[dir=rtl] .nav .nav>.active>.nav>.active:hover>a,.ui-toc-dropdown[dir=rtl] .nav .nav>.active>.nav>.active>a{padding-right:38px}.markdown-body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}html[lang^=ja] .markdown-body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,Hiragino Kaku Gothic Pro,ヒラギノ角ゴ Pro W3,Osaka,Meiryo,メイリオ,MS Gothic,ＭＳ ゴシック,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}html[lang=zh-tw] .markdown-body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,PingFang TC,Microsoft JhengHei,微軟正黑,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}html[lang=zh-cn] .markdown-body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,PingFang SC,Microsoft YaHei,微软雅黑,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}html .markdown-body[lang^=ja]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,Hiragino Kaku Gothic Pro,ヒラギノ角ゴ Pro W3,Osaka,Meiryo,メイリオ,MS Gothic,ＭＳ ゴシック,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}html .markdown-body[lang=zh-tw]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,PingFang TC,Microsoft JhengHei,微軟正黑,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}html .markdown-body[lang=zh-cn]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,PingFang SC,Microsoft YaHei,微软雅黑,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}html[lang^=ja] .ui-toc-dropdown{font-family:Source Sans Pro,Helvetica,Arial,Meiryo UI,MS PGothic,ＭＳ Ｐゴシック,sans-serif}html[lang=zh-tw] .ui-toc-dropdown{font-family:Source Sans Pro,Helvetica,Arial,Microsoft JhengHei UI,微軟正黑UI,sans-serif}html[lang=zh-cn] .ui-toc-dropdown{font-family:Source Sans Pro,Helvetica,Arial,Microsoft YaHei UI,微软雅黑UI,sans-serif}html .ui-toc-dropdown[lang^=ja]{font-family:Source Sans Pro,Helvetica,Arial,Meiryo UI,MS PGothic,ＭＳ Ｐゴシック,sans-serif}html .ui-toc-dropdown[lang=zh-tw]{font-family:Source Sans Pro,Helvetica,Arial,Microsoft JhengHei UI,微軟正黑UI,sans-serif}html .ui-toc-dropdown[lang=zh-cn]{font-family:Source Sans Pro,Helvetica,Arial,Microsoft YaHei UI,微软雅黑UI,sans-serif}.ui-affix-toc{max-height:70vh;max-width:15vw;overflow:auto;position:fixed;top:0}.back-to-top,.expand-toggle,.go-to-bottom{color:#999;display:block;font-size:12px;font-weight:500;margin-left:10px;margin-top:10px;padding:4px 10px}.back-to-top:focus,.back-to-top:hover,.expand-toggle:focus,.expand-toggle:hover,.go-to-bottom:focus,.go-to-bottom:hover{color:#563d7c;text-decoration:none}.back-to-top,.go-to-bottom{margin-top:0}.ui-user-icon{background-position:50%;background-repeat:no-repeat;background-size:cover;border-radius:50%;display:block;height:20px;margin-bottom:2px;margin-right:5px;margin-top:2px;width:20px}.ui-user-icon.small{display:inline-block;height:18px;margin:0 0 .2em;vertical-align:middle;width:18px}.ui-infobar>small>span{line-height:22px}.ui-infobar>small .dropdown{display:inline-block}.ui-infobar>small .dropdown a:focus,.ui-infobar>small .dropdown a:hover{text-decoration:none}.ui-more-info{color:#888;cursor:pointer;vertical-align:middle}.ui-more-info .fa{font-size:16px}.ui-connectedGithub,.ui-published-note{color:#888}.ui-connectedGithub{line-height:23px;white-space:nowrap}.ui-connectedGithub a.file-path{color:#888;padding-left:22px;text-decoration:none}.ui-connectedGithub a.file-path:active,.ui-connectedGithub a.file-path:hover{color:#888;text-decoration:underline}.ui-connectedGithub .fa{font-size:20px}.ui-published-note .fa{font-size:20px;vertical-align:top}.unselectable{-webkit-user-select:none;-o-user-select:none;user-select:none}.selectable{-webkit-user-select:text;-o-user-select:text;user-select:text}.inline-spoiler-section{cursor:pointer}.inline-spoiler-section .spoiler-text{background-color:#333;border-radius:2px}.inline-spoiler-section .spoiler-text>*{opacity:0}.inline-spoiler-section .spoiler-img{filter:blur(10px)}.inline-spoiler-section.raw{background-color:#333;border-radius:2px}.inline-spoiler-section.raw>*{opacity:0}.inline-spoiler-section.unveil{cursor:auto}.inline-spoiler-section.unveil .spoiler-text{background-color:#3333331a}.inline-spoiler-section.unveil .spoiler-text>*{opacity:1}.inline-spoiler-section.unveil .spoiler-img{filter:none}@media print{blockquote,div,img,pre,table{page-break-inside:avoid!important}a[href]:after{font-size:12px!important}}.markdown-body.slides{color:#222;position:relative;z-index:1}.markdown-body.slides:before{background-color:currentColor;bottom:0;box-shadow:0 0 0 50vw;content:"";display:block;left:0;position:absolute;right:0;top:0;z-index:-1}.markdown-body.slides section[data-markdown]{background-color:#fff;margin-bottom:1.5em;position:relative;text-align:center}.markdown-body.slides section[data-markdown] code{text-align:left}.markdown-body.slides section[data-markdown]:before{content:"";display:block;padding-bottom:56.23%}.markdown-body.slides section[data-markdown]>div:first-child{left:1em;max-height:100%;overflow:hidden;position:absolute;right:1em;top:50%;transform:translateY(-50%)}.markdown-body.slides section[data-markdown]>ul{display:inline-block}.markdown-body.slides>section>section+section:after{border:3px solid #777;content:"";height:1.5em;position:absolute;right:1em;top:-1.5em}.site-ui-font{font-family:Source Sans Pro,Helvetica,Arial,sans-serif}html[lang^=ja] .site-ui-font{font-family:Source Sans Pro,Helvetica,Arial,Hiragino Kaku Gothic Pro,ヒラギノ角ゴ Pro W3,Osaka,Meiryo,メイリオ,MS Gothic,ＭＳ ゴシック,sans-serif}html[lang=zh-tw] .site-ui-font{font-family:Source Sans Pro,Helvetica,Arial,PingFang TC,Microsoft JhengHei,微軟正黑,sans-serif}html[lang=zh-cn] .site-ui-font{font-family:Source Sans Pro,Helvetica,Arial,PingFang SC,Microsoft YaHei,微软雅黑,sans-serif}body{font-smoothing:subpixel-antialiased!important;-webkit-font-smoothing:subpixel-antialiased!important;-moz-osx-font-smoothing:auto!important;-webkit-overflow-scrolling:touch;font-family:Source Sans Pro,Helvetica,Arial,sans-serif;letter-spacing:.025em}html[lang^=ja] body{font-family:Source Sans Pro,Helvetica,Arial,Hiragino Kaku Gothic Pro,ヒラギノ角ゴ Pro W3,Osaka,Meiryo,メイリオ,MS Gothic,ＭＳ ゴシック,sans-serif}html[lang=zh-tw] body{font-family:Source Sans Pro,Helvetica,Arial,PingFang TC,Microsoft JhengHei,微軟正黑,sans-serif}html[lang=zh-cn] body{font-family:Source Sans Pro,Helvetica,Arial,PingFang SC,Microsoft YaHei,微软雅黑,sans-serif}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}abbr[data-original-title],abbr[title]{cursor:help}body.modal-open{overflow-y:auto;padding-right:0!important}svg{text-shadow:none}
    </style>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    	<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js" integrity="sha256-3Jy/GbSLrg0o9y5Z5n1uw0qxZECH7C6OQpVBgNFYa0g=" crossorigin="anonymous"></script>
    	<script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js" integrity="sha256-g6iAfvZp+nDQ2TdTR/VVKJf3bGro4ub5fvWSWVRi2NE=" crossorigin="anonymous"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.9/es5-shim.min.js" integrity="sha256-8E4Is26QH0bD52WoQpcB+R/tcWQtpzlCojrybUd7Mxo=" crossorigin="anonymous"></script>
    <![endif]-->
</head>

<body>
    <div id="doc" class="markdown-body container-fluid comment-inner comment-enabled" data-hard-breaks="true" style=""><h1 id="static_vector" data-id="static_vector" style=""><a class="anchor hidden-xs" href="#static_vector" title="static_vector"><span class="octicon octicon-link"></span></a><code>static_vector</code></h1><blockquote>
<p><span>A dynamically-resizable vector with fixed capacity and embedded storage</span></p>
</blockquote><p><strong><span>Document number</span></strong><span>: P0843r6.</span><br>
<strong><span>Date</span></strong><span>: 2023-05-18.</span><br>
<strong><span>Authors</span></strong><span>: Gonzalo Brito Gadeschi, Timur Doumler.</span><br>
<strong><span>Reply to</span></strong><span>: Timur Doumler &lt;papers _at_ timur.audio&gt;.</span><br>
<strong><span>Audience</span></strong><span>: LEWG.</span></p><style>
ins {
    color:green; 
    background-color:yellow;
    text-decoration:underline;
}
del { 
    color:red;
    background-color:yellow;
    text-decoration:line-through;
}
.markdown-body { 
    max-width: 900px; 
    text-align: justify;
}
</style><p><big><span>Table of Contents</span></big></p><p><span class="toc"><ul>
<li><a href="#static_vector" title="static_vector">static_vector</a></li>
<li><a href="#Introduction" title="Introduction">Introduction</a></li>
<li><a href="#Motivation-and-Scope" title="Motivation and Scope">Motivation and Scope</a></li>
<li><a href="#Existing-practice" title="Existing practice">Existing practice</a></li>
<li><a href="#Design" title="Design">Design</a><ul>
<li><a href="#Layout" title="Layout">Layout</a></li>
<li><a href="#Move-semantics" title="Move semantics">Move semantics</a></li>
<li><a href="#constexpr-support" title="constexpr support">constexpr support</a></li>
<li><a href="#Exception-Safety" title="Exception Safety">Exception Safety</a></li>
<li><a href="#Iterator-invalidation" title="Iterator invalidation">Iterator invalidation</a></li>
</ul>
</li>
<li><a href="#Naming" title="Naming">Naming</a></li>
<li><a href="#Technical-specification" title="Technical specification">Technical specification</a><ul>
<li><a href="#libraryrequirementsorganizationheaders" title="[library.requirements.organization.headers]">[library.requirements.organization.headers]</a></li>
<li><a href="#libraryrequirementsorganizationcompliance" title="[library.requirements.organization.compliance]">[library.requirements.organization.compliance]</a></li>
<li><a href="#containerreqmts-General-container-requirements" title="[container.reqmts] General container requirements">[container.reqmts] General container requirements</a></li>
<li><a href="#containerrequirementssequencereqmts" title="[container.requirements.sequence.reqmts]">[container.requirements.sequence.reqmts]</a></li>
<li><a href="#containerssequencesstatic_vectorsyn-Header-ltstatic_vectorgt-synopsis" title="[containers.sequences.static_vector.syn] Header <static_vector> synopsis">[containers.sequences.static_vector.syn] Header &lt;static_vector&gt; synopsis</a></li>
<li><a href="#containerssequencesstatic_vector-Class-template-static_vector" title="[containers.sequences.static_vector] Class template static_vector">[containers.sequences.static_vector] Class template static_vector</a><ul>
<li><a href="#containerssequencesstatic_vectoroverview-Overview" title="[containers.sequences.static_vector.overview] Overview`">[containers.sequences.static_vector.overview] Overview`</a></li>
<li><a href="#-containerssequencesstatic_vectorcons-Constructors-copy-and-assignment" title=" [containers.sequences.static_vector.cons] Constructors, copy, and assignment"> [containers.sequences.static_vector.cons] Constructors, copy, and assignment</a></li>
<li><a href="#-containerssequencesstatic_vectordestructor-Destruction" title=" [containers.sequences.static_vector.destructor] Destruction"> [containers.sequences.static_vector.destructor] Destruction</a></li>
<li><a href="#-containerssequencesstatic_vectorcapacity-Size-and-capacity" title=" [containers.sequences.static_vector.capacity] Size and capacity"> [containers.sequences.static_vector.capacity] Size and capacity</a></li>
<li><a href="#-containerssequencesstatic_vectordata" title=" [containers.sequences.static_vector.data]"> [containers.sequences.static_vector.data]</a></li>
<li><a href="#-containerssequencesstatic_vectormodifiers" title=" [containers.sequences.static_vector.modifiers]"> [containers.sequences.static_vector.modifiers]</a></li>
<li><a href="#-containerssequencesstatic_vectorerasure-Erasure" title=" [containers.sequences.static_vector.erasure] Erasure"> [containers.sequences.static_vector.erasure] Erasure</a></li>
<li><a href="#-containerssequencesstatic_vectorspecial-Specialized-algorithms" title=" [containers.sequences.static_vector.special] Specialized algorithms"> [containers.sequences.static_vector.special] Specialized algorithms</a></li>
<li><a href="#TODOS" title="TODOS:">TODOS:</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#Acknowledgments" title="Acknowledgments">Acknowledgments</a></li>
<li><a href="#References" title="References">References</a></li>
</ul>
</span></p><p><strong><big><span>Changelog</span></big></strong></p><ul>
<li><strong><span>Revision 6</span></strong><span>: for Varna 2023 following Kona’s 2022 guidance</span>
<ul>
<li><span>Updated push_back semantics to follow std::vector (note about exception to throw).</span></li>
<li><span>Added </span><code>try_push_back</code><span> returning an </span><code>optional</code></li>
<li><span>Added </span><code>push_back_unchecked</code><span>: excedding capacity exhibits undefined behavior.</span></li>
<li><span>Added note about naming.</span></li>
</ul>
</li>
<li><strong><span>Revision 5</span></strong><span>:</span>
<ul>
<li><span>Update contact wording and contact data.</span></li>
<li><span>Removed naming discussion, since it was resolved (last available in </span><a href="https://wg21.link.p0843r4" target="_blank" rel="noopener"><span>P0843r4</span></a><span>).</span></li>
<li><span>Removed future extensions discussion (last available in </span><a href="https://wg21.link.p0843r4" target="_blank" rel="noopener"><span>P0843r4</span></a><span>).</span></li>
<li><span>Addressed LEWG feedback regarding move-semantics and exception-safety.</span></li>
</ul>
</li>
<li><strong><span>Revision 4</span></strong><span>:</span>
<ul>
<li><span>LEWG suggested that push_back should be UB when the capacity is exceeded</span></li>
<li><span>LEWG suggested that this should be a free-standing header</span></li>
</ul>
</li>
<li><strong><span>Revision 3</span></strong><span>:</span>
<ul>
<li><span>Include LWG design questions for LEWG.</span></li>
<li><span>Incorporates LWG feedback.</span></li>
</ul>
</li>
<li><strong><span>Revision 2</span></strong>
<ul>
<li><span>Replace the placeholder name </span><code>fixed_capacity_vector</code><span> with </span><code>static_vector</code></li>
<li><span>Remove at checked element access member function.</span></li>
<li><span>Add changelog section.</span></li>
</ul>
</li>
<li><strong><span>Revision 1</span></strong>
<ul>
<li><span>Minor style changes and bugfixes.</span></li>
</ul>
</li>
</ul><p><strong><big><span>Unresolved questions</span></big></strong></p><ol>
<li><span>Proposes </span><code>&lt;static_vector&gt;</code><span> as a </span><em><span>free-standing</span></em><span> header. LWG suggests that </span><code>static_vector</code><span> should be included in </span><code>&lt;vector&gt;</code><span> instead.</span></li>
<li><span>LEWG requested pros/cons of move-semantics in the last meeting and suggested to keep </span><code>vector</code><span> programming model. Proposal has been extended and adapted.</span></li>
<li><span>LEWG requested pros/cons of exception-safety in the last meeting and suggested to keep </span><code>vector</code><span> programming model. Proposal has been extended and adapted.</span></li>
</ol><h1 id="Introduction" data-id="Introduction" style=""><a class="anchor hidden-xs" href="#Introduction" title="Introduction"><span class="octicon octicon-link"></span></a><a id="INTRODUCTION" target="_blank" rel="noopener"></a><span>Introduction</span></h1><p><span>This paper proposes a modernized </span><a href="http://www.boost.org/doc/libs/1_59_0/doc/html/boost/container/static_vector.html" target="_blank" rel="noopener"><code>boost::static_vector&lt;T, Capacity&gt;</code><span> [1]</span></a><span>. That is, a dynamically-resizable </span><code>vector</code><span> with compile-time fixed capacity and contiguous embedded storage in which the elements are stored within the vector object itself.</span></p><p><span>Its API closely resembles that of </span><code>std::vector&lt;T, A&gt;</code><span>. It is a contiguous container with </span><code>O(1)</code><span> insertion and removal of elements at the end (non-amortized) and worst case </span><code>O(size())</code><span> insertion and removal otherwise. Like </span><code>std::vector</code><span>, the elements are initialized on insertion and destroyed on removal. For trivial </span><code>value_type</code><span>s, the vector is fully usable inside </span><code>constexpr</code><span> functions.</span></p><h1 id="Motivation-and-Scope" data-id="Motivation-and-Scope" style=""><a class="anchor hidden-xs" href="#Motivation-and-Scope" title="Motivation-and-Scope"><span class="octicon octicon-link"></span></a><a id="MOTIVATION" target="_blank" rel="noopener"></a><span>Motivation and Scope</span></h1><p><span>The </span><code>static_vector</code><span> container is useful when:</span></p><ul>
<li><span>memory allocation is not possible, e.g., embedded environments without a free store, where only a stack and the static memory segment are available,</span></li>
<li><span>memory allocation imposes an unacceptable performance penalty, e.g., with respect to latency,</span></li>
<li><span>allocation of objects with complex lifetimes in the </span><em><span>static</span></em><span>-memory segment is required,</span></li>
<li><code>std::array</code><span> is not an option, e.g., if non-default constructible objects must be stored,</span></li>
<li><span>a dynamically-resizable array is required within </span><code>constexpr</code><span> functions,</span></li>
<li><span>the storage location of the </span><code>static_vector</code><span> elements is required to be within  the </span><code>static_vector</code><span> object itself (e.g. to support </span><code>memcpy</code><span> for serialization purposes).</span></li>
</ul><h1 id="Existing-practice" data-id="Existing-practice" style=""><a class="anchor hidden-xs" href="#Existing-practice" title="Existing-practice"><span class="octicon octicon-link"></span></a><a id="EXISTING_PRACTICE" target="_blank" rel="noopener"></a><span>Existing practice</span></h1><p><span>There are at least 3 widely used implementations of </span><code>static_vector</code><span>: </span><a href="http://www.boost.org/doc/libs/1_59_0/doc/html/boost/container/static_vector.html" target="_blank" rel="noopener"><span>Boost.Container [1]</span></a><span>, </span><a href="https://github.com/questor/eastl/blob/master/fixed_vector.h#L71" target="_blank" rel="noopener"><span>EASTL [2]</span></a><span>, and </span><a href="https://github.com/facebook/folly/blob/master/folly/docs/small_vector.md" target="_blank" rel="noopener"><span>Folly [3]</span></a><span>. </span><code>Boost.Container</code><span> implements </span><code>static_vector</code><span> as a standalone type with its own guarantees. </span><a href="https://github.com/questor/eastl/blob/master/fixed_vector.h#L71" target="_blank" rel="noopener"><span>EASTL</span></a><span> and </span><a href="https://github.com/facebook/folly/blob/master/folly/docs/small_vector.md" target="_blank" rel="noopener"><span>Folly</span></a><span> implement it via an extra template parameter in their </span><code>small_vector</code><span> types.</span></p><p><span>Custom allocators like </span><a href="https://howardhinnant.github.io/stack_alloc.html" target="_blank" rel="noopener"><span>Howard Hinnant’s </span><code>stack_alloc</code><span> [4]</span></a><span> emulate </span><code>static_vector</code><span> on top of </span><code>std::vector</code><span>, but as discussed in the next sections, this emulation is not great.</span></p><p><span>Other prior art includes:</span></p><ul>
<li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0494r0.pdf" target="_blank" rel="noopener"><span>P0494R0: </span><code>contiguous_container</code><span> proposal [5]</span></a><span>: proposes a </span><code>Storage</code><span> concept.</span></li>
<li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0597r0.html" target="_blank" rel="noopener"><span>P0597R0: </span><code>std::constexpr_vector&lt;T&gt;</code><span> [6]</span></a><span>: proposes a vector that can only be used in constexpr contexts.</span></li>
</ul><p><span>A reference implementation of this proposal is available </span><a href="https://godbolt.org/z/Pv8894xx6" target="_blank" rel="noopener"><span>here (godbolt)</span></a><span>.</span></p><h1 id="Design" data-id="Design" style=""><a class="anchor hidden-xs" href="#Design" title="Design"><span class="octicon octicon-link"></span></a><a id="DESIGN" target="_blank" rel="noopener"></a><span>Design</span></h1><p><span>Should </span><code>static_vector</code><span> be a standalone type or a special case of some other type?</span></p><p><span>The </span><a href="https://github.com/questor/eastl/blob/master/fixed_vector.h#L71" target="_blank" rel="noopener"><span>EASTL</span></a><span> [2] and </span><a href="https://github.com/facebook/folly/blob/master/folly/docs/small_vector.md" target="_blank" rel="noopener"><span>Folly</span></a><span> [3] special case </span><code>small_vector</code><span>, e.g., using a 4th template parameter, to make it become a </span><code>static_vector</code><span>. </span><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0639r0.html" target="_blank" rel="noopener"><span>P0639R0: </span><em><span>Changing attack vector of the </span><code>constexpr_vector</code></em><span> [7]</span></a><span> proposes improving the </span><code>Allocator</code><span> concepts to allow implementing </span><code>static_vector</code><span> as a special case of </span><code>std::vector</code><span> with a custom allocator. Both approaches produce specializations of </span><code>small_vector</code><span> or </span><code>std::vector</code><span> whose methods subtly differ in terms of effects, exception-safety, iterator invalidation, and complexity guarantees.</span></p><p><span>This proposal closely follows </span><a href="http://www.boost.org/doc/libs/1_59_0/doc/html/boost/container/static_vector.html" target="_blank" rel="noopener"><code>boost::container::static_vector&lt;T,Capacity&gt;</code><span> [1]</span></a><span> and proposes </span><code>static_vector</code><span> as a standalone type.</span></p><p><span>Where possible, this proposal defines the semantics of </span><code>static_vector</code><span> to match </span><code>std::vector</code><span>. Providing the same programming model makes this type easier to teach, use, and makes it easy to “just change” one type on a program to, e.g., perform a performance experiment.</span></p><h2 id="Layout" data-id="Layout" style=""><a class="anchor hidden-xs" href="#Layout" title="Layout"><span class="octicon octicon-link"></span></a><a id="STORAGE" target="_blank" rel="noopener"></a><span>Layout</span></h2><p><code>static_vector</code><span> models </span><code>ContiguousContainer</code><span>. Its elements are stored and properly aligned within the </span><code>static_vector</code><span> object itself. If the </span><code>Capacity</code><span> is zero the container has zero size:</span></p><pre><code class="cpp hljs"><span class="token keyword">static_assert</span><span class="token punctuation">(</span>is_empty_v<span class="token operator">&lt;</span>static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> <span class="token number">0</span><span class="token operator">&gt;&gt;</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// for all T</span>
</code></pre><p><span>The offset of the first element within </span><code>static_vector</code><span> is unspecified, and </span><code>T</code><span>s are not allowed to overlap.</span></p><p><span>The layout differs from </span><code>std::vector</code><span>, since </span><code>static_vector</code><span> does not store the </span><code>capacity</code><span> field (its known from the template parameter)</span></p><h2 id="Move-semantics" data-id="Move-semantics" style=""><a class="anchor hidden-xs" href="#Move-semantics" title="Move-semantics"><span class="octicon octicon-link"></span></a><a id="MOVE" target="_blank" rel="noopener"></a><span>Move semantics</span></h2><p><code>static_vector</code><span> move semantics are equivalent to </span><code>std::vector</code><span>. The move constructor:</span></p><pre><code class="cpp hljs"><div class="wrapper"><div class="gutter linenumber"><span></span>
<span></span></div><div class="code">static_vector <span class="token function">a</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
static_vector <span class="token function">b</span><span class="token punctuation">(</span>std<span class="token double-colon punctuation">::</span><span class="token function">move</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</div></div></code></pre><p><span>moves </span><code>a</code><span>’s elements element-wise into </span><code>b</code><span>. The </span><code>static_vector</code><span> is left in a valid but unspecified state.</span></p><hr><p><strong><span>Design Options</span></strong><span> for move-semantics of </span><code>static_vector</code><span>:</span></p><ul>
<li><code>std::array</code><span> semantics: guarantees that </span><code>size()</code><span> of </span><code>static_vector</code><span> does not change, and that elements are left in an initialized but unspecified state.</span>
<ul>
<li><span>Con: reduces portability to </span><code>vector</code></li>
</ul>
</li>
<li><code>std::vector</code><span> semantics: guarantees that </span><code>static_vector</code><span> is left in a valid but unspecified state.</span>
<ul>
<li><span>Pro: same programming model as </span><code>vector</code></li>
<li><span>Con: user must check </span><code>size()</code><span> before re-using element storage, just like for </span><code>vector</code><span>.</span></li>
</ul>
</li>
<li><span>empty source </span><code>static_vector</code><span> by resizing it:</span>
<ul>
<li><span>Pro: increases safety by requiring users to re-initialize vector elements</span></li>
<li><span>Con: different programming model than </span><code>vector</code></li>
</ul>
</li>
</ul><hr><h2 id="constexpr-support" data-id="constexpr-support" style=""><a class="anchor hidden-xs" href="#constexpr-support" title="constexpr-support"><span class="octicon octicon-link"></span></a><a id="CONSTEXPR" target="_blank" rel="noopener"></a><code>constexpr</code><span> support</span></h2><p><span>The API of </span><code>static_vector&lt;T, Capacity&gt;</code><span> can be used in </span><code>constexpr</code><span>-contexts if </span><code>is_trivially_copyable_v&lt;T&gt;</code><span>, </span><code>is_default_constructible_v&lt;T&gt;</code><span>, and </span><code>is_trivially_destructible&lt;T&gt;</code><span> are </span><code>true</code><span>.</span></p><p><span>The implementation cost of this is small. The prototye implementation specializes the storage to use a C array with value-initialized elements.</span></p><p><span>This negatively impacts the algorithmic complexity of </span><code>static_vector</code><span> constructors for these types from </span><code>O(size)</code><span> to </span><code>O(capacity)</code><span>. When value-initialization takes place at run-time, this difference is significant.</span></p><p><span>Vectors with large capacity requirements are better served by </span><code>std::vector</code><span> instead.</span></p><h2 id="Exception-Safety" data-id="Exception-Safety" style=""><a class="anchor hidden-xs" href="#Exception-Safety" title="Exception-Safety"><span class="octicon octicon-link"></span></a><a id="EXCEPTION" target="_blank" rel="noopener"></a><span>Exception Safety</span></h2><p><span>Fallible </span><code>static_vector&lt;value_type, Capacity&gt;</code><span> APIs:</span></p><ol>
<li><code>value_type</code><span>’s constructors/assignment/destructors/swap can potentially </span><code>throw</code><span> (depends on </span><code>noexcept</code><span>),</span></li>
<li><span>mutating operations exceeding the capacity (</span><code>push_back</code><span>, </span><code>insert</code><span>, </span><code>emplace</code><span>, </span><code>static_vector(value_type, size)</code><span>, </span><code>static_vector(begin, end)</code><span>…), and</span></li>
<li><span>out-of-bounds unchecked access: </span><code>front</code><span>/</span><code>back</code><span>/</span><code>pop_back</code><span> when empty, </span><code>operator[]</code><span>.</span></li>
</ol><p><span>We choose the same semantics as for </span><code>vector</code></p><ol>
<li><span>When </span><code>value_type</code><span>’s operations are invoked, </span><code>static_vector</code><span> exception-safety guarantees depend on whether these operations throw, which is detected with </span><code>noexcept</code><span> if the API has a narrow contract.</span></li>
<li><span>Mutating operations that exceed the capacity cause the allocator embedded within the </span><code>static_vector</code><span> to run out of space, and therefore throw </span><code>std::bad_alloc</code><span> like </span><code>vector</code><span> APIs do. This preserves the programming model from </span><code>vector</code><span>.</span>
<ul>
<li><span>Note: this API may need to throw an exception other than </span><code>std::bad_alloc</code><span> since it is reserved to be thrown from allocation functions. An alternative may be </span><code>std::length_error</code><span> since we provide a </span><code>max_size</code><span> that matches </span><code>Capacity</code><span>.</span></li>
</ul>
</li>
<li><span>Out-of-bounds unchecked access is a precondition violation.</span></li>
</ol><hr><p><strong><span>Design Options</span></strong><span> for exception safety semantics of </span><code>static_vector</code><span> mutating operations:</span></p><ol>
<li><span>Throw an exception:</span>
<ul>
<li><strong><span>Pros</span></strong><span>: same as </span><code>std::vector</code><span> if throws </span><code>bad_alloc</code><span>.</span></li>
</ul>
</li>
<li><span>Abort the process</span>
<ul>
<li><strong><span>Pros</span></strong><span>: portability to embedded platforms without exception support</span></li>
<li><strong><span>Cons</span></strong><span>: different programming model than </span><code>vector</code></li>
</ul>
</li>
<li><span>Precondition violation</span>
<ul>
<li><strong><span>Cons</span></strong><span>: different proramming model than </span><code>vector</code><span>, users responsible for checking before modifying vector size, etc.</span></li>
</ul>
</li>
</ol><p><span>We add the following new allocation APIs following Kona guidance:</span></p><pre><code><ins>constexpr void static_vector&lt;T, C&gt;::push_back_unchecked(const T&amp; value);
constexpr void static_vector&lt;T, C&gt;::push_back_unchecked(T&amp;&amp; value);
</ins></code></pre><ul>
<li><span>Exceeding the capacity is a precondition violation.</span></li>
</ul><pre><code><ins>constexpr optional&lt;T&gt; static_vector&lt;T, C&gt;::try_push_back(const T&amp; value);
constexpr optional&lt;T&gt; static_vector&lt;T, C&gt;::try_push_back(T&amp;&amp; value);
</ins></code></pre><ul>
<li><span>If the element is inserted into the vector, they return </span><code>nullopt</code><span>. Otherwise, they return an </span><code>optional</code><span> containing the value passed in.</span></li>
</ul><h2 id="Iterator-invalidation" data-id="Iterator-invalidation" style=""><a class="anchor hidden-xs" href="#Iterator-invalidation" title="Iterator-invalidation"><span class="octicon octicon-link"></span></a><a rel="noopener" target="_blank" id="ITERATOR"></a><span>Iterator invalidation</span></h2><p><code>static_vector</code><span> iterator invalidation guarantees differ from </span><code>std::vector</code><span>:</span></p><ul>
<li><span>moving a </span><code>static_vector</code><span> invalidates all iterators, and</span></li>
<li><span>swapping two </span><code>static_vector</code><span>s invalidates all iterators.</span></li>
</ul><p><code>static_vector</code><span> APIs that potentially invalidate iterators are: </span><code>resize(n)</code><span>, </span><code>resize(n, v)</code><span>, </span><code>pop_back</code><span>, </span><code>erase</code><span>, and </span><code>swap</code><span>.</span></p><h1 id="Naming" data-id="Naming" style=""><a class="anchor hidden-xs" href="#Naming" title="Naming"><span class="octicon octicon-link"></span></a><a rel="noopener" target="_blank" id="Naming"></a><span>Naming</span></h1><p><code>static_vector</code><span> is not a very good name because the name is overloaded. We prefer to switch to the name </span><code>inplace_vector</code><span> instead.</span></p><h1 id="Technical-specification" data-id="Technical-specification" style=""><a class="anchor hidden-xs" href="#Technical-specification" title="Technical-specification"><span class="octicon octicon-link"></span></a><a rel="noopener" target="_blank" id="TECHNICAL_SPECIFICATION"></a><span>Technical specification</span></h1><hr><p><span>Note to editor: This enhancement is a pure header-only addition to the C++ standard library as the </span><em><span>freestanding</span></em><span> </span><code>&lt;static_vector&gt;</code><span> header. It belongs in the “Sequence containers” (</span><code>\ref{sequences}</code><span>) part of the “Containers library” (</span><code>\ref{containers}</code><span>) as “Class template </span><code>static_vector</code><span>”.</span></p><blockquote>
<ul>
<li><strong><span>UNRESOLVED QUESTION</span></strong><span>: LWG recommends making this header part of </span><code>&lt;vector&gt;</code><span>.</span></li>
</ul>
<p><span>Note: one of the primary use cases for this container is embedded/freestanding applications. Do we impact those by not putting it in a free-standing header and adding it to </span><code>&lt;vector&gt;</code><span> instead?</span></p>
</blockquote><hr><h2 id="libraryrequirementsorganizationheaders" data-id="libraryrequirementsorganizationheaders" style=""><a class="anchor hidden-xs" href="#libraryrequirementsorganizationheaders" title="libraryrequirementsorganizationheaders"><span class="octicon octicon-link"></span></a><span>[library.requirements.organization.headers]</span></h2><p><span>Add </span><code>&lt;static_vector&gt;</code><span> to [tab:headers.cpp].</span></p><h2 id="libraryrequirementsorganizationcompliance" data-id="libraryrequirementsorganizationcompliance" style=""><a class="anchor hidden-xs" href="#libraryrequirementsorganizationcompliance" title="libraryrequirementsorganizationcompliance"><span class="octicon octicon-link"></span></a><span>[library.requirements.organization.compliance]</span></h2><p><span>Add </span><code>&lt;static_vector&gt;</code><span> tp [tab:headers.cpp.fs]:</span></p><ul>
<li><span>[containers]</span></li>
<li><span>Subclause: containers</span></li>
<li><span>Headers: </span><code>&lt;static_vector&gt;</code></li>
</ul><h2 id="containerreqmts-General-container-requirements" data-id="containerreqmts-General-container-requirements" style=""><a class="anchor hidden-xs" href="#containerreqmts-General-container-requirements" title="containerreqmts-General-container-requirements"><span class="octicon octicon-link"></span></a><span>[container.reqmts] General container requirements</span></h2><p><a href="http://eel.is/c++draft/container.reqmts" target="_blank" rel="noopener"><span>http://eel.is/c++draft/container.reqmts</span></a></p><ol>
<li><span>A type </span><code>X</code><span> meets the container requirements if the following types, statements, and expressions are well-formed and have the specified semantics.</span></li>
</ol><pre><code class="cpp hljs"><span class="token keyword">typename</span> <span class="token class-name">X</span><span class="token double-colon punctuation">::</span>value_type
</code></pre><ul>
<li><span>Result: </span><code>T</code></li>
<li><span>Preconditions: </span><code>T</code><span> is </span><code>Cpp17Erasable</code><span> from </span><code>X</code><span> (see [container.alloc.reqmts], below).</span></li>
</ul><pre><code class="cpp hljs"><span class="token keyword">typename</span> <span class="token class-name">X</span><span class="token double-colon punctuation">::</span>reference
</code></pre><ul>
<li><span>Result: </span><code>T&amp;</code></li>
</ul><pre><code class="cpp hljs"><span class="token keyword">typename</span> <span class="token class-name">X</span><span class="token double-colon punctuation">::</span>const_reference
</code></pre><ul>
<li><span>Result: </span><code>const T&amp;</code></li>
</ul><pre><code class="cpp hljs"><span class="token keyword">typename</span> <span class="token class-name">X</span><span class="token double-colon punctuation">::</span>iterator
</code></pre><ul>
<li><span>Result: A type that meets the forward iterator requirements ([forward.iterators]) with value type </span><code>T</code><span>. The type </span><code>X::iterator</code><span> is convertible to </span><code>X::const_iterator</code><span>.</span></li>
</ul><pre><code class="cpp hljs"><span class="token keyword">typename</span> <span class="token class-name">X</span><span class="token double-colon punctuation">::</span>const_iterator
</code></pre><ul>
<li><span>Result: A type that meets the requirements of a constant iterator and those of a forward iterator with value type </span><code>T</code><span>.</span></li>
</ul><pre><code class="cpp hljs"><span class="token keyword">typename</span> <span class="token class-name">X</span><span class="token double-colon punctuation">::</span>differcence_type
</code></pre><ul>
<li><span>Result: A signed integer type, identical to the difference type of </span><code>X::iterator</code><span> and </span><code>X::const_iterator</code><span>.</span></li>
</ul><pre><code class="cpp hljs"><span class="token keyword">typename</span> <span class="token class-name">X</span><span class="token double-colon punctuation">::</span>size_type
</code></pre><ul>
<li><span>Result: An unsigned integer type that can represent any non-negative value of </span><code>X::difference_type</code><span>.</span></li>
</ul><pre><code class="cpp hljs">X u<span class="token punctuation">;</span>
X u <span class="token operator">=</span> <span class="token function">X</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre><ul>
<li><span>Postconditions: </span><code>u.empty()</code></li>
<li><span>Complexity: Constant.</span></li>
</ul><pre><code class="cpp hljs">X <span class="token function">u</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span><span class="token punctuation">;</span>
X u <span class="token operator">=</span> a<span class="token punctuation">;</span>
</code></pre><ul>
<li><span>Preconditions: </span><code>T</code><span> is </span><code>Cpp17CopyInsertable</code><span> into </span><code>X</code><span> (see below).</span></li>
<li><span>Postconditions: </span><code>u == a</code></li>
<li><span>Complexity: Linear.</span></li>
</ul><pre><code class="cpp hljs">X <span class="token function">u</span><span class="token punctuation">(</span>rv<span class="token punctuation">)</span><span class="token punctuation">;</span>
X u <span class="token operator">=</span> rv<span class="token punctuation">;</span>
</code></pre><ul>
<li><span>Postconditions: </span><code>u</code><span> is equal to the value that </span><code>rv</code><span> had before this construction.</span></li>
<li><span>Complexity: Linear for array</span><ins><span> and </span><code>static_vector</code></ins><span> and constant for all other standard containers.</span></li>
</ul><pre><code class="cpp hljs">a <span class="token operator">=</span> rv
</code></pre><ul>
<li><span>Result: </span><code>X&amp;</code><span>.</span></li>
<li><span>Effects: All existing elements of </span><code>a</code><span> are either move assigned to or destroyed.</span></li>
<li><span>Postconditions: If </span><code>a</code><span> and </span><code>rv</code><span> do not refer to the same object, </span><code>a</code><span> is equal to the value that </span><code>rv</code><span> had before this assignment.</span></li>
<li><span>Complexity: Linear.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token operator">~</span><span class="token function">X</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>void</code></li>
<li><span>Effects: Destroys every element of </span><code>a</code><span>; any memory obtained is deallocated.</span></li>
<li><span>Complexity: Linear.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">begin</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>iterator</code><span>; </span><code>const_iterator</code><span> for constant </span><code>a</code><span>.</span></li>
<li><span>Returns: An iterator referring to the first element in the container.</span></li>
<li><span>Complexity: Constant.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">end</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>iterator</code><span>; </span><code>const_iterator</code><span> for constant </span><code>a</code><span>.</span></li>
<li><span>Returns: An iterator which is the past-the-end value for the container.</span></li>
<li><span>Complexity: Constant.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">cbegin</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>const_iterator</code><span>.</span></li>
<li><span>Returns: </span><code>const_cast&lt;X const&amp;&gt;(a).begin()</code></li>
<li><span>Complexity: Constant.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">cend</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>const_iterator</code><span>.</span></li>
<li><span>Returns: </span><code>const_cast&lt;X const&amp;&gt;(a).end()</code></li>
<li><span>Complexity: Constant.</span></li>
</ul><pre><code class="cpp hljs">i <span class="token operator">&lt;=&gt;</span> j
</code></pre><ul>
<li><span>Result: </span><code>strong_ordering</code><span>.</span></li>
<li><span>Constraints: </span><code>X::iterator</code><span> meets the random access iterator requirements.</span></li>
<li><span>Complexity: Constant.</span></li>
</ul><pre><code class="cpp hljs">a <span class="token operator">==</span> b
</code></pre><ul>
<li><span>Preconditions: </span><code>T</code><span> meets the </span><code>Cpp17EqualityComparable</code><span> requirements.</span></li>
<li><span>Result: Convertible to </span><code>bool</code><span>.</span></li>
<li><span>Returns: </span><code>equal(a.begin(), a.end(), b.begin(), b.end())</code><span> [Note 1: The algorithm </span><code>equal</code><span> is defined in [alg.equal]. — end note]</span></li>
<li><span>Complexity: Constant if </span><code>a.size() != b.size()</code><span>, linear otherwise.</span></li>
<li><span>Remarks: </span><code>==</code><span> is an equivalence relation.</span></li>
</ul><pre><code class="cpp hljs">a <span class="token operator">!=</span> b
</code></pre><ul>
<li><span>Effects: Equivalent to </span><code>!(a == b)</code><span>.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">swap</span><span class="token punctuation">(</span>b<span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>void</code></li>
<li><span>Effects: Exchanges the contents of </span><code>a</code><span> and </span><code>b</code><span>.</span></li>
<li><span>Complexity: Linear for array</span><ins><span> and </span><code>static_vector</code><span>,</span></ins><span> and constant for all other standard containers.</span></li>
</ul><pre><code class="cpp hljs"><span class="token function">swap</span><span class="token punctuation">(</span>a<span class="token punctuation">,</span> b<span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Effects: Equivalent to </span><code>a.swap(b)</code><span>.</span></li>
</ul><pre><code class="cpp hljs">r <span class="token operator">=</span> a
</code></pre><ul>
<li><span>Result: </span><code>X&amp;</code><span>.</span></li>
<li><span>Postconditions: </span><code>r == a</code><span>.</span></li>
<li><span>Complexity: Linear.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>size_type</code><span>.</span></li>
<li><span>Returns: </span><code>distance(a.begin(), a.end())</code><span>, i.e. the number of elements in the container.</span></li>
<li><span>Complexity: Constant.</span></li>
<li><span>Remarks: The number of elements is defined by the rules of constructors, inserts, and erases.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">max_size</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>size_type</code><span>.</span></li>
<li><span>Returns: </span><code>distance(begin(), end())</code><span> for the largest possible container.</span></li>
<li><span>Complexity: Constant.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: Convertible to </span><code>bool</code><span>.</span></li>
<li><span>Returns: </span><code>a.begin() == a.end()</code></li>
<li><span>Complexity: Constant.</span></li>
<li><span>Remarks: If the container is empty, then </span><code>a.empty()</code><span> is true.</span></li>
</ul><ol>
<li><span>In the expressions</span></li>
</ol><pre><code class="cpp hljs">i <span class="token operator">==</span> j
i <span class="token operator">!=</span> j
i <span class="token operator">&lt;</span> j
i <span class="token operator">&lt;=</span> j
i <span class="token operator">&gt;=</span> j
i <span class="token operator">&gt;</span> j
i <span class="token operator">&lt;=&gt;</span> j
i <span class="token operator">-</span> j
</code></pre><p><span>where </span><code>i</code><span> and </span><code>j</code><span> denote objects of a container’s iterator type, either or both may be replaced by an object of the container’s </span><code>const_iterator</code><span> type referring to the same element with no change in semantics.</span></p><p><span>Unless otherwise specified, all containers defined in this Clause obtain memory using an allocator (see [allocator.requirements]).</span></p><p><span>[Note 2: In particular, containers and iterators do not store references to allocated elements other than through the allocator’s pointer type, i.e., as objects of type </span><code>P</code><span> or </span><code>pointer_traits&lt;P&gt;::template rebind&lt;unspecified&gt;</code><span>, where </span><code>P</code><span> is </span><code>allocator_traits&lt;allocator_type&gt;::pointer</code><span>. — end note]</span></p><p><span>Copy constructors for these container types obtain an allocator by calling </span><code>allocator_traits&lt;allocator_type&gt;::select_on_container_copy_construction</code><span> on the allocator belonging to the container being copied. Move constructors obtain an allocator by move construction from the allocator belonging to the container being moved. Such move construction of the allocator shall not exit via an exception. All other constructors for these container types take a </span><code>const allocator_type&amp;</code><span> argument.</span></p><p><span>[Note 3: If an invocation of a constructor uses the default value of an optional allocator argument, then the allocator type must support value-initialization. — end note]</span></p><p><span>A copy of this allocator is used for any memory allocation and element construction performed, by these constructors and by all member functions, during the lifetime of each container object or until the allocator is replaced. The allocator may be replaced only via assignment or </span><code>swap()</code><span>. Allocator replacement is performed by copy assignment, move assignment, or swapping of the allocator only if</span></p><ol>
<li><code>allocator_­traits&lt;allocator_­type&gt;​::​propagate_­on_­container_­copy_­assignment​::​value</code><span>,</span></li>
<li><code>allocator_­traits&lt;allocator_­type&gt;​::​propagate_­on_­container_­move_­assignment​::​value</code><span>, or</span></li>
<li><code>allocator_­traits&lt;allocator_­type&gt;​::​propagate_­on_­container_­swap​::​value</code><br>
<span>is </span><code>true</code><span> within the implementation of the corresponding container operation. In all container types defined in this Clause, the member </span><code>get_­allocator()</code><span> returns a copy of the allocator used to construct the container or, if that allocator has been replaced, a copy of the most recent replacement.</span></li>
<li><span>The expression </span><code>a.swap(b)</code><span>, for containers </span><code>a</code><span> and </span><code>b</code><span> of a standard container type other than </span><code>array</code><ins><span> and </span><code>static_vector</code></ins><span>, shall exchange the values of </span><code>a</code><span> and </span><code>b</code><span> without invoking any move, copy, or swap operations on the individual container elements. Lvalues of any Compare, Pred, or Hash types belonging to </span><code>a</code><span> and </span><code>b</code><span> shall be swappable and shall be exchanged by calling swap as described in [swappable.requirements]. If </span><code>allocator_­traits&lt;allocator_­type&gt;​::​propagate_­on_­container_­swap​::​value</code><span> is </span><code>true</code><span>, then lvalues of type </span><code>allocator_­type</code><span> shall be swappable and the allocators of </span><code>a</code><span> and </span><code>b</code><span> shall also be exchanged by calling </span><code>swap</code><span> as described in [swappable.requirements]. Otherwise, the allocators shall not be swapped, and the behavior is undefined unless </span><code>a.get_­allocator() == b.get_­allocator()</code><span>. Every iterator referring to an element in one container before the swap shall refer to the same element in the other container after the swap. It is unspecified whether an iterator with value </span><code>a.end()</code><span> before the swap will have value </span><code>b.end()</code><span> after the swap.</span></li>
</ol><h2 id="containerrequirementssequencereqmts" data-id="containerrequirementssequencereqmts" style=""><a class="anchor hidden-xs" href="#containerrequirementssequencereqmts" title="containerrequirementssequencereqmts"><span class="octicon octicon-link"></span></a><span>[container.requirements.sequence.reqmts]</span></h2><p><a href="http://eel.is/c++draft/sequence.reqmts" target="_blank" rel="noopener"><span>http://eel.is/c++draft/sequence.reqmts</span></a></p><p><code>sequence.reqmts.1</code><span>: The library provides </span><del><span>four</span></del><ins><span>the following</span></ins><span> basic kinds of sequence containers: </span><code>vector</code><span>,</span><ins><span> </span><code>static_vector</code><span>,</span></ins><span> </span><code>forward_list</code><span>, </span><code>list</code><span>, and </span><code>deque</code><span>.</span></p><p><code>sequence.reqmts.2</code><span>: […] </span><code>vector</code><span> is the type of sequence container that should be used by default.</span><ins><span> </span><code>static_vector</code><span> should be used when the container has a fixed capacity known during translation.</span></ins><span> </span><code>array</code><span> should be used when the container has a fixed size known during translation.</span></p><p><span>[…]</span></p><p><span>The following operations are provided for some types of sequence containers but not others. An implementation shall implement them so as to take amortized constant time.</span></p><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">front</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>reference</code><span>; </span><code>const_reference</code><span> for constant </span><code>a</code><span>.</span></li>
<li><span>Returns: </span><code>*a.begin()</code></li>
<li><span>Remarks: Required for </span><code>basic_string</code><span>, </span><code>array</code><span>, </span><code>deque</code><span>, </span><code>forward_list</code><span>, </span><code>list</code><span>,</span><ins><span> </span><code>static_vector</code><span>,</span></ins><span> and vector.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">back</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>reference</code><span>; </span><code>const_reference</code><span> for constant </span><code>a</code><span>.</span></li>
<li><span>Effects: Equivalent to:</span><pre><code class="cpp hljs"><span class="token keyword">auto</span> tmp <span class="token operator">=</span> a<span class="token punctuation">.</span><span class="token function">end</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token operator">--</span>tmp<span class="token punctuation">;</span>
<span class="token keyword">return</span> <span class="token operator">*</span>tmp<span class="token punctuation">;</span>
</code></pre>
</li>
<li><span>Remarks: Required for </span><code>basic_string</code><span>, </span><code>array</code><span>, </span><code>deque</code><span>, </span><code>list</code><span>,</span><ins><span> </span><code>static_vector</code><span>,</span></ins><span> and vector.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">emplace_front</span><span class="token punctuation">(</span>args<span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>reference</code></li>
<li><span>Preconditions: </span><code>T</code><span> is </span><code>Cpp17EmplaceConstructible</code><span> into </span><code>X</code><span> from </span><code>args</code><span>.</span></li>
<li><span>Effects: Prepends an object of type </span><code>T</code><span> constructed with `std::forward</span>&lt;Args&gt;<span>(args)…``.</span></li>
<li><span>Returns: `a.front()``.</span></li>
<li><span>Remarks: Required for </span><code>deque</code><span>, </span><code>forward_list</code><span>, and </span><code>list</code><span>.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">emplace_back</span><span class="token punctuation">(</span>args<span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: reference</span></li>
<li><span>Preconditions: </span><code>T</code><span> is </span><code>Cpp17EmplaceConstructible</code><span> into </span><code>X</code><span> from </span><code>args</code><span>. For </span><code>vector</code><ins><span> and </span><code>static_vector</code></ins><span>, </span><code>T</code><span> is also </span><code>Cpp17MoveInsertable</code><span> into </span><code>X</code><span>.</span></li>
<li><span>Effects: Appends an object of type </span><code>T</code><span> constructed with </span><code>std::forward&lt;Args&gt;(args)...</code><span>.</span></li>
<li><span>Returns: `a.back()``.</span></li>
<li><span>Remarks: Required for </span><code>deque</code><span>, </span><code>list</code><span>,</span><ins><span> </span><code>static_vector</code><span>,</span></ins><span> and vector.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">push_front</span><span class="token punctuation">(</span>t<span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>void</code></li>
<li><span>Preconditions: </span><code>T</code><span> is </span><code>Cpp17CopyInsertable</code><span> into </span><code>X</code><span>.</span></li>
<li><span>Effects: Prepends a copy of </span><code>t</code><span>.</span></li>
<li><span>Remarks: Required for </span><code>deque</code><span>, </span><code>forward_list</code><span>, and </span><code>list</code><span>.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">push_front</span><span class="token punctuation">(</span>rv<span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>void</code></li>
<li><span>Preconditions: </span><code>T</code><span> is </span><code>Cpp17MoveInsertable</code><span> into </span><code>X</code><span>.</span></li>
<li><span>Effects: Prepends a copy of </span><code>rv</code><span>.</span></li>
<li><span>Remarks: Required for </span><code>deque</code><span>, </span><code>forward_list</code><span>, and </span><code>list</code><span>.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">prepend_range</span><span class="token punctuation">(</span>rg<span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>void</code></li>
<li><span>Preconditions: </span><code>T</code><span> is </span><code>Cpp17EmplaceConstructible</code><span> into </span><code>X</code><span> from </span><code>*ranges::begin(rg)</code><span>.</span></li>
<li><span>Effects: Inserts copies of elements in </span><code>rg</code><span> before </span><code>begin()</code><span>. Each iterator in the range </span><code>rg</code><span> is dereferenced exactly once. [Note 3: The order of elements in </span><code>rg</code><span> is not reversed. — end note]</span></li>
<li><span>Remarks: Required for </span><code>deque</code><span>, </span><code>forward_list</code><span>, and </span><code>list</code><span>.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">push_back</span><span class="token punctuation">(</span>t<span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>void</code></li>
<li><span>Preconditions: </span><code>T</code><span> is </span><code>Cpp17CopyInsertable</code><span> into </span><code>X</code><span>.</span></li>
<li><span>Effects: Appends a copy of </span><code>t</code><span>.</span></li>
<li><span>Remarks: Required for </span><code>basic_string</code><span>, </span><code>deque</code><span>, </span><code>list</code><span>,</span><ins><span> </span><code>static_vector</code><span>,</span></ins><span> and vector.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">push_back</span><span class="token punctuation">(</span>rv<span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>void</code></li>
<li><span>Preconditions: </span><code>T</code><span> is </span><code>Cpp17MoveInsertable</code><span> into </span><code>X</code><span>.</span></li>
<li><span>Effects: Appends a copy of </span><code>rv</code><span>.</span></li>
<li><span>Remarks: Required for </span><code>basic_string</code><span>, </span><code>deque</code><span>, </span><code>list</code><span>,</span><ins><span> </span><code>static_vector</code><span>, </span></ins><span> and vector.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">append_range</span><span class="token punctuation">(</span>rg<span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>void</code></li>
<li><span>Preconditions: </span><code>T</code><span> is </span><code>Cpp17EmplaceConstructible</code><span> into </span><code>X</code><span> from </span><code>*ranges::begin(rg)</code><span>. For </span><code>vector</code><ins><span> and </span><code>static_vector</code></ins><span>, </span><code>T</code><span> is also </span><code>Cpp17MoveInsertable</code><span> into </span><code>X</code><span>.</span></li>
<li><span>Effects: Inserts copies of elements in </span><code>rg</code><span> before </span><code>end()</code><span>. Each iterator in the range </span><code>rg</code><span> is dereferenced exactly once.</span></li>
<li><span>Remarks: Required for </span><code>deque</code><span>, </span><code>list</code><span>,</span><ins><code>static_vector</code><span>, </span></ins><span> and vector.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">pop_front</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>void</code></li>
<li><span>Preconditions: </span><code>a.empty()</code><span> is </span><code>false</code><span>.</span></li>
<li><span>Effects: Destroys the first element.</span></li>
<li><span>Remarks: Required for </span><code>deque</code><span>, </span><code>forward_list</code><span>, and </span><code>list</code><span>.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">pop_back</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>void</code></li>
<li><span>Preconditions: </span><code>a.empty()</code><span> is </span><code>false</code><span>.</span></li>
<li><span>Effects: Destroys the last element.</span></li>
<li><span>Remarks: Required for </span><code>basic_string</code><span>, </span><code>deque</code><span>, </span><code>list</code><span>,</span><ins><code>static_vector</code><span>, </span></ins><span> and vector.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">[</span>n<span class="token punctuation">]</span>
</code></pre><ul>
<li><span>Result: </span><code>reference</code><span>; </span><code>const_reference</code><span> for constant </span><code>a</code></li>
<li><span>Returns: </span><code>*(a.begin() + n)</code></li>
<li><span>Remarks: Required for </span><code>basic_string</code><span>, </span><code>array</code><span>, </span><code>deque</code><span>,</span><ins><span> </span><code>static_vector</code><span>, </span></ins><span> and vector.</span></li>
</ul><pre><code class="cpp hljs">a<span class="token punctuation">.</span><span class="token function">at</span><span class="token punctuation">(</span>n<span class="token punctuation">)</span>
</code></pre><ul>
<li><span>Result: </span><code>reference</code><span>; </span><code>const_reference</code><span> for constant </span><code>a</code></li>
<li><span>Returns: </span><code>*(a.begin() + n)</code></li>
<li><span>Throws: </span><code>out_of_range</code><span> if </span><code>n &gt;= a.size()</code><span>.</span></li>
<li><span>Remarks: Required for </span><code>basic_string</code><span>, </span><code>array</code><span>, </span><code>deque</code><span>,</span><ins><span> </span><code>static_vector</code><span>, </span></ins><span> and </span><code>vector</code><span>.</span></li>
</ul><h2 id="containerssequencesstatic_vectorsyn-Header-ltstatic_vectorgt-synopsis" data-id="containerssequencesstatic_vectorsyn-Header-ltstatic_vectorgt-synopsis" style=""><a class="anchor hidden-xs" href="#containerssequencesstatic_vectorsyn-Header-ltstatic_vectorgt-synopsis" title="containerssequencesstatic_vectorsyn-Header-ltstatic_vectorgt-synopsis"><span class="octicon octicon-link"></span></a><span>[containers.sequences.static_vector.syn] Header </span><code>&lt;static_vector&gt;</code><span> synopsis</span></h2><pre><code class="cpp hljs"><span class="token keyword">namespace</span> std <span class="token punctuation">{</span>

<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">typename</span> <span class="token class-name">T</span><span class="token punctuation">,</span> size_t N<span class="token operator">&gt;</span>
<span class="token keyword">class</span> <span class="token class-name">static_vector</span> <span class="token punctuation">{</span>
<span class="token keyword">public</span><span class="token operator">:</span>
<span class="token comment">// types:</span>
<span class="token keyword">using</span> value_type <span class="token operator">=</span> T<span class="token punctuation">;</span>
<span class="token keyword">using</span> pointer <span class="token operator">=</span> T<span class="token operator">*</span><span class="token punctuation">;</span>
<span class="token keyword">using</span> const_pointer <span class="token operator">=</span> <span class="token keyword">const</span> T<span class="token operator">*</span><span class="token punctuation">;</span> 
<span class="token keyword">using</span> reference <span class="token operator">=</span> value_type<span class="token operator">&amp;</span><span class="token punctuation">;</span>
<span class="token keyword">using</span> const_reference <span class="token operator">=</span> <span class="token keyword">const</span> value_type<span class="token operator">&amp;</span><span class="token punctuation">;</span>
<span class="token keyword">using</span> size_type <span class="token operator">=</span>  size_t<span class="token punctuation">;</span>
<span class="token keyword">using</span> difference_type <span class="token operator">=</span> ptrdiff_t<span class="token punctuation">;</span>
<span class="token keyword">using</span> iterator <span class="token operator">=</span> implementation<span class="token operator">-</span>defined<span class="token punctuation">;</span>  <span class="token comment">// see [container.requirements]</span>
<span class="token keyword">using</span> const_iterator <span class="token operator">=</span> implementation<span class="token operator">-</span>defined<span class="token punctuation">;</span> <span class="token comment">// see [container.requirements]</span>
<span class="token keyword">using</span> reverse_iterator <span class="token operator">=</span> std<span class="token double-colon punctuation">::</span>reverse_iterator<span class="token operator">&lt;</span>iterator<span class="token operator">&gt;</span><span class="token punctuation">;</span>
<span class="token keyword">using</span> const_reverse_iterator <span class="token operator">=</span> std<span class="token double-colon punctuation">::</span>reverse_iterator<span class="token operator">&lt;</span>const_iterator<span class="token operator">&gt;</span><span class="token punctuation">;</span>

<span class="token comment">// [containers.sequences.static_vector.cons]</span>
<span class="token keyword">constexpr</span> <span class="token function">static_vector</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> <span class="token function">static_vector</span><span class="token punctuation">(</span><span class="token keyword">const</span> static_vector<span class="token operator">&amp;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> <span class="token function">static_vector</span><span class="token punctuation">(</span>static_vector<span class="token operator">&amp;&amp;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">explicit</span> <span class="token function">static_vector</span><span class="token punctuation">(</span>size_type n<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> <span class="token function">static_vector</span><span class="token punctuation">(</span>size_type n<span class="token punctuation">,</span> <span class="token keyword">const</span> value_type<span class="token operator">&amp;</span> value<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">class</span> <span class="token class-name">InputIterator</span><span class="token operator">&gt;</span>
<span class="token keyword">constexpr</span> <span class="token function">static_vector</span><span class="token punctuation">(</span>InputIterator first<span class="token punctuation">,</span> InputIterator last<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> <span class="token function">static_vector</span><span class="token punctuation">(</span>initializer_list<span class="token operator">&lt;</span>value_type<span class="token operator">&gt;</span> il<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// [containers.sequences.static_vector.cons]</span>
<span class="token keyword">constexpr</span> static_vector<span class="token operator">&amp;</span> <span class="token keyword">operator</span><span class="token operator">=</span><span class="token punctuation">(</span><span class="token keyword">const</span> static_vector<span class="token operator">&amp;</span> other<span class="token punctuation">)</span>
  <span class="token keyword">noexcept</span><span class="token punctuation">(</span>is_nothrow_copy_assignable_v<span class="token operator">&lt;</span>value_type<span class="token operator">&gt;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> static_vector<span class="token operator">&amp;</span> <span class="token keyword">operator</span><span class="token operator">=</span><span class="token punctuation">(</span>static_vector<span class="token operator">&amp;&amp;</span> other<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">noexcept</span><span class="token punctuation">(</span>is_nothrow_move_assignable_v<span class="token operator">&lt;</span>value_type<span class="token operator">&gt;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">class</span> <span class="token class-name">InputIterator</span><span class="token operator">&gt;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">void</span> <span class="token function">assign</span><span class="token punctuation">(</span>InputIterator first<span class="token punctuation">,</span> InputIterator last<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">void</span> <span class="token function">assign</span><span class="token punctuation">(</span>size_type n<span class="token punctuation">,</span> <span class="token keyword">const</span> value_type<span class="token operator">&amp;</span> u<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">void</span> <span class="token function">assign</span><span class="token punctuation">(</span>initializer_list<span class="token operator">&lt;</span>value_type<span class="token operator">&gt;</span> il<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// [containers.sequences.static_vector.destructor]</span>
<span class="token keyword">constexpr</span> <span class="token operator">~</span><span class="token function">static_vector</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// iterators</span>
<span class="token keyword">constexpr</span> iterator               <span class="token function">begin</span><span class="token punctuation">(</span><span class="token punctuation">)</span>         <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> const_iterator         <span class="token function">begin</span><span class="token punctuation">(</span><span class="token punctuation">)</span>   <span class="token keyword">const</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> iterator               <span class="token function">end</span><span class="token punctuation">(</span><span class="token punctuation">)</span>           <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> const_iterator         <span class="token function">end</span><span class="token punctuation">(</span><span class="token punctuation">)</span>     <span class="token keyword">const</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> reverse_iterator       <span class="token function">rbegin</span><span class="token punctuation">(</span><span class="token punctuation">)</span>        <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> const_reverse_iterator <span class="token function">rbegin</span><span class="token punctuation">(</span><span class="token punctuation">)</span>  <span class="token keyword">const</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> reverse_iterator       <span class="token function">rend</span><span class="token punctuation">(</span><span class="token punctuation">)</span>          <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> const_reverse_iterator <span class="token function">rend</span><span class="token punctuation">(</span><span class="token punctuation">)</span>    <span class="token keyword">const</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> const_iterator         <span class="token function">cbegin</span><span class="token punctuation">(</span><span class="token punctuation">)</span>  <span class="token keyword">const</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> const_iterator         <span class="token function">cend</span><span class="token punctuation">(</span><span class="token punctuation">)</span>    <span class="token keyword">const</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> const_reverse_iterator <span class="token function">crbegin</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">const</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> const_reverse_iterator <span class="token function">crend</span><span class="token punctuation">(</span><span class="token punctuation">)</span>   <span class="token keyword">const</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>

<span class="token comment">// [containers.sequences.static_vector.members] size/capacity</span>
<span class="token punctuation">[</span><span class="token punctuation">[</span>nodiscard<span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token keyword">constexpr</span> <span class="token keyword">bool</span> <span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">const</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> size_type <span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">const</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">static</span> <span class="token keyword">constexpr</span> size_type <span class="token function">max_size</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">static</span> <span class="token keyword">constexpr</span> size_type <span class="token function">capacity</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">void</span> <span class="token function">resize</span><span class="token punctuation">(</span>size_type sz<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">void</span> <span class="token function">resize</span><span class="token punctuation">(</span>size_type sz<span class="token punctuation">,</span> <span class="token keyword">const</span> value_type<span class="token operator">&amp;</span> c<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// [containers.sequences.static_vector.members] element and data access:</span>
<span class="token keyword">constexpr</span> reference       <span class="token keyword">operator</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">(</span>size_type n<span class="token punctuation">)</span><span class="token punctuation">;</span> 
<span class="token keyword">constexpr</span> const_reference <span class="token keyword">operator</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">(</span>size_type n<span class="token punctuation">)</span> <span class="token keyword">const</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> reference       <span class="token function">front</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> const_reference <span class="token function">front</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">const</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> reference       <span class="token function">back</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> const_reference <span class="token function">back</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">const</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span>       T<span class="token operator">*</span> <span class="token function">data</span><span class="token punctuation">(</span><span class="token punctuation">)</span>       <span class="token keyword">noexcept</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">const</span> T<span class="token operator">*</span> <span class="token function">data</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">const</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>

<span class="token comment">// 5.7, modifiers:</span>
<span class="token keyword">constexpr</span> iterator <span class="token function">insert</span><span class="token punctuation">(</span>const_iterator position<span class="token punctuation">,</span> <span class="token keyword">const</span> value_type<span class="token operator">&amp;</span> x<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> iterator <span class="token function">insert</span><span class="token punctuation">(</span>const_iterator position<span class="token punctuation">,</span> value_type<span class="token operator">&amp;&amp;</span> x<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> iterator <span class="token function">insert</span><span class="token punctuation">(</span>const_iterator position<span class="token punctuation">,</span> size_type n<span class="token punctuation">,</span> <span class="token keyword">const</span> value_type<span class="token operator">&amp;</span> x<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">class</span> <span class="token class-name">InputIterator</span><span class="token operator">&gt;</span>
  <span class="token keyword">constexpr</span> iterator <span class="token function">insert</span><span class="token punctuation">(</span>const_iterator position<span class="token punctuation">,</span> InputIterator first<span class="token punctuation">,</span> InputIterator last<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> iterator <span class="token function">insert</span><span class="token punctuation">(</span>const_iterator position<span class="token punctuation">,</span> initializer_list<span class="token operator">&lt;</span>value_type<span class="token operator">&gt;</span> il<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">class</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> Args<span class="token operator">&gt;</span>
  <span class="token keyword">constexpr</span> iterator <span class="token function">emplace</span><span class="token punctuation">(</span>const_iterator position<span class="token punctuation">,</span> Args<span class="token operator">&amp;&amp;</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> args<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">class</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> Args<span class="token operator">&gt;</span>
  <span class="token keyword">constexpr</span> reference <span class="token function">emplace_back</span><span class="token punctuation">(</span>Args<span class="token operator">&amp;&amp;</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> args<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">void</span> <span class="token function">push_back</span><span class="token punctuation">(</span><span class="token keyword">const</span> value_type<span class="token operator">&amp;</span> x<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">void</span> <span class="token function">push_back</span><span class="token punctuation">(</span>value_type<span class="token operator">&amp;&amp;</span> x<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">constexpr</span> <span class="token keyword">void</span> <span class="token function">pop_back</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> iterator <span class="token function">erase</span><span class="token punctuation">(</span>const_iterator position<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">constexpr</span> iterator <span class="token function">erase</span><span class="token punctuation">(</span>const_iterator first<span class="token punctuation">,</span> const_iterator last<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">constexpr</span> <span class="token keyword">void</span> <span class="token function">clear</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">noexcept</span><span class="token punctuation">;</span>

<span class="token keyword">constexpr</span> <span class="token keyword">void</span> <span class="token function">swap</span><span class="token punctuation">(</span>static_vector<span class="token operator">&amp;</span> x<span class="token punctuation">)</span>
  <span class="token keyword">noexcept</span><span class="token punctuation">(</span>is_nothrow_swappable_v<span class="token operator">&lt;</span>value_type<span class="token operator">&gt;</span> <span class="token operator">&amp;&amp;</span>
           is_nothrow_move_constructible_v<span class="token operator">&lt;</span>value_type<span class="token operator">&gt;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token keyword">template</span><span class="token operator">&lt;</span><span class="token keyword">class</span> <span class="token class-name">InputIterator</span><span class="token operator">&gt;</span>
<span class="token function">static_vector</span><span class="token punctuation">(</span>InputIterator<span class="token punctuation">,</span> InputIterator<span class="token punctuation">)</span>
<span class="token operator">-&gt;</span> static_vector<span class="token operator">&lt;</span>iter<span class="token operator">-</span>value<span class="token operator">-</span>type<span class="token operator">&lt;</span>InputIterator<span class="token operator">&gt;&gt;</span><span class="token punctuation">;</span>

<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">typename</span> <span class="token class-name">T</span><span class="token punctuation">,</span> size_t N<span class="token operator">&gt;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">bool</span> <span class="token keyword">operator</span><span class="token operator">==</span><span class="token punctuation">(</span><span class="token keyword">const</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> a<span class="token punctuation">,</span> <span class="token keyword">const</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> b<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">typename</span> <span class="token class-name">T</span><span class="token punctuation">,</span> size_t N<span class="token operator">&gt;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">bool</span> <span class="token keyword">operator</span><span class="token operator">!=</span><span class="token punctuation">(</span><span class="token keyword">const</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> a<span class="token punctuation">,</span> <span class="token keyword">const</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> b<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">typename</span> <span class="token class-name">T</span><span class="token punctuation">,</span> size_t N<span class="token operator">&gt;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">bool</span> <span class="token keyword">operator</span><span class="token operator">&lt;</span><span class="token punctuation">(</span><span class="token keyword">const</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> a<span class="token punctuation">,</span> <span class="token keyword">const</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> b<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">typename</span> <span class="token class-name">T</span><span class="token punctuation">,</span> size_t N<span class="token operator">&gt;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">bool</span> <span class="token keyword">operator</span><span class="token operator">&lt;=</span><span class="token punctuation">(</span><span class="token keyword">const</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> a<span class="token punctuation">,</span> <span class="token keyword">const</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> b<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">typename</span> <span class="token class-name">T</span><span class="token punctuation">,</span> size_t N<span class="token operator">&gt;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">bool</span> <span class="token keyword">operator</span><span class="token operator">&gt;</span><span class="token punctuation">(</span><span class="token keyword">const</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> a<span class="token punctuation">,</span> <span class="token keyword">const</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> b<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">typename</span> <span class="token class-name">T</span><span class="token punctuation">,</span> size_t N<span class="token operator">&gt;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">bool</span> <span class="token keyword">operator</span><span class="token operator">&gt;=</span><span class="token punctuation">(</span><span class="token keyword">const</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> a<span class="token punctuation">,</span> <span class="token keyword">const</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> b<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// 5.8, specialized algorithms:</span>
<span class="token keyword">template</span> <span class="token operator">&lt;</span><span class="token keyword">typename</span> <span class="token class-name">T</span><span class="token punctuation">,</span> size_t N<span class="token operator">&gt;</span>
<span class="token keyword">constexpr</span> <span class="token keyword">void</span> <span class="token function">swap</span><span class="token punctuation">(</span>static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> x<span class="token punctuation">,</span> static_vector<span class="token operator">&lt;</span>T<span class="token punctuation">,</span> N<span class="token operator">&gt;</span><span class="token operator">&amp;</span> y<span class="token punctuation">)</span>
  <span class="token keyword">noexcept</span><span class="token punctuation">(</span><span class="token keyword">noexcept</span><span class="token punctuation">(</span>x<span class="token punctuation">.</span><span class="token function">swap</span><span class="token punctuation">(</span>y<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  
<span class="token punctuation">}</span>  <span class="token comment">// namespace std</span>
</code></pre><h2 id="containerssequencesstatic_vector-Class-template-static_vector" data-id="containerssequencesstatic_vector-Class-template-static_vector" style=""><a class="anchor hidden-xs" href="#containerssequencesstatic_vector-Class-template-static_vector" title="containerssequencesstatic_vector-Class-template-static_vector"><span class="octicon octicon-link"></span></a><span>[containers.sequences.static_vector] Class template </span><code>static_vector</code></h2><h3 id="containerssequencesstatic_vectoroverview-Overview" data-id="containerssequencesstatic_vectoroverview-Overview" style=""><a class="anchor hidden-xs" href="#containerssequencesstatic_vectoroverview-Overview" title="containerssequencesstatic_vectoroverview-Overview"><span class="octicon octicon-link"></span></a><span>[containers.sequences.static_vector.overview] Overview`</span></h3><ol>
<li><span>A </span><code>static_vector</code><span> is a contiguous container that supports constant time insert and erase operations at the end; insert and erase in the middle take linear time. Its capacity is part of its type and its elements are stored within the </span><code>static_vector</code><span> object itself, meaning that that if </span><code>v</code><span> is a  </span><code>static_vector&lt;T, N&gt;</code><span> then it obeys the identity </span><code>&amp;v[n] == &amp;v[0] + n</code><span> for all </span><code>0 &lt;= n &lt;= v.size()</code><span>.</span></li>
<li><span>A </span><code>static_vector</code><span> satisfies the container requirements</span><br>
<span>(</span><code>\ref{container.requirements}</code><span>) with the exception of the </span><code>swap</code><span> member function, whose complexity is linear instead of constant. It satisfies the sequence container requirements, including the optional sequence container requirements (</span><code>\ref{sequence.reqmts}</code><span>), with the exception of the </span><code>push_front</code><span>, </span><code>pop_front</code><span>, and </span><code>emplace_front</code><span> member functions, which are not provided. It satisfies the reversible container ([container.requirements]) and contiguous container ([container.requirements.general]) requirements. Descriptions are  provided here only for operations on </span><code>static_vector</code><span> that are not described in one of these tables or for operations where there is additional semantic information.</span></li>
<li><span>Class </span><code>static_vector</code><span> relies on the implicitly-declared special member functions [class.default.ctor], [class.dtor], and [class.copy.ctor] to conform to the container requirements table in [container.requirements]. In addition to the requirements specified in the container requirements table, the move constructor and move assignment operator for array require that </span><code>T</code><span> be </span><code>Cpp17MoveConstructible</code><span> or </span><code>Cpp17MoveAssignable</code><span>, respectively.</span></li>
<li><span>The types iterator and const_iterator meet the constexpr iterator</span><br>
<span>requirements ([iterator.requirements.general])."</span></li>
</ol><h3 id="-containerssequencesstatic_vectorcons-Constructors-copy-and-assignment" data-id="-containerssequencesstatic_vectorcons-Constructors-copy-and-assignment" style=""><a class="anchor hidden-xs" href="#-containerssequencesstatic_vectorcons-Constructors-copy-and-assignment" title="-containerssequencesstatic_vectorcons-Constructors-copy-and-assignment"><span class="octicon octicon-link"></span></a><a id="CONSTRUCTION" target="_blank" rel="noopener"></a><span> [containers.sequences.static_vector.cons] Constructors, copy, and assignment</span></h3><hr><pre><code class="c++ hljs"><span class="hljs-function"><span class="hljs-keyword">constexpr</span> <span class="hljs-title">static_vector</span><span class="hljs-params">()</span> <span class="hljs-keyword">noexcept</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Constructs an empty </span><code>static_vector</code><span>.</span></li>
<li><em><span>Postconditions</span></em><span>: </span><code>empty()</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Constant.</span></li>
</ul><hr><pre><code class="c++ hljs">constexpr static<span class="hljs-constructor">_vector(<span class="hljs-params">static_vector</span><span class="hljs-operator">&amp;&amp;</span> <span class="hljs-params">rv</span>)</span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Constructs a </span><code>static_vector</code><span> by move-inserting the elements of </span><code>rv</code><span>.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_move_constructible_v&lt;value_type&gt;</code><span> is true.</span></li>
<li><em><span>Postconditions</span></em><span>: The </span><code>static_vector</code><span> is equal to the value that </span><code>rv</code><span> had before this construction.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>rv.size()</code><span>.</span></li>
</ul><hr><pre><code class="c++ hljs"><span class="hljs-function"><span class="hljs-keyword">constexpr</span> <span class="hljs-keyword">explicit</span> <span class="hljs-title">static_vector</span><span class="hljs-params">(size_type n)</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Constructs a </span><code>static_vector</code><span> with </span><code>n</code><span> default-inserted elements.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_default_constructible_v&lt;value_type&gt;</code><span> is true.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>n &lt;= capacity()</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>n</code><span>.</span></li>
</ul><hr><pre><code class="c++ hljs">constexpr static<span class="hljs-constructor">_vector(<span class="hljs-params">size_type</span> <span class="hljs-params">n</span>, <span class="hljs-params">const</span> <span class="hljs-params">value_type</span>&amp; <span class="hljs-params">value</span>)</span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Constructs a </span><code>static_vector</code><span> with </span><code>n</code><span> copies of </span><code>value</code><span>.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_copy_constructible_v&lt;value_type&gt;</code><span> is true.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>n &lt;= capacity()</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>n</code><span>.</span></li>
</ul><hr><pre><code class="c++ hljs"><span class="hljs-keyword">template</span> &lt;<span class="hljs-keyword">class</span> <span class="hljs-title class_">InputIterator</span>&gt;
<span class="hljs-function"><span class="hljs-keyword">constexpr</span> <span class="hljs-title">static_vector</span><span class="hljs-params">(InputIterator first, InputIterator last)</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Constructs a </span><code>static_vector</code><span> equal to the range </span><code>[first, last)</code><span>.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_constructible_v&lt;value_type, decltype(*first)&gt;</code><span> is true.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>distance(first, last) &lt;= capacity()</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>distance(first, last)</code><span>.</span></li>
</ul><h3 id="-containerssequencesstatic_vectordestructor-Destruction" data-id="-containerssequencesstatic_vectordestructor-Destruction" style=""><a class="anchor hidden-xs" href="#-containerssequencesstatic_vectordestructor-Destruction" title="-containerssequencesstatic_vectordestructor-Destruction"><span class="octicon octicon-link"></span></a><a id="DESTRUCTION" target="_blank" rel="noopener"></a><span> [containers.sequences.static_vector.destructor] Destruction</span></h3><pre><code class="c++ hljs">constexpr ~<span class="hljs-built_in">static_vector</span>();
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Destroys the </span><code>static_vector</code><span> and its elements.</span></li>
<li><em><span>Remarks</span></em><span>: This destructor is trivial if the destructor of </span><code>value_type</code><span> is trivial.</span></li>
</ul><h3 id="-containerssequencesstatic_vectorcapacity-Size-and-capacity" data-id="-containerssequencesstatic_vectorcapacity-Size-and-capacity" style=""><a class="anchor hidden-xs" href="#-containerssequencesstatic_vectorcapacity-Size-and-capacity" title="-containerssequencesstatic_vectorcapacity-Size-and-capacity"><span class="octicon octicon-link"></span></a><a id="SIZE" target="_blank" rel="noopener"></a><span> [containers.sequences.static_vector.capacity] Size and capacity</span></h3><pre><code class="c++ hljs"><span class="hljs-title">static</span> constexpr size_<span class="hljs-keyword">type</span> capacity() noexcept
<span class="hljs-title">static</span> constexpr size_<span class="hljs-keyword">type</span> max_size() noexcept
</code></pre><ul>
<li><em><span>Returns</span></em><span>: </span><code>N</code><span>.</span></li>
</ul><hr><pre><code class="c++ hljs"><span class="hljs-function"><span class="hljs-keyword">constexpr</span> <span class="hljs-type">void</span> <span class="hljs-title">resize</span><span class="hljs-params">(size_type sz)</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: If </span><code>sz &lt; size()</code><span>, erases the last </span><code>size() - sz</code><span> elements from the sequence. Otherwise, appends </span><code>sz - size()</code><span> default-constructed elements.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_default_constructible_v&lt;value_type&gt;</code><span> is true.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>sz &lt;= capacity()</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>sz</code><span>.</span></li>
</ul><hr><pre><code class="c++ hljs"><span class="hljs-function"><span class="hljs-keyword">constexpr</span> <span class="hljs-type">void</span> <span class="hljs-title">resize</span><span class="hljs-params">(size_type sz, <span class="hljs-type">const</span> value_type&amp; c)</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: If </span><code>sz &lt; size()</code><span>, erases the last </span><code>size() - sz</code><span> elements from the sequence. Otherwise, appends </span><code>sz - size()</code><span> copies of </span><code>c</code><span>.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_copy_constructible_v&lt;value_type&gt;</code><span> is true.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>sz &lt;= capacity()</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>sz</code><span>.</span></li>
</ul><h3 id="-containerssequencesstatic_vectordata" data-id="-containerssequencesstatic_vectordata" style=""><a class="anchor hidden-xs" href="#-containerssequencesstatic_vectordata" title="-containerssequencesstatic_vectordata"><span class="octicon octicon-link"></span></a><a id="ACCESS" target="_blank" rel="noopener"></a><span> [containers.sequences.static_vector.data]</span></h3><p><span>Element and data access</span></p><pre><code class="c++ hljs"><span class="hljs-function"><span class="hljs-keyword">constexpr</span>       T* <span class="hljs-title">data</span><span class="hljs-params">()</span>       <span class="hljs-keyword">noexcept</span></span>;
<span class="hljs-function"><span class="hljs-keyword">constexpr</span> <span class="hljs-type">const</span> T* <span class="hljs-title">data</span><span class="hljs-params">()</span> <span class="hljs-type">const</span> <span class="hljs-keyword">noexcept</span></span>;
</code></pre><ul>
<li><em><span>Returns</span></em><span>: A pointer such that </span><code>[data(), data() + size())</code><span> is a valid range. For a non-empty </span><code>static_vector</code><span>, </span><code>data() == addressof(front())</code><span>.</span></li>
<li><em><span>Complexity</span></em><span>: Constant time.</span></li>
</ul><h3 id="-containerssequencesstatic_vectormodifiers" data-id="-containerssequencesstatic_vectormodifiers" style=""><a class="anchor hidden-xs" href="#-containerssequencesstatic_vectormodifiers" title="-containerssequencesstatic_vectormodifiers"><span class="octicon octicon-link"></span></a><a id="MODIFIERS" target="_blank" rel="noopener"></a><span> [containers.sequences.static_vector.modifiers]</span></h3><p><span>Modifiers</span></p><hr><p><ins><strong><span>Note to LWG:</span></strong></ins><span> All modifiers have a pre-condition on not exceeding the</span><br>
<code>capacity()</code><span> when inserting elements. That is, exceeding the </span><code>capacity()</code><span> of the vector is undefined behavior. This supports some of the major use cases of this container (embedded, freestanding, etc.) and was required by the stakeholders during LEWG review. Currently, this provides maximum freedom to the implementation to choose an appropriate behavior: </span><code>abort</code><span>, </span><code>assert</code><span>, throw an exception (which exception? </span><code>bad_alloc</code><span>? </span><code>std::length_error</code><span>? </span><code>logic_error</code><span>? </span><code>out_of_bounds</code><span>? etc.). In the future, this freedom allows us to specify these pre-conditions using contracts.</span></p><p><span>Note to LWG: Because all modifiers have preconditions, they all have narrow contracts and are not unconditionally </span><code>noexcept</code><span>.</span></p><hr><pre><code class="c++ hljs"><span class="hljs-function"><span class="hljs-keyword">constexpr</span> iterator <span class="hljs-title">insert</span><span class="hljs-params">(const_iterator position, <span class="hljs-type">const</span> value_type&amp; x)</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Inserts </span><code>x</code><span> at </span><code>position</code><span> and invalidates all references to elements after </span><code>position</code><span>.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>size() &lt; capacity()</code><span> is true.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_copy_constructible_v&lt;value_type&gt;</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>size()</code><span>.</span></li>
<li><em><span>Remarks</span></em><span>: If an exception is thrown by </span><code>value_type</code><span>’s copy constructor and </span><code>is_nothrow_move_constructible_v&lt;value_type&gt;</code><span> is </span><code>true</code><span> there are no effects. Otherwise, if an exception is thrown by </span><code>value_type</code><span>’s copy constructor the effects are </span><em><span>unspecified</span></em><span>.</span></li>
</ul><hr><pre><code class="c++ hljs"><span class="hljs-function"><span class="hljs-keyword">constexpr</span> iterator <span class="hljs-title">insert</span><span class="hljs-params">(const_iterator position, size_type n, <span class="hljs-type">const</span> value_type&amp; x)</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Inserts </span><code>n</code><span> copies of </span><code>x</code><span> at </span><code>position</code><span> and invalidates all references to elements after </span><code>position</code><span>.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>n &lt;= capacity() - size()</code><span> is true.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_copy_constructible_v&lt;value_type&gt;</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>size()</code><span> and </span><code>n</code><span>.</span></li>
<li><em><span>Remarks</span></em><span>: If an exception is thrown by </span><code>value_type</code><span>’s copy constructor and </span><code>is_nothrow_move_constructible_v&lt;value_type&gt;</code><span> is </span><code>true</code><span> there are no effects. Otherwise, if an exception is thrown by </span><code>value_type</code><span>’s copy constructor the effects are </span><em><span>unspecified</span></em><span>.</span></li>
</ul><hr><pre><code class="c++ hljs"><span class="hljs-function"><span class="hljs-keyword">constexpr</span> iterator <span class="hljs-title">insert</span><span class="hljs-params">(const_iterator position, value_type&amp;&amp; x)</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Inserts </span><code>x</code><span> at </span><code>position</code><span> and invalidates all references to elements after </span><code>position</code><span>.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>size() &lt; capacity()</code><span> is true.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_move_constructible_v&lt;value_type&gt;</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>size()</code><span>.</span></li>
<li><em><span>Remarks</span></em><span>: If an exception is thrown by </span><code>value_type</code><span>’s move constructor the effects are </span><em><span>unspecified</span></em><span>.</span></li>
</ul><hr><pre><code class="c++ hljs"><span class="hljs-keyword">template</span> &lt;<span class="hljs-keyword">typename</span> InputIterator&gt;
<span class="hljs-function"><span class="hljs-keyword">constexpr</span> iterator <span class="hljs-title">insert</span><span class="hljs-params">(const_iterator position, InputIterator first, InputIterator last)</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Inserts elements in range </span><code>[first, last)</code><span> at </span><code>position</code><span> and invalidates all references to elements after </span><code>position</code><span>.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>distance(first, last) &lt;= capacity() - size()</code><span> is true.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_constructible_v&lt;value_type, decltype(*first)&gt;</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>size()</code><span> and </span><code>distance(first, last)</code><span>.</span></li>
<li><em><span>Remarks</span></em><span>: If an exception is thrown by </span><code>value_type</code><span> constructor from </span><code>decltype(*first)</code><span> and </span><code>is_nothrow_move_constructible_v&lt;value_type&gt;</code><span> is </span><code>true</code><span> there are no effects. Otherwise, if an exception is thrown by </span><code>value_type</code><span>’s constructor from </span><code>decltype(*first)</code><span> the effects are </span><em><span>unspecified</span></em><span>.</span></li>
</ul><hr><pre><code class="c++ hljs"><span class="hljs-function"><span class="hljs-keyword">constexpr</span> iterator <span class="hljs-title">insert</span><span class="hljs-params">(const_iterator position, initializer_list&lt;value_type&gt; il)</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Inserts elements of </span><code>il</code><span> at </span><code>position</code><span> and invalidates all references to elements after </span><code>position</code><span>.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>il.size() &lt;= capacity() - size()</code><span> is true.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_copy_constructible_v&lt;value_type&gt;</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>size()</code><span> and </span><code>il.size()</code><span>.</span></li>
<li><em><span>Remarks</span></em><span>: If an exception is thrown by </span><code>value_type</code><span>’s copy constructor and </span><code>is_nothrow_move_constructible_v&lt;value_type&gt;</code><span> is </span><code>true</code><span> there are no effects. Otherwise, if an exception is thrown by </span><code>value_type</code><span>’s copy constructor the effects are </span><em><span>unspecified</span></em><span>.</span></li>
</ul><hr><pre><code class="c++ hljs">template <span class="hljs-operator">&lt;</span>class... Args<span class="hljs-operator">&gt;</span>
constexpr iterator emplace(const_iterator position, Args<span class="hljs-operator">&amp;</span><span class="hljs-operator">&amp;</span>... args);
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Inserts an element constructed from </span><code>args...</code><span> at </span><code>position</code><span> and invalidates all references to elements after </span><code>position</code><span>.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>size() &lt; capacity()</code><span> is true.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_constructible_v&lt;value_type, Args...&gt;</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>size()</code><span>.</span></li>
<li><em><span>Remarks</span></em><span>: If an exception is thrown by </span><code>value_type</code><span>’s constructor from </span><code>args...</code><span> and </span><code>is_nothrow_move_constructible_v&lt;value_type&gt;</code><span> is </span><code>true</code><span> there are no effects. Otherwise, if an exception is thrown by </span><code>value_type</code><span>’s constructor from </span><code>args...</code><span> the effects are </span><em><span>unspecified</span></em><span>.</span></li>
</ul><hr><pre><code class="c++ hljs">template <span class="hljs-operator">&lt;</span>class... Args<span class="hljs-operator">&gt;</span>
constexpr reference emplace_back(Args<span class="hljs-operator">&amp;</span><span class="hljs-operator">&amp;</span>... args);
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Inserts an element constructed from </span><code>args...</code><span> at the end.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>size() &lt; capacity()</code><span> is true.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_constructible_v&lt;value_type, Args...&gt;</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Constant.</span></li>
<li><em><span>Remarks</span></em><span>: If an exception is thrown by </span><code>value_type</code><span>’s constructor from </span><code>args...</code><span> there are no effects.</span></li>
</ul><hr><pre><code class="c++ hljs"><span class="hljs-function"><span class="hljs-keyword">constexpr</span> <span class="hljs-type">void</span> <span class="hljs-title">push_back</span><span class="hljs-params">(<span class="hljs-type">const</span> value_type&amp; x)</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Inserts a copy of </span><code>x</code><span> at the end.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>size() &lt; capacity()</code><span> is true.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_copy_constructible_v&lt;value_type&gt;</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Constant.</span></li>
<li><em><span>Remarks</span></em><span>: If an exception is thrown by </span><code>value_type</code><span>’s copy constructor there are no effects.</span></li>
</ul><hr><pre><code class="c++ hljs"><span class="hljs-function"><span class="hljs-keyword">constexpr</span> <span class="hljs-type">void</span> <span class="hljs-title">push_back</span><span class="hljs-params">(value_type&amp;&amp; x)</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Moves </span><code>x</code><span> to the end.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>size() &lt; capacity()</code><span> is true.</span></li>
<li><em><span>Mandates</span></em><span>: </span><code>is_move_constructible_v&lt;value_type&gt;</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Constant.</span></li>
<li><em><span>Remarks</span></em><span>: If an exception is thrown by </span><code>value_type</code><span>’s move constructor there are no effects.</span></li>
</ul><hr><pre><code class="c++ hljs"><span class="hljs-function">constexpr <span class="hljs-keyword">void</span> <span class="hljs-title">pop_back</span>()</span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Removes the last element of the container and destroys it.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>!empty()</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Constant.</span></li>
</ul><h3 id="-containerssequencesstatic_vectorerasure-Erasure" data-id="-containerssequencesstatic_vectorerasure-Erasure" style=""><a class="anchor hidden-xs" href="#-containerssequencesstatic_vectorerasure-Erasure" title="-containerssequencesstatic_vectorerasure-Erasure"><span class="octicon octicon-link"></span></a><a id="MODIFIERS" target="_blank" rel="noopener"></a><span> [containers.sequences.static_vector.erasure] Erasure</span></h3><pre><code class="c++ hljs"><span class="hljs-function"><span class="hljs-keyword">constexpr</span> iterator <span class="hljs-title">erase</span><span class="hljs-params">(const_iterator position)</span></span>;
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Removes the element at </span><code>position</code><span>, destroys it, and invalidates references to elements after </span><code>position</code><span>.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>position</code><span> in range </span><code>[begin(), end())</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>size()</code><span>.</span></li>
<li><em><span>Remarks</span></em><span>: If an exception is thrown by </span><code>value_type</code><span>’s move constructor the effects are </span><em><span>unspecified</span></em><span>.</span></li>
</ul><hr><pre><code class="c++ hljs">constexpr iterator erase(const_iterator <span class="hljs-keyword">first</span>, const_iterator <span class="hljs-keyword">last</span>);
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Removes the elements in range </span><code>[first, last)</code><span>, destroying them, and invalidating references to elements after </span><code>last</code><span>.</span></li>
<li><em><span>Preconditions</span></em><span>: </span><code>[first, last)</code><span> in range </span><code>[begin(), end())</code><span> is true.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>size()</code><span> and </span><code>distance(first, last)</code><span>.</span></li>
<li><em><span>Remarks</span></em><span>: If an exception is thrown by </span><code>value_type</code><span>’s move constructor the effects are </span><em><span>unspecified</span></em><span>.</span></li>
</ul><hr><pre><code class="c++ hljs">constexpr void swap(static_vector<span class="hljs-operator">&amp;</span> x)
  noexcept(is_nothrow_swappable_v<span class="hljs-operator">&lt;</span>value_type<span class="hljs-operator">&gt;</span> <span class="hljs-operator">&amp;</span><span class="hljs-operator">&amp;</span>
           is_nothrow_move_constructible_v<span class="hljs-operator">&lt;</span>value_type<span class="hljs-operator">&gt;</span>);
</code></pre><ul>
<li><em><span>Effects</span></em><span>: Exchanges the contents of </span><code>*this</code><span> with </span><code>x</code><span>. All references to the elements of </span><code>*this</code><span> and </span><code>x</code><span> are invalidated.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>size()</code><span> and </span><code>x.size()</code><span>.</span></li>
<li><em><span>Remarks</span></em><span>: Shall not participate in overload resolution unless </span><code>is_move_constructible_v&lt;value_type&gt;</code><span> is </span><code>true</code><span> and </span><code>is_swappable_v&lt;value_type&gt;</code><span> is </span><code>true</code><span>.</span></li>
</ul><h3 id="-containerssequencesstatic_vectorspecial-Specialized-algorithms" data-id="-containerssequencesstatic_vectorspecial-Specialized-algorithms" style=""><a class="anchor hidden-xs" href="#-containerssequencesstatic_vectorspecial-Specialized-algorithms" title="-containerssequencesstatic_vectorspecial-Specialized-algorithms"><span class="octicon octicon-link"></span></a><a id="SPEC_ALG" target="_blank" rel="noopener"></a><span> [containers.sequences.static_vector.special] Specialized algorithms</span></h3><pre><code class="c++ hljs">template <span class="hljs-operator">&lt;</span>typename T, size_t N<span class="hljs-operator">&gt;</span>
constexpr void swap(static_vector<span class="hljs-operator">&lt;</span>T, N<span class="hljs-operator">&gt;</span><span class="hljs-operator">&amp;</span> x, 
                    static_vector<span class="hljs-operator">&lt;</span>T, N<span class="hljs-operator">&gt;</span><span class="hljs-operator">&amp;</span> y)
  noexcept(noexcept(x.swap(y)));
</code></pre><ul>
<li><em><span>Constraints</span></em><span>: This function shall not participate in overload resolution unless </span><code>is_swappable_v&lt;T&gt;</code><span> is </span><code>true</code><span>.</span></li>
<li><em><span>Effects</span></em><span>: As if by </span><code>x.swap(y)</code><span>.</span></li>
<li><em><span>Complexity</span></em><span>: Linear in </span><code>size()</code><span> and </span><code>x.size()</code><span>.</span></li>
</ul><h3 id="TODOS" data-id="TODOS" style=""><a class="anchor hidden-xs" href="#TODOS" title="TODOS"><span class="octicon octicon-link"></span></a><span>TODOS:</span></h3><ul>
<li><span>Add a specialization of hash like for </span><code>std::vector</code><span>.</span></li>
<li><span>Update </span><code>operator!=</code><span> to </span><code>operator&lt;=&gt;</code><span> using hidden friends for them.</span></li>
<li><span>Add deduction guides (there is only one, do we need more).</span></li>
</ul><h1 id="Acknowledgments" data-id="Acknowledgments" style=""><a class="anchor hidden-xs" href="#Acknowledgments" title="Acknowledgments"><span class="octicon octicon-link"></span></a><a id="ACKNOWLEDGEMENTS" target="_blank" rel="noopener"></a><span>Acknowledgments</span></h1><p><span>This proposal is based on Boost.Container’s </span><code>boost::container::static_vector</code><span>, mainly authored by Adam Wulkiewicz, Andrew Hundt, and Ion Gaztanaga. The reference implementation is based on Howard Hinnant </span><code>std::vector</code><span> implementation in libc++ and its test-suite. The following people provided valuable feedback that influenced some aspects of this proposal: Walter Brown, Zach Laine, Rein</span><br>
<span>Halbersma, and Andrzej Krzemieński. I want to wholeheartedly acknowledge Casey Carter for taking the time to do a very detailed analysis of the whole proposal, which was invaluable and reshaped it in fundamental ways.</span></p><h1 id="References" data-id="References" style=""><a class="anchor hidden-xs" href="#References" title="References"><span class="octicon octicon-link"></span></a><a id="REFERENCES" target="_blank" rel="noopener"></a><span>References</span></h1><ul>
<li><span>[1] </span><a href="http://www.boost.org/doc/libs/1_59_0/doc/html/boost/container/static_vector.html" target="_blank" rel="noopener"><span>Boost.Container::static_vector</span></a><span>: </span><a href="http://www.boost.org/doc/libs/1_59_0/doc/html/boost/container/static_vector.html" target="_blank" rel="noopener"><span>http://www.boost.org/doc/libs/1_59_0/doc/html/boost/container/static_vector.html</span></a><span> .</span></li>
<li><span>[2] </span><a href="https://github.com/questor/eastl/blob/master/fixed_vector.h#L71" target="_blank" rel="noopener"><span>EASTL fixed_vector</span></a><span>: </span><a href="https://github.com/questor/eastl/blob/master/fixed_vector.h#L71" target="_blank" rel="noopener"><span>https://github.com/questor/eastl/blob/master/fixed_vector.h#L71</span></a><span> .</span></li>
<li><span>[3] </span><a href="https://github.com/facebook/folly/blob/master/folly/docs/small_vector.md" target="_blank" rel="noopener"><span>Folly small_vector</span></a><span>: </span><a href="https://github.com/facebook/folly/blob/master/folly/docs/small_vector.md" target="_blank" rel="noopener"><span>https://github.com/facebook/folly/blob/master/folly/docs/small_vector.md</span></a><span> .</span></li>
<li><span>[4] </span><a href="https://howardhinnant.github.io/stack_alloc.html" target="_blank" rel="noopener"><span>Howard Hinnant’s stack_alloc</span></a><span>:  </span><a href="https://howardhinnant.github.io/stack_alloc.html" target="_blank" rel="noopener"><span>https://howardhinnant.github.io/stack_alloc.html</span></a><span> .</span></li>
<li><span>[5] </span><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0494r0.pdf" target="_blank" rel="noopener"><span>P0494R0: </span><code>contiguous_container</code><span> proposal</span></a><span>: </span><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0494r0.pdf" target="_blank" rel="noopener"><span>http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0494r0.pdf</span></a></li>
<li><span>[6] </span><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0597r0.html" target="_blank" rel="noopener"><span>P0597R0: </span><code>std::constexpr_vector&lt;T&gt;</code></a><span>: </span><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0597r0.html" target="_blank" rel="noopener"><span>http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0597r0.html</span></a></li>
<li><span>[7] </span><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0639r0.html" target="_blank" rel="noopener"><span>P0639R0: Changing attack vector of the </span><code>constexpr_vector</code></a><span>: </span><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0639r0.html" target="_blank" rel="noopener"><span>http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0639r0.html</span></a><span> .</span></li>
<li><span>[8] </span><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0274r0.pdf" target="_blank" rel="noopener"><span>PR0274: Clump – A Vector-like Contiguous Sequence Container with Embedded Storage</span></a><span>: </span><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0274r0.pdf" target="_blank" rel="noopener"><span>http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0274r0.pdf</span></a></li>
<li><span>[9] </span><a href="http://www.boost.org/doc/libs/master/doc/html/boost/container/small_vector.html" target="_blank" rel="noopener"><span>Boost.Container::small_vector</span></a><span>: </span><a href="http://www.boost.org/doc/libs/master/doc/html/boost/container/small_vector.html" target="_blank" rel="noopener"><span>http://www.boost.org/doc/libs/master/doc/html/boost/container/small_vector.html</span></a><span>.</span></li>
<li><span>[10] </span><a href="http://llvm.org/docs/doxygen/html/classllvm_1_1SmallVector.html" target="_blank" rel="noopener"><span>LLVM small_vector</span></a><span>: </span><a href="http://llvm.org/docs/doxygen/html/classllvm_1_1SmallVector.html" target="_blank" rel="noopener"><span>http://llvm.org/docs/doxygen/html/classllvm_1_1SmallVector.html</span></a><span> .</span></li>
<li><span>[11] </span><a href="https://github.com/questor/eastl/blob/master/doc/EASTL%20Design.html#L284" target="_blank" rel="noopener"><span>EASTL design</span></a><span>: </span><a href="https://github.com/questor/eastl/blob/master/doc/EASTL%20Design.html#L284" target="_blank" rel="noopener"><span>https://github.com/questor/eastl/blob/master/doc/EASTL Design.html#L284</span></a><span> .</span></li>
<li><span>[12] </span><a href="https:%3E%3Egroups.google.com%3Ed%3Etopic%3Eboost-developers-archive%3E4n1QuJyKTTk%3Ediscussion" target="_blank" rel="noopener"><span>Interest in StaticVector - fixed capacity vector</span></a><span>:  </span><a href="https://groups.google.com/d/topic/boost-developers-archive/4n1QuJyKTTk/discussion" target="_blank" rel="noopener"><span>https://groups.google.com/d/topic/boost-developers-archive/4n1QuJyKTTk/discussion</span></a><span> .</span></li>
<li><span>[13] </span><a href="https:%3E%3Egroups.google.com%3Ed%3Etopic%3Eboost-developers-archive%3E9BEXjV8ZMeQ%3Ediscussion" target="_blank" rel="noopener"><span>Stack-based vector container</span></a><span>: </span><a href="https://groups.google.com/d/topic/boost-developers-archive/9BEXjV8ZMeQ/discussion" target="_blank" rel="noopener"><span>https://groups.google.com/d/topic/boost-developers-archive/9BEXjV8ZMeQ/discussion</span></a><span>.</span></li>
<li><span>[14] </span><a href="https:%3E%3Egroups.google.com%3Ed%3Etopic%3Eboost-developers-archive%3Ed5_Kp-nmW6c%3Ediscussion" target="_blank" rel="noopener"><span>static_vector: fixed capacity vector update</span></a><span>: </span><a href="https://groups.google.com/d/topic/boost-developers-archive/d5_Kp-nmW6c/discussion" target="_blank" rel="noopener"><span>https://groups.google.com/d/topic/boost-developers-archive/d5_Kp-nmW6c/discussion</span></a><span>.</span></li>
</ul></div>
    <div class="ui-toc dropup unselectable hidden-print" style="display:none;">
        <div class="pull-right dropdown">
            <a id="tocLabel" class="ui-toc-label btn btn-default" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false" title="Table of content">
                <i class="fa fa-bars"></i>
            </a>
            <ul id="ui-toc" class="ui-toc-dropdown dropdown-menu" aria-labelledby="tocLabel">
                <div class="toc"><ul class="nav">
<li><a href="#static_vector" title="static_vector">static_vector</a></li>
<li><a href="#Introduction" title="Introduction">Introduction</a></li>
<li><a href="#Motivation-and-Scope" title="Motivation and Scope">Motivation and Scope</a></li>
<li><a href="#Existing-practice" title="Existing practice">Existing practice</a></li>
<li><a href="#Design" title="Design">Design</a><ul class="nav">
<li><a href="#Layout" title="Layout">Layout</a></li>
<li><a href="#Move-semantics" title="Move semantics">Move semantics</a></li>
<li><a href="#constexpr-support" title="constexpr support">constexpr support</a></li>
<li><a href="#Exception-Safety" title="Exception Safety">Exception Safety</a></li>
<li><a href="#Iterator-invalidation" title="Iterator invalidation">Iterator invalidation</a></li>
</ul>
</li>
<li><a href="#Naming" title="Naming">Naming</a></li>
<li><a href="#Technical-specification" title="Technical specification">Technical specification</a><ul class="nav">
<li><a href="#libraryrequirementsorganizationheaders" title="[library.requirements.organization.headers]">[library.requirements.organization.headers]</a></li>
<li><a href="#libraryrequirementsorganizationcompliance" title="[library.requirements.organization.compliance]">[library.requirements.organization.compliance]</a></li>
<li><a href="#containerreqmts-General-container-requirements" title="[container.reqmts] General container requirements">[container.reqmts] General container requirements</a></li>
<li><a href="#containerrequirementssequencereqmts" title="[container.requirements.sequence.reqmts]">[container.requirements.sequence.reqmts]</a></li>
<li><a href="#containerssequencesstatic_vectorsyn-Header-ltstatic_vectorgt-synopsis" title="[containers.sequences.static_vector.syn] Header <static_vector> synopsis">[containers.sequences.static_vector.syn] Header &lt;static_vector&gt; synopsis</a></li>
<li><a href="#containerssequencesstatic_vector-Class-template-static_vector" title="[containers.sequences.static_vector] Class template static_vector">[containers.sequences.static_vector] Class template static_vector</a><ul class="nav">
<li><a href="#containerssequencesstatic_vectoroverview-Overview" title="[containers.sequences.static_vector.overview] Overview`">[containers.sequences.static_vector.overview] Overview`</a></li>
<li><a href="#-containerssequencesstatic_vectorcons-Constructors-copy-and-assignment" title=" [containers.sequences.static_vector.cons] Constructors, copy, and assignment"> [containers.sequences.static_vector.cons] Constructors, copy, and assignment</a></li>
<li><a href="#-containerssequencesstatic_vectordestructor-Destruction" title=" [containers.sequences.static_vector.destructor] Destruction"> [containers.sequences.static_vector.destructor] Destruction</a></li>
<li><a href="#-containerssequencesstatic_vectorcapacity-Size-and-capacity" title=" [containers.sequences.static_vector.capacity] Size and capacity"> [containers.sequences.static_vector.capacity] Size and capacity</a></li>
<li><a href="#-containerssequencesstatic_vectordata" title=" [containers.sequences.static_vector.data]"> [containers.sequences.static_vector.data]</a></li>
<li><a href="#-containerssequencesstatic_vectormodifiers" title=" [containers.sequences.static_vector.modifiers]"> [containers.sequences.static_vector.modifiers]</a></li>
<li><a href="#-containerssequencesstatic_vectorerasure-Erasure" title=" [containers.sequences.static_vector.erasure] Erasure"> [containers.sequences.static_vector.erasure] Erasure</a></li>
<li><a href="#-containerssequencesstatic_vectorspecial-Specialized-algorithms" title=" [containers.sequences.static_vector.special] Specialized algorithms"> [containers.sequences.static_vector.special] Specialized algorithms</a></li>
<li><a href="#TODOS" title="TODOS:">TODOS:</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#Acknowledgments" title="Acknowledgments">Acknowledgments</a></li>
<li><a href="#References" title="References">References</a></li>
</ul>
</div><div class="toc-menu"><a class="expand-toggle" href="#">Expand all</a><a class="back-to-top" href="#">Back to top</a><a class="go-to-bottom" href="#">Go to bottom</a></div>
            </ul>
        </div>
    </div>
    <div id="ui-toc-affix" class="ui-affix-toc ui-toc-dropdown unselectable hidden-print" data-spy="affix" style="top:17px;display:none;" null null>
        <div class="toc"><ul class="nav">
<li><a href="#static_vector" title="static_vector">static_vector</a></li>
<li><a href="#Introduction" title="Introduction">Introduction</a></li>
<li><a href="#Motivation-and-Scope" title="Motivation and Scope">Motivation and Scope</a></li>
<li><a href="#Existing-practice" title="Existing practice">Existing practice</a></li>
<li><a href="#Design" title="Design">Design</a><ul class="nav">
<li><a href="#Layout" title="Layout">Layout</a></li>
<li><a href="#Move-semantics" title="Move semantics">Move semantics</a></li>
<li><a href="#constexpr-support" title="constexpr support">constexpr support</a></li>
<li><a href="#Exception-Safety" title="Exception Safety">Exception Safety</a></li>
<li><a href="#Iterator-invalidation" title="Iterator invalidation">Iterator invalidation</a></li>
</ul>
</li>
<li><a href="#Naming" title="Naming">Naming</a></li>
<li><a href="#Technical-specification" title="Technical specification">Technical specification</a><ul class="nav">
<li><a href="#libraryrequirementsorganizationheaders" title="[library.requirements.organization.headers]">[library.requirements.organization.headers]</a></li>
<li><a href="#libraryrequirementsorganizationcompliance" title="[library.requirements.organization.compliance]">[library.requirements.organization.compliance]</a></li>
<li><a href="#containerreqmts-General-container-requirements" title="[container.reqmts] General container requirements">[container.reqmts] General container requirements</a></li>
<li><a href="#containerrequirementssequencereqmts" title="[container.requirements.sequence.reqmts]">[container.requirements.sequence.reqmts]</a></li>
<li><a href="#containerssequencesstatic_vectorsyn-Header-ltstatic_vectorgt-synopsis" title="[containers.sequences.static_vector.syn] Header <static_vector> synopsis">[containers.sequences.static_vector.syn] Header &lt;static_vector&gt; synopsis</a></li>
<li><a href="#containerssequencesstatic_vector-Class-template-static_vector" title="[containers.sequences.static_vector] Class template static_vector">[containers.sequences.static_vector] Class template static_vector</a><ul class="nav">
<li><a href="#containerssequencesstatic_vectoroverview-Overview" title="[containers.sequences.static_vector.overview] Overview`">[containers.sequences.static_vector.overview] Overview`</a></li>
<li><a href="#-containerssequencesstatic_vectorcons-Constructors-copy-and-assignment" title=" [containers.sequences.static_vector.cons] Constructors, copy, and assignment"> [containers.sequences.static_vector.cons] Constructors, copy, and assignment</a></li>
<li><a href="#-containerssequencesstatic_vectordestructor-Destruction" title=" [containers.sequences.static_vector.destructor] Destruction"> [containers.sequences.static_vector.destructor] Destruction</a></li>
<li><a href="#-containerssequencesstatic_vectorcapacity-Size-and-capacity" title=" [containers.sequences.static_vector.capacity] Size and capacity"> [containers.sequences.static_vector.capacity] Size and capacity</a></li>
<li><a href="#-containerssequencesstatic_vectordata" title=" [containers.sequences.static_vector.data]"> [containers.sequences.static_vector.data]</a></li>
<li><a href="#-containerssequencesstatic_vectormodifiers" title=" [containers.sequences.static_vector.modifiers]"> [containers.sequences.static_vector.modifiers]</a></li>
<li><a href="#-containerssequencesstatic_vectorerasure-Erasure" title=" [containers.sequences.static_vector.erasure] Erasure"> [containers.sequences.static_vector.erasure] Erasure</a></li>
<li><a href="#-containerssequencesstatic_vectorspecial-Specialized-algorithms" title=" [containers.sequences.static_vector.special] Specialized algorithms"> [containers.sequences.static_vector.special] Specialized algorithms</a></li>
<li><a href="#TODOS" title="TODOS:">TODOS:</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#Acknowledgments" title="Acknowledgments">Acknowledgments</a></li>
<li><a href="#References" title="References">References</a></li>
</ul>
</div><div class="toc-menu"><a class="expand-toggle" href="#">Expand all</a><a class="back-to-top" href="#">Back to top</a><a class="go-to-bottom" href="#">Go to bottom</a></div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous" defer></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.6.0/gist-embed.min.js" integrity="sha256-KyF2D6xPIJUW5sUDSs93vWyZm+1RzIpKCexxElmxl8g=" crossorigin="anonymous" defer></script>
    <script>
        var markdown = $(".markdown-body");
        //smooth all hash trigger scrolling
        function smoothHashScroll() {
            var hashElements = $("a[href^='#']").toArray();
            for (var i = 0; i < hashElements.length; i++) {
                var element = hashElements[i];
                var $element = $(element);
                var hash = element.hash;
                if (hash) {
                    $element.on('click', function (e) {
                        // store hash
                        var hash = this.hash;
                        if ($(hash).length <= 0) return;
                        // prevent default anchor click behavior
                        e.preventDefault();
                        // animate
                        $('body, html').stop(true, true).animate({
                            scrollTop: $(hash).offset().top
                        }, 100, "linear", function () {
                            // when done, add hash to url
                            // (default click behaviour)
                            window.location.hash = hash;
                        });
                    });
                }
            }
        }

        smoothHashScroll();
        var toc = $('.ui-toc');
        var tocAffix = $('.ui-affix-toc');
        var tocDropdown = $('.ui-toc-dropdown');
        //toc
        tocDropdown.click(function (e) {
            e.stopPropagation();
        });

        var enoughForAffixToc = true;

        function generateScrollspy() {
            $(document.body).scrollspy({
                target: ''
            });
            $(document.body).scrollspy('refresh');
            if (enoughForAffixToc) {
                toc.hide();
                tocAffix.show();
            } else {
                tocAffix.hide();
                toc.show();
            }
            $(document.body).scroll();
        }

        function windowResize() {
            //toc right
            var paddingRight = parseFloat(markdown.css('padding-right'));
            var right = ($(window).width() - (markdown.offset().left + markdown.outerWidth() - paddingRight));
            toc.css('right', right + 'px');
            //affix toc left
            var newbool;
            var rightMargin = (markdown.parent().outerWidth() - markdown.outerWidth()) / 2;
            //for ipad or wider device
            if (rightMargin >= 133) {
                newbool = true;
                var affixLeftMargin = (tocAffix.outerWidth() - tocAffix.width()) / 2;
                var left = markdown.offset().left + markdown.outerWidth() - affixLeftMargin;
                tocAffix.css('left', left + 'px');
            } else {
                newbool = false;
            }
            if (newbool != enoughForAffixToc) {
                enoughForAffixToc = newbool;
                generateScrollspy();
            }
        }
        $(window).resize(function () {
            windowResize();
        });
        $(document).ready(function () {
            windowResize();
            generateScrollspy();
        });

        //remove hash
        function removeHash() {
            window.location.hash = '';
        }

        var backtotop = $('.back-to-top');
        var gotobottom = $('.go-to-bottom');

        backtotop.click(function (e) {
            e.preventDefault();
            e.stopPropagation();
            if (scrollToTop)
                scrollToTop();
            removeHash();
        });
        gotobottom.click(function (e) {
            e.preventDefault();
            e.stopPropagation();
            if (scrollToBottom)
                scrollToBottom();
            removeHash();
        });

        var toggle = $('.expand-toggle');
        var tocExpand = false;

        checkExpandToggle();
        toggle.click(function (e) {
            e.preventDefault();
            e.stopPropagation();
            tocExpand = !tocExpand;
            checkExpandToggle();
        })

        function checkExpandToggle () {
            var toc = $('.ui-toc-dropdown .toc');
            var toggle = $('.expand-toggle');
            if (!tocExpand) {
                toc.removeClass('expand');
                toggle.text('Expand all');
            } else {
                toc.addClass('expand');
                toggle.text('Collapse all');
            }
        }

        function scrollToTop() {
            $('body, html').stop(true, true).animate({
                scrollTop: 0
            }, 100, "linear");
        }

        function scrollToBottom() {
            $('body, html').stop(true, true).animate({
                scrollTop: $(document.body)[0].scrollHeight
            }, 100, "linear");
        }
    </script>
</body>

</html>
