<legend id='y3Eit'><style id='y3Eit'><dir id='y3Eit'><q id='y3Eit'></q></dir></style></legend>
    • <bdo id='y3Eit'></bdo><ul id='y3Eit'></ul>

  • <tfoot id='y3Eit'></tfoot>

        <small id='y3Eit'></small><noframes id='y3Eit'>

      1. <i id='y3Eit'><tr id='y3Eit'><dt id='y3Eit'><q id='y3Eit'><span id='y3Eit'><b id='y3Eit'><form id='y3Eit'><ins id='y3Eit'></ins><ul id='y3Eit'></ul><sub id='y3Eit'></sub></form><legend id='y3Eit'></legend><bdo id='y3Eit'><pre id='y3Eit'><center id='y3Eit'></center></pre></bdo></b><th id='y3Eit'></th></span></q></dt></tr></i><div id='y3Eit'><tfoot id='y3Eit'></tfoot><dl id='y3Eit'><fieldset id='y3Eit'></fieldset></dl></div>

        是大括号可构造的类型特征

        Is-braces-constructible type trait(是大括号可构造的类型特征)
        <legend id='QItrZ'><style id='QItrZ'><dir id='QItrZ'><q id='QItrZ'></q></dir></style></legend>
          <tbody id='QItrZ'></tbody>
        <i id='QItrZ'><tr id='QItrZ'><dt id='QItrZ'><q id='QItrZ'><span id='QItrZ'><b id='QItrZ'><form id='QItrZ'><ins id='QItrZ'></ins><ul id='QItrZ'></ul><sub id='QItrZ'></sub></form><legend id='QItrZ'></legend><bdo id='QItrZ'><pre id='QItrZ'><center id='QItrZ'></center></pre></bdo></b><th id='QItrZ'></th></span></q></dt></tr></i><div id='QItrZ'><tfoot id='QItrZ'></tfoot><dl id='QItrZ'><fieldset id='QItrZ'></fieldset></dl></div>

          • <bdo id='QItrZ'></bdo><ul id='QItrZ'></ul>
          • <small id='QItrZ'></small><noframes id='QItrZ'>

            • <tfoot id='QItrZ'></tfoot>

                  本文介绍了是大括号可构造的类型特征的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何检查特定类型 typename T 是否可从参数 typename ...ArgsT{Args...} 的方式构造代码>?我知道 std::is_constructible<T, Args... > 来自 <type_traits> 的类型特征,但它使用括号,而不是花括号.我在编写类型特征方面没有太多经验,因此无法提供初始示例.作为简化,我们可以接受任何合理的断言,即使这不会导致一般性的太大损失.

                  How can I check whether specific type typename T is constructible from arguments typename ...Args in the manner T{Args...}? I aware of std::is_constructible< T, Args... > type trait from <type_traits>, but it works with parentheses, not curly braces. I do not have too much experience in writing of type traits, so I cannot provide initial example. As simplification we can accept any reasonable assertions, even if this leads to not too significant loss of generality.

                  推荐答案

                  template<class T, typename... Args>
                  decltype(void(T{std::declval<Args>()...}), std::true_type())
                  test(int);
                  
                  template<class T, typename... Args>
                  std::false_type
                  test(...);
                  
                  template<class T, typename... Args>
                  struct is_braces_constructible : decltype(test<T, Args...>(0))
                  {
                  };
                  

                  这篇关于是大括号可构造的类型特征的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to limit the number of running instances in C++(C++中如何限制运行实例的数量)
                  Using boost::asio::async_read with stdin?(将 boost::asio::async_read 与 stdin 一起使用?)
                  How to find out what dependencies (i.e other Boost libraries) a particular Boost library requires?(如何找出特定 Boost 库需要哪些依赖项(即其他 Boost 库)?)
                  What#39;s the purpose of a leading quot;::quot; in a C++ method call(引导“::的目的是什么?在 C++ 方法调用中)
                  Boost Spirit x3: parse into structs(Boost Spirit x3:解析为结构体)
                  How boost auto-linking makes choice?(boost自动链接如何做出选择?)
                    <tbody id='mT3mj'></tbody>
                    <bdo id='mT3mj'></bdo><ul id='mT3mj'></ul>

                      <small id='mT3mj'></small><noframes id='mT3mj'>

                        <tfoot id='mT3mj'></tfoot>
                          <legend id='mT3mj'><style id='mT3mj'><dir id='mT3mj'><q id='mT3mj'></q></dir></style></legend>

                        • <i id='mT3mj'><tr id='mT3mj'><dt id='mT3mj'><q id='mT3mj'><span id='mT3mj'><b id='mT3mj'><form id='mT3mj'><ins id='mT3mj'></ins><ul id='mT3mj'></ul><sub id='mT3mj'></sub></form><legend id='mT3mj'></legend><bdo id='mT3mj'><pre id='mT3mj'><center id='mT3mj'></center></pre></bdo></b><th id='mT3mj'></th></span></q></dt></tr></i><div id='mT3mj'><tfoot id='mT3mj'></tfoot><dl id='mT3mj'><fieldset id='mT3mj'></fieldset></dl></div>