boost中bind的使用
:first-child { margin-top: 0px; }
.markdown-preview:not([data-use-github-style]) h1, .markdown-preview:not([data-use-github-style]) h2, .markdown-preview:not([data-use-github-style]) h3, .markdown-preview:not([data-use-github-style]) h4, .markdown-preview:not([data-use-github-style]) h5, .markdown-preview:not([data-use-github-style]) h6 { line-height: 1.2; margin-top: 1.5em; margin-bottom: 0.5em; color: rgb(255, 255, 255); }
.markdown-preview:not([data-use-github-style]) h1 { font-size: 2.4em; font-weight: 300; }
.markdown-preview:not([data-use-github-style]) h2 { font-size: 1.8em; font-weight: 400; }
.markdown-preview:not([data-use-github-style]) h3 { font-size: 1.5em; font-weight: 500; }
.markdown-preview:not([data-use-github-style]) h4 { font-size: 1.2em; font-weight: 600; }
.markdown-preview:not([data-use-github-style]) h5 { font-size: 1.1em; font-weight: 600; }
.markdown-preview:not([data-use-github-style]) h6 { font-size: 1em; font-weight: 600; }
.markdown-preview:not([data-use-github-style]) strong { color: rgb(255, 255, 255); }
.markdown-preview:not([data-use-github-style]) del { color: rgb(124, 135, 156); }
.markdown-preview:not([data-use-github-style]) a, .markdown-preview:not([data-use-github-style]) a code { color: rgb(82, 139, 255); }
.markdown-preview:not([data-use-github-style]) img { max-width: 100%; }
.markdown-preview:not([data-use-github-style]) > p { margin-top: 0px; margin-bottom: 1.5em; }
.markdown-preview:not([data-use-github-style]) > ul, .markdown-preview:not([data-use-github-style]) > ol { margin-bottom: 1.5em; }
.markdown-preview:not([data-use-github-style]) blockquote { margin: 1.5em 0px; font-size: inherit; color: rgb(124, 135, 156); border-color: rgb(75, 83, 98); border-width: 4px; }
.markdown-preview:not([data-use-github-style]) hr { margin: 3em 0px; border-top: 2px dashed rgb(75, 83, 98); background: none; }
.markdown-preview:not([data-use-github-style]) table { margin: 1.5em 0px; }
.markdown-preview:not([data-use-github-style]) th { color: rgb(255, 255, 255); }
.markdown-preview:not([data-use-github-style]) th, .markdown-preview:not([data-use-github-style]) td { padding: 0.66em 1em; border: 1px solid rgb(75, 83, 98); }
.markdown-preview:not([data-use-github-style]) code { color: rgb(255, 255, 255); background-color: rgb(58, 63, 75); }
.markdown-preview:not([data-use-github-style]) pre.editor-colors { margin: 1.5em 0px; padding: 1em; font-size: 0.92em; border-radius: 3px; background-color: rgb(49, 54, 63); }
.markdown-preview:not([data-use-github-style]) kbd { color: rgb(255, 255, 255); border-width: 1px 1px 2px; border-style: solid; border-color: rgb(75, 83, 98) rgb(75, 83, 98) rgb(62, 68, 81); border-image: initial; background-color: rgb(58, 63, 75); }
.markdown-preview[data-use-github-style] { font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif; line-height: 1.6; word-wrap: break-word; padding: 30px; font-size: 16px; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255); overflow: scroll; }
.markdown-preview[data-use-github-style] > :first-child { margin-top: 0px !important; }
.markdown-preview[data-use-github-style] > :last-child { margin-bottom: 0px !important; }
.markdown-preview[data-use-github-style] a:not([href]) { color: inherit; text-decoration: none; }
.markdown-preview[data-use-github-style] .absent { color: rgb(204, 0, 0); }
.markdown-preview[data-use-github-style] .anchor { position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; }
.markdown-preview[data-use-github-style] .anchor:focus { outline: none; }
.markdown-preview[data-use-github-style] h1, .markdown-preview[data-use-github-style] h2, .markdown-preview[data-use-github-style] h3, .markdown-preview[data-use-github-style] h4, .markdown-preview[data-use-github-style] h5, .markdown-preview[data-use-github-style] h6 { position: relative; margin-top: 1em; margin-bottom: 16px; font-weight: bold; line-height: 1.4; }
.markdown-preview[data-use-github-style] h1 .octicon-link, .markdown-preview[data-use-github-style] h2 .octicon-link, .markdown-preview[data-use-github-style] h3 .octicon-link, .markdown-preview[data-use-github-style] h4 .octicon-link, .markdown-preview[data-use-github-style] h5 .octicon-link, .markdown-preview[data-use-github-style] h6 .octicon-link { display: none; color: rgb(0, 0, 0); vertical-align: middle; }
.markdown-preview[data-use-github-style] h1:hover .anchor, .markdown-preview[data-use-github-style] h2:hover .anchor, .markdown-preview[data-use-github-style] h3:hover .anchor, .markdown-preview[data-use-github-style] h4:hover .anchor, .markdown-preview[data-use-github-style] h5:hover .anchor, .markdown-preview[data-use-github-style] h6:hover .anchor { padding-left: 8px; margin-left: -30px; text-decoration: none; }
.markdown-preview[data-use-github-style] h1:hover .anchor .octicon-link, .markdown-preview[data-use-github-style] h2:hover .anchor .octicon-link, .markdown-preview[data-use-github-style] h3:hover .anchor .octicon-link, .markdown-preview[data-use-github-style] h4:hover .anchor .octicon-link, .markdown-preview[data-use-github-style] h5:hover .anchor .octicon-link, .markdown-preview[data-use-github-style] h6:hover .anchor .octicon-link { display: inline-block; }
.markdown-preview[data-use-github-style] h1 tt, .markdown-preview[data-use-github-style] h2 tt, .markdown-preview[data-use-github-style] h3 tt, .markdown-preview[data-use-github-style] h4 tt, .markdown-preview[data-use-github-style] h5 tt, .markdown-preview[data-use-github-style] h6 tt, .markdown-preview[data-use-github-style] h1 code, .markdown-preview[data-use-github-style] h2 code, .markdown-preview[data-use-github-style] h3 code, .markdown-preview[data-use-github-style] h4 code, .markdown-preview[data-use-github-style] h5 code, .markdown-preview[data-use-github-style] h6 code { font-size: inherit; }
.markdown-preview[data-use-github-style] h1 { padding-bottom: 0.3em; font-size: 2.25em; line-height: 1.2; border-bottom: 1px solid rgb(238, 238, 238); }
.markdown-preview[data-use-github-style] h1 .anchor { line-height: 1; }
.markdown-preview[data-use-github-style] h2 { padding-bottom: 0.3em; font-size: 1.75em; line-height: 1.225; border-bottom: 1px solid rgb(238, 238, 238); }
.markdown-preview[data-use-github-style] h2 .anchor { line-height: 1; }
.markdown-preview[data-use-github-style] h3 { font-size: 1.5em; line-height: 1.43; }
.markdown-preview[data-use-github-style] h3 .anchor { line-height: 1.2; }
.markdown-preview[data-use-github-style] h4 { font-size: 1.25em; }
.markdown-preview[data-use-github-style] h4 .anchor { line-height: 1.2; }
.markdown-preview[data-use-github-style] h5 { font-size: 1em; }
.markdown-preview[data-use-github-style] h5 .anchor { line-height: 1.1; }
.markdown-preview[data-use-github-style] h6 { font-size: 1em; color: rgb(119, 119, 119); }
.markdown-preview[data-use-github-style] h6 .anchor { line-height: 1.1; }
.markdown-preview[data-use-github-style] p, .markdown-preview[data-use-github-style] blockquote, .markdown-preview[data-use-github-style] ul, .markdown-preview[data-use-github-style] ol, .markdown-preview[data-use-github-style] dl, .markdown-preview[data-use-github-style] table, .markdown-preview[data-use-github-style] pre { margin-top: 0px; margin-bottom: 16px; }
.markdown-preview[data-use-github-style] hr { height: 4px; padding: 0px; margin: 16px 0px; background-color: rgb(231, 231, 231); border: 0px none; }
.markdown-preview[data-use-github-style] ul, .markdown-preview[data-use-github-style] ol { padding-left: 2em; }
.markdown-preview[data-use-github-style] ul.no-list, .markdown-preview[data-use-github-style] ol.no-list { padding: 0px; list-style-type: none; }
.markdown-preview[data-use-github-style] ul ul, .markdown-preview[data-use-github-style] ul ol, .markdown-preview[data-use-github-style] ol ol, .markdown-preview[data-use-github-style] ol ul { margin-top: 0px; margin-bottom: 0px; }
.markdown-preview[data-use-github-style] li > p { margin-top: 16px; }
.markdown-preview[data-use-github-style] dl { padding: 0px; }
.markdown-preview[data-use-github-style] dl dt { padding: 0px; margin-top: 16px; font-size: 1em; font-style: italic; font-weight: bold; }
.markdown-preview[data-use-github-style] dl dd { padding: 0px 16px; margin-bottom: 16px; }
.markdown-preview[data-use-github-style] blockquote { padding: 0px 15px; color: rgb(119, 119, 119); border-left: 4px solid rgb(221, 221, 221); }
.markdown-preview[data-use-github-style] blockquote > :first-child { margin-top: 0px; }
.markdown-preview[data-use-github-style] blockquote > :last-child { margin-bottom: 0px; }
.markdown-preview[data-use-github-style] table { display: block; width: 100%; overflow: auto; word-break: keep-all; }
.markdown-preview[data-use-github-style] table th { font-weight: bold; }
.markdown-preview[data-use-github-style] table th, .markdown-preview[data-use-github-style] table td { padding: 6px 13px; border: 1px solid rgb(221, 221, 221); }
.markdown-preview[data-use-github-style] table tr { background-color: rgb(255, 255, 255); border-top: 1px solid rgb(204, 204, 204); }
.markdown-preview[data-use-github-style] table tr:nth-child(2n) { background-color: rgb(248, 248, 248); }
.markdown-preview[data-use-github-style] img { max-width: 100%; box-sizing: border-box; }
.markdown-preview[data-use-github-style] .emoji { max-width: none; }
.markdown-preview[data-use-github-style] span.frame { display: block; overflow: hidden; }
.markdown-preview[data-use-github-style] span.frame > span { display: block; float: left; width: auto; padding: 7px; margin: 13px 0px 0px; overflow: hidden; border: 1px solid rgb(221, 221, 221); }
.markdown-preview[data-use-github-style] span.frame span img { display: block; float: left; }
.markdown-preview[data-use-github-style] span.frame span span { display: block; padding: 5px 0px 0px; clear: both; color: rgb(51, 51, 51); }
.markdown-preview[data-use-github-style] span.align-center { display: block; overflow: hidden; clear: both; }
.markdown-preview[data-use-github-style] span.align-center > span { display: block; margin: 13px auto 0px; overflow: hidden; text-align: center; }
.markdown-preview[data-use-github-style] span.align-center span img { margin: 0px auto; text-align: center; }
.markdown-preview[data-use-github-style] span.align-right { display: block; overflow: hidden; clear: both; }
.markdown-preview[data-use-github-style] span.align-right > span { display: block; margin: 13px 0px 0px; overflow: hidden; text-align: right; }
.markdown-preview[data-use-github-style] span.align-right span img { margin: 0px; text-align: right; }
.markdown-preview[data-use-github-style] span.float-left { display: block; float: left; margin-right: 13px; overflow: hidden; }
.markdown-preview[data-use-github-style] span.float-left span { margin: 13px 0px 0px; }
.markdown-preview[data-use-github-style] span.float-right { display: block; float: right; margin-left: 13px; overflow: hidden; }
.markdown-preview[data-use-github-style] span.float-right > span { display: block; margin: 13px auto 0px; overflow: hidden; text-align: right; }
.markdown-preview[data-use-github-style] code, .markdown-preview[data-use-github-style] tt { padding: 0.2em 0px; margin: 0px; font-size: 85%; background-color: rgba(0, 0, 0, 0.0392157); border-radius: 3px; }
.markdown-preview[data-use-github-style] code::before, .markdown-preview[data-use-github-style] tt::before, .markdown-preview[data-use-github-style] code::after, .markdown-preview[data-use-github-style] tt::after { letter-spacing: -0.2em; content: " "; }
.markdown-preview[data-use-github-style] code br, .markdown-preview[data-use-github-style] tt br { display: none; }
.markdown-preview[data-use-github-style] del code { text-decoration: inherit; }
.markdown-preview[data-use-github-style] pre > code { padding: 0px; margin: 0px; font-size: 100%; word-break: normal; white-space: pre; background: transparent; border: 0px; }
.markdown-preview[data-use-github-style] .highlight { margin-bottom: 16px; }
.markdown-preview[data-use-github-style] .highlight pre, .markdown-preview[data-use-github-style] pre { padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; }
.markdown-preview[data-use-github-style] .highlight pre { margin-bottom: 0px; word-break: normal; }
.markdown-preview[data-use-github-style] pre { word-wrap: normal; }
.markdown-preview[data-use-github-style] pre code, .markdown-preview[data-use-github-style] pre tt { display: inline; max-width: initial; padding: 0px; margin: 0px; overflow: initial; line-height: inherit; word-wrap: normal; background-color: transparent; border: 0px; }
.markdown-preview[data-use-github-style] pre code::before, .markdown-preview[data-use-github-style] pre tt::before, .markdown-preview[data-use-github-style] pre code::after, .markdown-preview[data-use-github-style] pre tt::after { content: normal; }
.markdown-preview[data-use-github-style] kbd { display: inline-block; padding: 3px 5px; font-size: 11px; line-height: 10px; color: rgb(85, 85, 85); vertical-align: middle; background-color: rgb(252, 252, 252); border-width: 1px; border-style: solid; border-color: rgb(204, 204, 204) rgb(204, 204, 204) rgb(187, 187, 187); border-image: initial; border-radius: 3px; box-shadow: rgb(187, 187, 187) 0px -1px 0px inset; }
.markdown-preview[data-use-github-style] a { color: rgb(51, 122, 183); }
.markdown-preview[data-use-github-style] code { color: inherit; }
.markdown-preview[data-use-github-style] pre.editor-colors { padding: 0.8em 1em; margin-bottom: 1em; font-size: 0.85em; border-radius: 4px; overflow: auto; }
.scrollbars-visible-always .markdown-preview pre.editor-colors .vertical-scrollbar, .scrollbars-visible-always .markdown-preview pre.editor-colors .horizontal-scrollbar { visibility: hidden; }
.scrollbars-visible-always .markdown-preview pre.editor-colors:hover .vertical-scrollbar, .scrollbars-visible-always .markdown-preview pre.editor-colors:hover .horizontal-scrollbar { visibility: visible; }
.markdown-preview .task-list-item-checkbox { position: absolute; margin: 0.25em 0px 0px -1.4em; }
.bracket-matcher .region {
border-bottom: 1px dotted lime;
position: absolute;
}
.spell-check-misspelling .region {
border-bottom: 2px dotted rgba(255, 51, 51, 0.75);
}
.spell-check-corrections {
width: 25em !important;
}
pre.editor-colors {
background-color: #282c34;
color: #abb2bf;
}
pre.editor-colors .line.cursor-line {
background-color: rgba(153, 187, 255, 0.04);
}
pre.editor-colors .invisible {
color: #abb2bf;
}
pre.editor-colors .cursor {
border-left: 2px solid #528bff;
}
pre.editor-colors .selection .region {
background-color: #3e4451;
}
pre.editor-colors .bracket-matcher .region {
border-bottom: 1px solid #528bff;
box-sizing: border-box;
}
pre.editor-colors .invisible-character {
color: rgba(171, 178, 191, 0.15);
}
pre.editor-colors .indent-guide {
color: rgba(171, 178, 191, 0.15);
}
pre.editor-colors .wrap-guide {
background-color: rgba(171, 178, 191, 0.15);
}
pre.editor-colors .find-result .region.region.region,
pre.editor-colors .current-result .region.region.region {
border-radius: 2px;
background-color: rgba(82, 139, 255, 0.24);
transition: border-color 0.4s;
}
pre.editor-colors .find-result .region.region.region {
border: 2px solid transparent;
}
pre.editor-colors .current-result .region.region.region {
border: 2px solid #528bff;
transition-duration: .1s;
}
pre.editor-colors .gutter .line-number {
color: #636d83;
-webkit-font-smoothing: antialiased;
}
pre.editor-colors .gutter .line-number.cursor-line {
color: #abb2bf;
background-color: #2c313a;
}
pre.editor-colors .gutter .line-number.cursor-line-no-selection {
background-color: transparent;
}
pre.editor-colors .gutter .line-number .icon-right {
color: #abb2bf;
}
pre.editor-colors .gutter:not(.git-diff-icon) .line-number.git-line-removed.git-line-removed::before {
bottom: -3px;
}
pre.editor-colors .gutter:not(.git-diff-icon) .line-number.git-line-removed::after {
content: "";
position: absolute;
left: 0px;
bottom: 0px;
width: 25px;
border-bottom: 1px dotted rgba(224, 82, 82, 0.5);
pointer-events: none;
}
pre.editor-colors .gutter .line-number.folded,
pre.editor-colors .gutter .line-number:after,
pre.editor-colors .fold-marker:after {
color: #abb2bf;
}
.syntax--comment {
color: #5c6370;
font-style: italic;
}
.syntax--comment .syntax--markup.syntax--link {
color: #5c6370;
}
.syntax--entity.syntax--name.syntax--type {
color: #e5c07b;
}
.syntax--entity.syntax--other.syntax--inherited-class {
color: #98c379;
}
.syntax--keyword {
color: #c678dd;
}
.syntax--keyword.syntax--control {
color: #c678dd;
}
.syntax--keyword.syntax--operator {
color: #abb2bf;
}
.syntax--keyword.syntax--other.syntax--special-method {
color: #61afef;
}
.syntax--keyword.syntax--other.syntax--unit {
color: #d19a66;
}
.syntax--storage {
color: #c678dd;
}
.syntax--storage.syntax--type.syntax--annotation,
.syntax--storage.syntax--type.syntax--primitive {
color: #c678dd;
}
.syntax--storage.syntax--modifier.syntax--package,
.syntax--storage.syntax--modifier.syntax--import {
color: #abb2bf;
}
.syntax--constant {
color: #d19a66;
}
.syntax--constant.syntax--variable {
color: #d19a66;
}
.syntax--constant.syntax--character.syntax--escape {
color: #56b6c2;
}
.syntax--constant.syntax--numeric {
color: #d19a66;
}
.syntax--constant.syntax--other.syntax--color {
color: #56b6c2;
}
.syntax--constant.syntax--other.syntax--symbol {
color: #56b6c2;
}
.syntax--variable {
color: #e06c75;
}
.syntax--variable.syntax--interpolation {
color: #be5046;
}
.syntax--variable.syntax--parameter {
color: #abb2bf;
}
.syntax--string {
color: #98c379;
}
.syntax--string.syntax--regexp {
color: #56b6c2;
}
.syntax--string.syntax--regexp .syntax--source.syntax--ruby.syntax--embedded {
color: #e5c07b;
}
.syntax--string.syntax--other.syntax--link {
color: #e06c75;
}
.syntax--punctuation.syntax--definition.syntax--comment {
color: #5c6370;
}
.syntax--punctuation.syntax--definition.syntax--method-parameters,
.syntax--punctuation.syntax--definition.syntax--function-parameters,
.syntax--punctuation.syntax--definition.syntax--parameters,
.syntax--punctuation.syntax--definition.syntax--separator,
.syntax--punctuation.syntax--definition.syntax--seperator,
.syntax--punctuation.syntax--definition.syntax--array {
color: #abb2bf;
}
.syntax--punctuation.syntax--definition.syntax--heading,
.syntax--punctuation.syntax--definition.syntax--identity {
color: #61afef;
}
.syntax--punctuation.syntax--definition.syntax--bold {
color: #e5c07b;
font-weight: bold;
}
.syntax--punctuation.syntax--definition.syntax--italic {
color: #c678dd;
font-style: italic;
}
.syntax--punctuation.syntax--section.syntax--embedded {
color: #be5046;
}
.syntax--punctuation.syntax--section.syntax--method,
.syntax--punctuation.syntax--section.syntax--class,
.syntax--punctuation.syntax--section.syntax--inner-class {
color: #abb2bf;
}
.syntax--support.syntax--class {
color: #e5c07b;
}
.syntax--support.syntax--type {
color: #56b6c2;
}
.syntax--support.syntax--function {
color: #56b6c2;
}
.syntax--support.syntax--function.syntax--any-method {
color: #61afef;
}
.syntax--entity.syntax--name.syntax--function {
color: #61afef;
}
.syntax--entity.syntax--name.syntax--class,
.syntax--entity.syntax--name.syntax--type.syntax--class {
color: #e5c07b;
}
.syntax--entity.syntax--name.syntax--section {
color: #61afef;
}
.syntax--entity.syntax--name.syntax--tag {
color: #e06c75;
}
.syntax--entity.syntax--other.syntax--attribute-name {
color: #d19a66;
}
.syntax--entity.syntax--other.syntax--attribute-name.syntax--id {
color: #61afef;
}
.syntax--meta.syntax--class {
color: #e5c07b;
}
.syntax--meta.syntax--class.syntax--body {
color: #abb2bf;
}
.syntax--meta.syntax--method-call,
.syntax--meta.syntax--method {
color: #abb2bf;
}
.syntax--meta.syntax--definition.syntax--variable {
color: #e06c75;
}
.syntax--meta.syntax--link {
color: #d19a66;
}
.syntax--meta.syntax--require {
color: #61afef;
}
.syntax--meta.syntax--selector {
color: #c678dd;
}
.syntax--meta.syntax--separator {
background-color: #373b41;
color: #abb2bf;
}
.syntax--meta.syntax--tag {
color: #abb2bf;
}
.syntax--underline {
text-decoration: underline;
}
.syntax--none {
color: #abb2bf;
}
.syntax--invalid.syntax--deprecated {
color: #523d14 !important;
background-color: #e0c285 !important;
}
.syntax--invalid.syntax--illegal {
color: white !important;
background-color: #e05252 !important;
}
.syntax--markup.syntax--bold {
color: #d19a66;
font-weight: bold;
}
.syntax--markup.syntax--changed {
color: #c678dd;
}
.syntax--markup.syntax--deleted {
color: #e06c75;
}
.syntax--markup.syntax--italic {
color: #c678dd;
font-style: italic;
}
.syntax--markup.syntax--heading {
color: #e06c75;
}
.syntax--markup.syntax--heading .syntax--punctuation.syntax--definition.syntax--heading {
color: #61afef;
}
.syntax--markup.syntax--link {
color: #56b6c2;
}
.syntax--markup.syntax--inserted {
color: #98c379;
}
.syntax--markup.syntax--quote {
color: #d19a66;
}
.syntax--markup.syntax--raw {
color: #98c379;
}
.syntax--source.syntax--c .syntax--keyword.syntax--operator {
color: #c678dd;
}
.syntax--source.syntax--cpp .syntax--keyword.syntax--operator {
color: #c678dd;
}
.syntax--source.syntax--cs .syntax--keyword.syntax--operator {
color: #c678dd;
}
.syntax--source.syntax--css .syntax--property-name,
.syntax--source.syntax--css .syntax--property-value {
color: #828997;
}
.syntax--source.syntax--css .syntax--property-name.syntax--support,
.syntax--source.syntax--css .syntax--property-value.syntax--support {
color: #abb2bf;
}
.syntax--source.syntax--elixir .syntax--source.syntax--embedded.syntax--source {
color: #abb2bf;
}
.syntax--source.syntax--elixir .syntax--constant.syntax--language,
.syntax--source.syntax--elixir .syntax--constant.syntax--numeric,
.syntax--source.syntax--elixir .syntax--constant.syntax--definition {
color: #61afef;
}
.syntax--source.syntax--elixir .syntax--variable.syntax--definition,
.syntax--source.syntax--elixir .syntax--variable.syntax--anonymous {
color: #c678dd;
}
.syntax--source.syntax--elixir .syntax--quoted {
color: #98c379;
}
.syntax--source.syntax--elixir .syntax--keyword.syntax--special-method,
.syntax--source.syntax--elixir .syntax--embedded.syntax--section,
.syntax--source.syntax--elixir .syntax--embedded.syntax--source.syntax--empty {
color: #e06c75;
}
.syntax--source.syntax--elixir .syntax--readwrite.syntax--module .syntax--punctuation {
color: #e06c75;
}
.syntax--source.syntax--elixir .syntax--regexp.syntax--section,
.syntax--source.syntax--elixir .syntax--regexp.syntax--string {
color: #be5046;
}
.syntax--source.syntax--elixir .syntax--separator,
.syntax--source.syntax--elixir .syntax--keyword.syntax--operator {
color: #d19a66;
}
.syntax--source.syntax--elixir .syntax--variable.syntax--constant {
color: #e5c07b;
}
.syntax--source.syntax--elixir .syntax--array,
.syntax--source.syntax--elixir .syntax--scope,
.syntax--source.syntax--elixir .syntax--section {
color: #828997;
}
.syntax--source.syntax--gfm .syntax--markup {
-webkit-font-smoothing: auto;
}
.syntax--source.syntax--gfm .syntax--link .syntax--entity {
color: #61afef;
}
.syntax--source.syntax--go .syntax--storage.syntax--type.syntax--string {
color: #c678dd;
}
.syntax--source.syntax--ini .syntax--keyword.syntax--other.syntax--definition.syntax--ini {
color: #e06c75;
}
.syntax--source.syntax--java .syntax--storage.syntax--modifier.syntax--import {
color: #e5c07b;
}
.syntax--source.syntax--java .syntax--storage.syntax--type {
color: #e5c07b;
}
.syntax--source.syntax--java .syntax--keyword.syntax--operator.syntax--instanceof {
color: #c678dd;
}
.syntax--source.syntax--java-properties .syntax--meta.syntax--key-pair {
color: #e06c75;
}
.syntax--source.syntax--java-properties .syntax--meta.syntax--key-pair > .syntax--punctuation {
color: #abb2bf;
}
.syntax--source.syntax--js .syntax--keyword.syntax--operator {
color: #56b6c2;
}
.syntax--source.syntax--js .syntax--keyword.syntax--operator.syntax--delete,
.syntax--source.syntax--js .syntax--keyword.syntax--operator.syntax--in,
.syntax--source.syntax--js .syntax--keyword.syntax--operator.syntax--of,
.syntax--source.syntax--js .syntax--keyword.syntax--operator.syntax--instanceof,
.syntax--source.syntax--js .syntax--keyword.syntax--operator.syntax--new,
.syntax--source.syntax--js .syntax--keyword.syntax--operator.syntax--typeof,
.syntax--source.syntax--js .syntax--keyword.syntax--operator.syntax--void {
color: #c678dd;
}
.syntax--source.syntax--json .syntax--meta.syntax--structure.syntax--dictionary.syntax--json > .syntax--string.syntax--quoted.syntax--json {
color: #e06c75;
}
.syntax--source.syntax--json .syntax--meta.syntax--structure.syntax--dictionary.syntax--json > .syntax--string.syntax--quoted.syntax--json > .syntax--punctuation.syntax--string {
color: #e06c75;
}
.syntax--source.syntax--json .syntax--meta.syntax--structure.syntax--dictionary.syntax--json > .syntax--value.syntax--json > .syntax--string.syntax--quoted.syntax--json,
.syntax--source.syntax--json .syntax--meta.syntax--structure.syntax--array.syntax--json > .syntax--value.syntax--json > .syntax--string.syntax--quoted.syntax--json,
.syntax--source.syntax--json .syntax--meta.syntax--structure.syntax--dictionary.syntax--json > .syntax--value.syntax--json > .syntax--string.syntax--quoted.syntax--json > .syntax--punctuation,
.syntax--source.syntax--json .syntax--meta.syntax--structure.syntax--array.syntax--json > .syntax--value.syntax--json > .syntax--string.syntax--quoted.syntax--json > .syntax--punctuation {
color: #98c379;
}
.syntax--source.syntax--json .syntax--meta.syntax--structure.syntax--dictionary.syntax--json > .syntax--constant.syntax--language.syntax--json,
.syntax--source.syntax--json .syntax--meta.syntax--structure.syntax--array.syntax--json > .syntax--constant.syntax--language.syntax--json {
color: #56b6c2;
}
.syntax--source.syntax--ruby .syntax--constant.syntax--other.syntax--symbol > .syntax--punctuation {
color: inherit;
}
.syntax--source.syntax--python .syntax--keyword.syntax--operator.syntax--logical.syntax--python {
color: #c678dd;
}
.syntax--source.syntax--python .syntax--variable.syntax--parameter {
color: #d19a66;
}
-->
1 Boost::bind
在介绍bind之前,我们先介绍一下STL中的绑定机制。我们知道在C++标准库中提供了bind1st,bind2nd
函数绑定器和fun_ptr,mem_fun
等函数适配器用来将函数绑定为一个函数对象。这些函数绑定器和适配器使用起来比较码分,需要根据全局函数还是类的成员函数,是一个参数还是多个参数等作出不同的选择,甚至有时候STL并不能满足我们的要求。boost库中提供的Boost::bind
就是为了解决这个问题而设计的。
2 标准库中函数的绑定
我们首先看一下关于函数绑定是如何出现的。首先我们先看一下下面这个例子:
这个例子很简单,就是依次遍历向量中的元素,并将其作为print
的参数进行调用。在标准库中std::for_each()
算法的第三个参数只能接受一个参数的函数或者函数对象。如果函数有多个参数,则上面的调用方法就行不通了,对应的解决方案是将函数定义为为函数对象,然后重载operator()
的方法,最后利用标准库中的bind1st
或者bind2nd
来绑定重载运算的第一个参数或者第二个参数。
下面这个例子是将一个二元的相减的函数对象绑定为一个一元函数对象的例子,使用的是标准库中的std::bind1st
。
被绑定的二元函数对象必须要继承std::binary_function
,关于这个函数的使用可以参考 stl中std::binary_function的使用 。上面使用的是bind1st
将10绑定到第一个参数上,即让10减去向量中的元素。如果想让向量减去10则使用bind2nd
,关于标准库绑定的其他用法不是本文的重点这里就不过多介绍了。我们来看一下标准库这个用法的缺点,最明显的一个缺点就是需要改写函数为函数对象,因为在我们的应用中有些函数是允许我们进行修改的。另外一个缺点就是绑定的参数位置不同用的绑定方法也不同,达不到形式上的统一。看完下面介绍的boost::bind,你就会发现标准库的功能简直是太简陋了。
3 bind的工作原理
bind并不是一个单独的类或函数,而是非常庞大的家族,依据绑定的参数的个数和要绑定的调用对象的类型,共有数十种不同的形式,编译器会根据具体的绑定代码自动确定要使用的正确的形式,bind的基本形式如下:
bind 接收的 第一个参数 必须是一个 可调用的对象f,包括 函数、函数指针、函数对象和成员函数 ,之后bind 最多接收9个参数,参数数量 必须与 f的参数数量相等 ,这些参数被传递给f作为入参。绑定完成后,bind会 返回一个函数对象 ,它内部 保存了f的拷贝 ,具有 operator(),返回值类型 被自动推到为 f的返回类型 。在发生调用时这个 函数对象 将把之前 存储的参数 转发给f完成调用。例如,有一个函数func,它的形式如下:
那么,他将等价于一个具有无参operator()的bind函数对象调用:
上面是bind最简单的调用形式,将一个二元函数绑定为一个无参的函数对象。事实上,我们可以将最多9个参数的函数绑定为无参函数对象。另外,结合bind的占位符,可以实现这些参数以任意顺序调用,而不是不用像标准库那样指定1st,2nd.下例给出了带占位符bind的使用方式:
上面第一个例子中将二元函数绑定为一个一元函数对象,并且使用了占位符将一元函数对象的输入参数传递给二元函数的第二个参数。第二个例子和第三个例子分别说明了占位符可以出现在绑定函数的任意位置并且可以重复任意次,只要参数个数一样即可。可以看出占位符的功能非常强大,占位符的使用也是bind函数的核心功能。下面是使用bind来实现前相减的例子:
可以看到使用bind之后我们无需自己去定义函数对象了,可以保持原有的函数不变,使用bind来将其绑定为一个一元对象。
4 bind的扩展使用
4.1 bind绑定成员函数
bind除了可以将普通的函数绑定为任意元(小于等于9)的函数对象以外,它可以对类的成员函数进行绑定。不过在绑定时必须要在第二个参数指定绑定的是类的哪个对象(以地址的方式传入)。下面是一个使用示例:
上面绑定成员函数的方式和绑定普通函数几乎没有任何区别,只需要多指定被绑定的对象即可。另外由于静态方法对于一个类来说是唯一的,所以其绑定方法和普通函数的绑定一样不用指定类的对象,比如如果上面的MemFun
是静态方法,我们直接用boost::bind(&TestClass::MemFun,_1)("string")
调用即可。
4.2 复制绑定和非复制绑定
前面我们在绑定成员函数时,指定对象用的是传递地址的方法。在传递地址的过程中没有发生复制操作。事实上除了指定对象地址以外我们还可以指定对象本身,而此时会发生多次的赋值操作。为了说明这一过程情况下面的实例:
这个例子和上面那个例子的使用是一样的,只是为了方便观察复制过程,这里自定义了复制操作。上面程序执行结果为:
接下来我们将上面例子最后绑定过程改为boost::bind(&TestClass::MemFun,a1,_1)("TestClass string");
,即传递对象本身。执行结果为:
可以看到当我们传递对象本身时,对象被复制了6次。我们也可以借助boost::ref()
来传递对象的引用,即boost::bind(&TestClass::MemFun,boost::ref(a1),_1)("TestClass string");
这句话的执行结果和传递指针是一样的。boost::ref()
是传递引用的意思,对应的还有boost::cref()
用来传递const引用。我们可以在传递对象的引用时使用,下面是另外一个使用示例:
4.3 bind绑定成员变量
处理绑定public成员函数以外,bind也可以绑定public成员变量。成员变量的绑定和成员函数是一样的。成员变量绑定为函数对象以后,调用该函数对象相当于打印该变量,下面是一个使用示例:
4.4 bind绑定函数对象
除了绑定普通函数和成员函数以外,bind还可以绑定函数对象。在绑定函数对象的过程中,如果函数对象 有内部定义的result_type ,那么bind可以自动推到出返回值类型,用法和普通函数一致。但如果函数对象 没有定义result_type ,则需要通过 模板参数手动指定返回类型 ,下面是一个使用示例:
在这个示例中,由于标准库中的greater函数已经定义了result_type
,所以我们可78用不用指定函数的返回类型,注意greater的模板参数和bind的模板参数并不是一回事。对于第二个绑定过程,由于我们自定义的函数对象并没有定义定义result_type
所有必须要手动的在模板中指定函数返回值类型。
4.5 绑定非标准函数
处理上面提到的函数以外,我们也可以对非标准函数进行绑定。典型的例子就是C中的可变参数函数printf().下面是其绑定的一个实例:
由于printf的返回类型为int所有我们必须要在bind的模板参数中指定返回类型。
参考文章:
关于bind的使用可以参考:
第3章 函数对象
关于bind和标准库适配器、绑定器的区别,可以参考:
Boost::bind使用详解
绑定成员函数(指针,引用,普通对象,静态、非静态成员的绑定)可以参考:
Boost库bind接口轻松实现类成员函数作为回调函数
更进一步关于bind的实现原理可以参考(不建议深入的了解其原理,没必要从轮子开始造车):
std和boost的function与bind实现剖析
boost中bind的使用的更多相关文章
- 基于boost的bind与function的一个简单示例消息处理框架
前两年开始接触boost,boost库真是博大精深:今天简单介绍一下boost中之前用到的的bind与function,感觉挺实用的,分享给大家,我对boost用的也不多,让大家见笑了. 上次文发了一 ...
- 【转载】JS中bind方法与函数柯里化
原生bind方法 不同于jQuery中的bind方法只是简单的绑定事件函数,原生js中bind()方法略复杂,该方法上在ES5中被引入,大概就是IE9+等现代浏览器都支持了(有关ES5各项特性的支持情 ...
- jQuery中bind方法和live方法区别解析
Javascript中的事件有它的独特性,有默认的执行事件,例如冒泡就是其中的一个.在很多比较复杂的应用程序中,停止事件的冒泡或捕获在程序开发当中是十分有用的,而在IE中有它的独特方式来阻止事件的冒泡 ...
- 博文推荐】Javascript中bind、call、apply函数用法
[博文推荐]Javascript中bind.call.apply函数用法 2015-03-02 09:22 菜鸟浮出水 51CTO博客 字号:T | T 最近一直在用 js 写游戏服务器,我也接触 j ...
- javascript中bind,apply,call的相同和不同之处
javasctipt中bind,apply,call的相同点是: 1,都是用来改变this的指向; 2,都可以通过后续参数进行传参; 3,第一个参数都是指定this要指向的对象; 不同点: 1,调用方 ...
- Boost中的智能指针(转)
这篇文章主要介绍 boost中的智能指针的使用.(转自:http://www.cnblogs.com/sld666666/archive/2010/12/16/1908265.html) 内存管理是一 ...
- JQuery中bind和unbind函数与onclick绑定事件区分
JQuery中bind和unbind函数转载: https://blog.csdn.net/liucheng417/article/details/51131982 页面代码: <body& ...
- Jquery中.bind()、.live()、.delegate()和.on()之间的区别详解
简介 最近了解到很多网页开发者对jquery中的 .bind() .live() .delegate() 和 .on() 方法存在很多的疑惑.这些疑惑通常是关于它们之间真正的区别是什么啊,什么时候该使 ...
- Boost中的Timer的使用——计算时间流逝
使用Boost中的Timer库计算程序的运行时间 程序开发人员都会面临一个共同的问题,即写出高质量的代码完毕特定的功能.评价代码质量的一个重要标准就是算法的运行效率,也就是算法的运行时间.为了可靠的提 ...
随机推荐
- Python-10 字典dict
#1 创建 dict1={'欢欢':'i love','小高高':'you'} dict2={1:'one',2:'two',3:'three'} dict3={} #2 访问元素 print('欢欢 ...
- 爬虫——BeautifulSoup和Xpath
爬虫我们大概可以分为三部分:爬取——>解析——>存储 一 Beautiful Soup: Beautiful Soup提供一些简单的.python式的函数用来处理导航.搜索.修改分析树等功 ...
- NOIP 2018 Day1
Fei2Xue@Lian$Tian! 三道原题qwq真的凉 半年前看到有人发说说,梦见省选打开题目,是Please contact lydsy2012@163.com! 没想到一语成谶 大众分300 ...
- eShopOnContainers 看微服务③:Identity Service
引言 通常,服务所公开的资源和 API 必须仅限受信任的特定用户和客户端访问.那进行 API 级别信任决策的第一步就是身份认证——确定用户身份是否可靠. 在微服务场景中,身份认证通常统一处理.一般有两 ...
- calc()使用用法
calc()是css3的一个新增的功能,用来指定元素的长度. 它是动态设置元素值,可由加减乘除算法得到最后计算值. 比如说“width:calc(50% + 5em)” 在使用less解析中calc运 ...
- 如何解决iOS界面操作导致导致NSTimer暂停计时的问题?
在NSTimer代码后面加上以下代码,这样滚动scroll的时候就不会暂停了.NSRunLoop *t = [NSRunLoop currentRunLoop];[t addTimer: timer ...
- 6.2 集合和映射--集合Set->底层基于链表实现
在6.1中我们实现了底层基于二叉搜索树的集合,本节就底层如何基于链表实现进行学习,注意:此处的链表是之前自己封装的. 1.集合set相关功能 1.1 add()的不同 用于链表本身没有去重的效果,因此 ...
- arcgis10.2 sde配置
本机配置好oracle11g server 64位+client 32位.
- C++_数字时钟软件实现设计
利用C++学习内容,通过windows自带函数实现一个简易的时钟 #include<iostream> #include<windows.h> //延时与清屏头文件 using ...
- 操作 实例 / dom
响应式:数据改变时会触发其他联动.例如:模板中的数据绑定:计算属性的重新计算: ---------------------------------------------------- vm.$par ...