各位程序员大家好!
我有一个简单的盒子布局,我很乐意使用flexbox实现,但我简直无法理解.它应该看起来像这个图像.

所以基本上是一行和两列,其中行被固定在高度上,比如100px,但是在一个容器中.到目前为止我的代码是:
#productShowcaseContainer {
display: inline-flex;
flex-flow: row wrap;
height: 600px;
width: 580px;
background-color: rgb(240, 240, 240);
}
#productShowcaseTitle {
display: inline-block;
height: 100px;
width: 100%;
background-color: rgb(200, 200, 200);
}
#productShowcaseDetail {
flex: 3;
background-color: red;
}
#productShowcaseThumbnailContainer {
flex: 2;
background-color: blue;
}Run Code Online (Sandbox Code Playgroud)
<div id="productShowcaseContainer">
<div id="productShowcaseTitle"></div>
<div id="productShowcaseDetail"></div>
<div id="productShowcaseThumbnailContainer"></div>
</div>Run Code Online (Sandbox Code Playgroud)
我知道这可以通过多种方式实现,但我更喜欢使用CSS Flex.
我想做以下事情:
\nstd::string b = "b";\nis_in("a", { "a", "b", "c" });\nis_in("d", { "a", "b", "c" });\nis_in(b, { "a", "b", "c" }); // fails\nis_in(b, std::array{ "a", "b", "c" });\nRun Code Online (Sandbox Code Playgroud)\n使用模板
\ntemplate<typename Element, typename Container>\nbool is_in(const Element& e, const Container& c)\n{\n // https://stackoverflow.com/questions/20303821/how-to-check-if-string-is-in-array-of-strings\n return std::find(std::begin(c), std::end(c), e) != std::end(c);\n}\n\ntemplate<typename Element>\nbool is_in(Element e, std::initializer_list<Element> l)\n{\n // return std::find(std::begin(l), std::end(l), e) != std::end(l);\n return is_in<Element, std::initializer_list<Element>>(e, l);\n}\nRun Code Online (Sandbox Code Playgroud)\n但我收到以下错误(使用 GCC 9.3.0):
\nno matching function for call to \xe2\x80\x98is_in(std::string&, <brace-enclosed initializer list>)\xe2\x80\x99\n …Run Code Online (Sandbox Code Playgroud)