?!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 使用c++11改写loki的TypeList-南软g开发|׃软g开?南赢dU技软g开发公?/title> <meta name="keywords" content="使用c++11改写loki的TypeList"/> <meta name="description" content="最q看了C++11的一些特性,最感兴的是可变模板参敎ͼ自动cd推断和匿名函数。Loki中的TypeListQ是需要递归定义的,q且需要一个NullType作ؓ节炏V可变模板参C得实现TypeList更简z,更易懂。以下是我用C++11实现"/> <link href="/css/style.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Cache-Control" content="no-transform" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> </head> <body> <div style="position:fixed;left:-9000px;top:-9000px;"><wbr id="vebt5"><option id="vebt5"><var id="vebt5"><p id="vebt5"></p></var></option></wbr><listing id="vebt5"><object id="vebt5"><nobr id="vebt5"></nobr></object></listing><ol id="vebt5"></ol><pre id="vebt5"><em id="vebt5"><input id="vebt5"></input></em></pre><form id="vebt5"><big id="vebt5"><li id="vebt5"></li></big></form><pre id="vebt5"><em id="vebt5"><kbd id="vebt5"><label id="vebt5"></label></kbd></em></pre><mark id="vebt5"></mark><legend id="vebt5"></legend><noscript id="vebt5"></noscript><div id="vebt5"></div><center id="vebt5"><small id="vebt5"><track id="vebt5"><rp id="vebt5"></rp></track></small></center><tr id="vebt5"><option id="vebt5"><acronym id="vebt5"></acronym></option></tr><track id="vebt5"></track><tt id="vebt5"></tt><track id="vebt5"><form id="vebt5"><pre id="vebt5"><em id="vebt5"></em></pre></form></track><wbr id="vebt5"></wbr><nav id="vebt5"><blockquote id="vebt5"><dd id="vebt5"></dd></blockquote></nav><noscript id="vebt5"></noscript><mark id="vebt5"></mark><div id="vebt5"><menuitem id="vebt5"><wbr id="vebt5"></wbr></menuitem></div><menu id="vebt5"><samp id="vebt5"><meter id="vebt5"><dfn id="vebt5"></dfn></meter></samp></menu><kbd id="vebt5"></kbd><track id="vebt5"><form id="vebt5"><source id="vebt5"></source></form></track><u id="vebt5"></u><var id="vebt5"><cite id="vebt5"><div id="vebt5"></div></cite></var><track id="vebt5"><form id="vebt5"><u id="vebt5"></u></form></track><option id="vebt5"></option><samp id="vebt5"></samp><address id="vebt5"></address><samp id="vebt5"></samp><noframes id="vebt5"></noframes><strong id="vebt5"></strong><progress id="vebt5"><kbd id="vebt5"><div id="vebt5"></div></kbd></progress><s id="vebt5"></s><ins id="vebt5"></ins><table id="vebt5"><strong id="vebt5"><noframes id="vebt5"></noframes></strong></table><listing id="vebt5"></listing><bdo id="vebt5"><nav id="vebt5"><table id="vebt5"><span id="vebt5"></span></table></nav></bdo><samp id="vebt5"></samp><strike id="vebt5"><video id="vebt5"><samp id="vebt5"></samp></video></strike><ruby id="vebt5"></ruby><optgroup id="vebt5"></optgroup><option id="vebt5"><wbr id="vebt5"><p id="vebt5"><rp id="vebt5"></rp></p></wbr></option><sup id="vebt5"><acronym id="vebt5"><tt id="vebt5"><dfn id="vebt5"></dfn></tt></acronym></sup><progress id="vebt5"></progress><tbody id="vebt5"><table id="vebt5"><legend id="vebt5"><dl id="vebt5"></dl></legend></table></tbody><ins id="vebt5"></ins><code id="vebt5"><menu id="vebt5"><sub id="vebt5"><meter id="vebt5"></meter></sub></menu></code><listing id="vebt5"><div id="vebt5"><center id="vebt5"><wbr id="vebt5"></wbr></center></div></listing><dfn id="vebt5"></dfn> <table id="vebt5"><span id="vebt5"><dl id="vebt5"><object id="vebt5"></object></dl></span></table><form id="vebt5"><code id="vebt5"><em id="vebt5"></em></code></form><xmp id="vebt5"></xmp><cite id="vebt5"><div id="vebt5"><code id="vebt5"><em id="vebt5"></em></code></div></cite><address id="vebt5"></address><meter id="vebt5"><source id="vebt5"><table id="vebt5"><ruby id="vebt5"></ruby></table></source></meter><dfn id="vebt5"><option id="vebt5"><dd id="vebt5"><p id="vebt5"></p></dd></option></dfn><strike id="vebt5"></strike><b id="vebt5"></b><kbd id="vebt5"></kbd><sup id="vebt5"><acronym id="vebt5"><delect id="vebt5"><b id="vebt5"></b></delect></acronym></sup><cite id="vebt5"><xmp id="vebt5"><center id="vebt5"><small id="vebt5"></small></center></xmp></cite><optgroup id="vebt5"><xmp id="vebt5"><center id="vebt5"></center></xmp></optgroup><ol id="vebt5"></ol><u id="vebt5"><s id="vebt5"><cite id="vebt5"><ins id="vebt5"></ins></cite></s></u><rp id="vebt5"></rp><dl id="vebt5"></dl><em id="vebt5"></em><big id="vebt5"></big><code id="vebt5"><i id="vebt5"><optgroup id="vebt5"></optgroup></i></code><rp id="vebt5"><big id="vebt5"><s id="vebt5"></s></big></rp><track id="vebt5"><form id="vebt5"><u id="vebt5"></u></form></track><dd id="vebt5"><bdo id="vebt5"><tbody id="vebt5"><table id="vebt5"></table></tbody></bdo></dd><dl id="vebt5"></dl><tr id="vebt5"><option id="vebt5"><acronym id="vebt5"></acronym></option></tr><pre id="vebt5"></pre><center id="vebt5"><small id="vebt5"><track id="vebt5"><rp id="vebt5"></rp></track></small></center><video id="vebt5"></video><dfn id="vebt5"></dfn><dd id="vebt5"><bdo id="vebt5"><th id="vebt5"><address id="vebt5"></address></th></bdo></dd><cite id="vebt5"></cite><center id="vebt5"><small id="vebt5"><noscript id="vebt5"></noscript></small></center><meter id="vebt5"></meter><strong id="vebt5"><input id="vebt5"><th id="vebt5"></th></input></strong><nobr id="vebt5"></nobr><dfn id="vebt5"><font id="vebt5"><dd id="vebt5"></dd></font></dfn><dd id="vebt5"><bdo id="vebt5"><tbody id="vebt5"><video id="vebt5"></video></tbody></bdo></dd><mark id="vebt5"><bdo id="vebt5"><b id="vebt5"><table id="vebt5"></table></b></bdo></mark><output id="vebt5"><ol id="vebt5"><bdo id="vebt5"></bdo></ol></output><strong id="vebt5"><track id="vebt5"><nav id="vebt5"><pre id="vebt5"></pre></nav></track></strong><thead id="vebt5"></thead><mark id="vebt5"><td id="vebt5"><tbody id="vebt5"><video id="vebt5"></video></tbody></td></mark><p id="vebt5"></p><ins id="vebt5"></ins><form id="vebt5"></form><span id="vebt5"><tt id="vebt5"><object id="vebt5"><font id="vebt5"></font></object></tt></span><delect id="vebt5"><tbody id="vebt5"><table id="vebt5"><legend id="vebt5"></legend></table></tbody></delect><optgroup id="vebt5"></optgroup><tbody id="vebt5"><table id="vebt5"><legend id="vebt5"></legend></table></tbody><big id="vebt5"></big> <ruby id="vebt5"></ruby><bdo id="vebt5"><tbody id="vebt5"><table id="vebt5"><span id="vebt5"></span></table></tbody></bdo><b id="vebt5"><output id="vebt5"><dd id="vebt5"></dd></output></b><listing id="vebt5"><ins id="vebt5"><center id="vebt5"></center></ins></listing><table id="vebt5"><strong id="vebt5"><noframes id="vebt5"><th id="vebt5"></th></noframes></strong></table><em id="vebt5"></em><strike id="vebt5"><menu id="vebt5"><samp id="vebt5"><meter id="vebt5"></meter></samp></menu></strike><i id="vebt5"><span id="vebt5"><tt id="vebt5"></tt></span></i><pre id="vebt5"><strong id="vebt5"><input id="vebt5"><thead id="vebt5"></thead></input></strong></pre><ins id="vebt5"></ins><nobr id="vebt5"><sub id="vebt5"><button id="vebt5"></button></sub></nobr><acronym id="vebt5"><tt id="vebt5"><dfn id="vebt5"><font id="vebt5"></font></dfn></tt></acronym><nobr id="vebt5"><mark id="vebt5"><td id="vebt5"><dfn id="vebt5"></dfn></td></mark></nobr><track id="vebt5"></track><dl id="vebt5"><code id="vebt5"><sup id="vebt5"><sub id="vebt5"></sub></sup></code></dl><del id="vebt5"></del><track id="vebt5"></track><video id="vebt5"></video><ol id="vebt5"></ol><track id="vebt5"></track><th id="vebt5"><menuitem id="vebt5"><wbr id="vebt5"><listing id="vebt5"></listing></wbr></menuitem></th><del id="vebt5"></del><sub id="vebt5"></sub><big id="vebt5"></big><b id="vebt5"></b><address id="vebt5"><progress id="vebt5"><noscript id="vebt5"></noscript></progress></address><del id="vebt5"><i id="vebt5"><optgroup id="vebt5"></optgroup></i></del><delect id="vebt5"></delect><dl id="vebt5"></dl><li id="vebt5"></li><tr id="vebt5"><option id="vebt5"><ol id="vebt5"><delect id="vebt5"></delect></ol></option></tr><th id="vebt5"><address id="vebt5"><wbr id="vebt5"><rt id="vebt5"></rt></wbr></address></th><strike id="vebt5"></strike><strike id="vebt5"></strike><noscript id="vebt5"></noscript><p id="vebt5"></p><dl id="vebt5"></dl><progress id="vebt5"><rt id="vebt5"><th id="vebt5"></th></rt></progress><tt id="vebt5"><object id="vebt5"><menu id="vebt5"><sub id="vebt5"></sub></menu></object></tt><menu id="vebt5"></menu><span id="vebt5"><noframes id="vebt5"><tr id="vebt5"></tr></noframes></span><form id="vebt5"></form><video id="vebt5"><span id="vebt5"><tt id="vebt5"></tt></span></video><b id="vebt5"></b><video id="vebt5"></video><center id="vebt5"><small id="vebt5"><noscript id="vebt5"><div id="vebt5"></div></noscript></small></center><cite id="vebt5"><xmp id="vebt5"><code id="vebt5"><small id="vebt5"></small></code></xmp></cite><pre id="vebt5"></pre><i id="vebt5"><ruby id="vebt5"><tt id="vebt5"></tt></ruby></i><font id="vebt5"><mark id="vebt5"><td id="vebt5"></td></mark></font></div> <div class="head"> <div class="top"><span><a href="/html/sitemap.xml">XML</a> | <a href="/html/sitemap.html">HTML</a> | <a href="/sitemap.txt">TXT</a></span></div> <div class="bank"> <div class="logo"> <h1><strong><a href="http://www.cabanatime.com" style="margin-right:10px">南软g开?/a></strong><strong><a href="http://www.cabanatime.com">׃软g开?/a></strong></h1> </div> <div class="contact-top"></div> </div> <div class="menu"> <ul> <li><a href="/">?#160;   ?/a></li> <li><a href="/About/">关于我们</a></li> <li><a href="/Advantage/">开发优?/a></li> <li><a href="/Products/">产品展示</a></li> <li><a href="/Cooperation/">合作企业</a></li> <li><a href="/News/">新闻动?/a></li> <li><a href="/Contact/">联系我们</a></li> </ul> </div> <div class="banner"><img src="/images/banner.jpg" width="1000" height="341"/></div> </div> <div id="position"><div>您当前位|:<a href="/">软g开?/a> >> <a href="/News/">新闻动?/a> >> <a href="/News/Industry/">软g开发行业资?/a> >> 览文章</div></div> <div class="youshi_f1" id="youshi_tdyx"> <div class="youshi01"> <h1 class="article_title">使用c++11改写loki的TypeList</h1> <div class="article_author">d旉Q?016-11-8 14:59:44 文章作者:<a href="/">南软g开?/a> 览ơ数Q?Script Language="Javascript" Src="/item/GetHits.asp?Action=Count&GetFlag=0&m=1&ID=2905"></Script></div> <div class="article_main"><div id="MyContent"><p><span style="font-size: 14px;">  最q看了C++11的一些特性,最感兴的是可变模板参敎ͼ自动cd推断和匿名函数?/span></p><p><span style="font-size: 14px;">  Loki中的TypeListQ是需要递归定义的,q且需要一个NullType作ؓ节炏V?/span></p><p><span style="font-size: 14px;">  可变模板参数使得实现TypeList更简z,更易懂?/span></p><p><span style="font-size: 14px;">  以下是我用C++11实现TypeList?/span></p><p><span style="font-size: 14px;">  复制代码</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<typename... TList></span></p><p><span style="font-size: 14px;">  struct typelist</span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  typedef typelist<> nulllist;</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<typename... TList> struct length;</span></p><p><span style="font-size: 14px;">  template<typename... TList></span></p><p><span style="font-size: 14px;">  struct length< typelist<TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  enum { value = sizeof...(TList) };</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<typename T, typename... TList> struct push_front;</span></p><p><span style="font-size: 14px;">  template<typename T, typename... TList></span></p><p><span style="font-size: 14px;">  struct push_front< T, typelist<TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typelist<T, TList...>  type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<typename... TList> struct pop_front;</span></p><p><span style="font-size: 14px;">  template<typename T, typename... TList></span></p><p><span style="font-size: 14px;">  struct pop_front< typelist<T, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typelist<TList...> type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<></span></p><p><span style="font-size: 14px;">  struct pop_front< nulllist ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef nulllist type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<unsigned int N, typename... TList> struct at;</span></p><p><span style="font-size: 14px;">  template<unsigned int N, typename T, typename... TList></span></p><p><span style="font-size: 14px;">  struct at< N, typelist<T, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typename at< N-1, typelist<TList...> >::type type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename T, typename... TList></span></p><p><span style="font-size: 14px;">  struct at< 0, typelist<T, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef T type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<></span></p><p><span style="font-size: 14px;">  struct at< 0, nulllist ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef nulllist type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<int A, int B></span></p><p><span style="font-size: 14px;">  struct IndexFixer</span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  enum { value = (A == B) ? B : A + 1 };</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<typename T, typename... TList> struct indexof;</span></p><p><span style="font-size: 14px;">  template<typename T, typename H, typename... TList></span></p><p><span style="font-size: 14px;">  struct indexof< T, typelist<H, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  enum { value = IndexFixer<indexof<T, typelist<TList...>>::value, -1>::value };</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename T, typename... TList></span></p><p><span style="font-size: 14px;">  struct indexof< T, typelist<T, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  enum { value = 0 };</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename T></span></p><p><span style="font-size: 14px;">  struct indexof< T, nulllist ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  enum { value = -1 };</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<typename A, typename B> struct concat;</span></p><p><span style="font-size: 14px;">  template<typename... A, typename... B></span></p><p><span style="font-size: 14px;">  struct concat<typelist<A...>, typelist<B...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typelist<A..., B...> type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename T, typename... TList></span></p><p><span style="font-size: 14px;">  struct concat<typelist<TList...>, T ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typelist<TList..., T> type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename T, typename... TList></span></p><p><span style="font-size: 14px;">  struct concat< T, typelist<TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typelist<T, TList...>  type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<typename T, typename... TList> struct erase;</span></p><p><span style="font-size: 14px;">  template<typename T, typename H, typename... TList></span></p><p><span style="font-size: 14px;">  struct erase<T, typelist<H, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typename concat<H, typename erase< T, typelist<TList...> >::type>::type type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename T, typename... TList></span></p><p><span style="font-size: 14px;">  struct erase<T, typelist<T, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typelist<TList...> type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename T></span></p><p><span style="font-size: 14px;">  struct erase<T, nulllist ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef nulllist type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<typename T, typename... TList> struct erase_all;</span></p><p><span style="font-size: 14px;">  template<typename T, typename H, typename... TList></span></p><p><span style="font-size: 14px;">  struct erase_all<T, typelist<H, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typename concat<H, typename erase_all< T, typelist<TList...> >::type>::type type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename T, typename... TList></span></p><p><span style="font-size: 14px;">  struct erase_all<T, typelist<T, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef erase_all< T,typelist<TList...> > type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename T, typename U></span></p><p><span style="font-size: 14px;">  struct erase_all<T, typelist<U> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef U type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename T></span></p><p><span style="font-size: 14px;">  struct erase_all<T, nulllist ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef nulllist type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<typename T, typename...TList> struct no_duplicate;</span></p><p><span style="font-size: 14px;">  template<typename T, typename...TList></span></p><p><span style="font-size: 14px;">  struct no_duplicate< typelist<T, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  private:</span></p><p><span style="font-size: 14px;">  typedef typename no_duplicate< typelist<TList...> >::type inner;</span></p><p><span style="font-size: 14px;">  typedef typename erase<T, inner>::type inner_result;</span></p><p><span style="font-size: 14px;">  public:</span></p><p><span style="font-size: 14px;">  typedef typename concat<T, inner_result>::type type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<></span></p><p><span style="font-size: 14px;">  struct no_duplicate< nulllist ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef nulllist type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<typename R, typename T, typename...TList> struct replace;</span></p><p><span style="font-size: 14px;">  template<typename R, typename T, typename H, typename...TList></span></p><p><span style="font-size: 14px;">  struct replace<R, T, typelist<H, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typename concat<H, typename replace<R, T, typelist<TList...>>::type>::type type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename R, typename H, typename...TList></span></p><p><span style="font-size: 14px;">  struct replace<R, H, typelist<H, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typename concat<R, typelist<TList...> >::type type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename R, typename T></span></p><p><span style="font-size: 14px;">  struct replace<R, T, nulllist ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef nulllist type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<typename R, typename T, typename...TList> struct replace_all;</span></p><p><span style="font-size: 14px;">  template<typename R, typename T, typename H, typename...TList></span></p><p><span style="font-size: 14px;">  struct replace_all<R, T, typelist<H, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typename concat<H, typename replace_all<R, T, typelist<TList...>>::type>::type type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename R, typename H, typename...TList></span></p><p><span style="font-size: 14px;">  struct replace_all<R, H, typelist<H, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typename concat<R, typename replace_all<R, H, typelist<TList...>>::type >::type type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<typename R, typename T></span></p><p><span style="font-size: 14px;">  struct replace_all<R, T, nulllist ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef nulllist type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  //////////////////////////////////////////////////////////</span></p><p><span style="font-size: 14px;">  template<typename T, typename...TList> struct reverse;</span></p><p><span style="font-size: 14px;">  template<typename T, typename...TList></span></p><p><span style="font-size: 14px;">  struct reverse<typelist<T, TList...> ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typename concat<typename reverse<typelist<TList...>>::type, T>::type type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  template<></span></p><p><span style="font-size: 14px;">  struct reverse< nulllist ></span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef nulllist type;</span></p><p><span style="font-size: 14px;">  };</span></p><p><span style="font-size: 14px;">  复制代码</span></p><p><span style="font-size: 14px;">  例子Q?/span></p><p><span style="font-size: 14px;">  复制代码</span></p><p><span style="font-size: 14px;">  #include <iostream></span></p><p><span style="font-size: 14px;">  #include <vector></span></p><p><span style="font-size: 14px;">  #include "TypeList.h"#include <type_traits></span></p><p><span style="font-size: 14px;">  using namespace hi::mpl;</span></p><p><span style="font-size: 14px;">  int main()</span></p><p><span style="font-size: 14px;">  {</span></p><p><span style="font-size: 14px;">  typedef typelist<int, float, bool, float> testlist;</span></p><p><span style="font-size: 14px;">  typedef typelist<float, bool> tlist;</span></p><p><span style="font-size: 14px;">  typedef typelist<int, float> hlist;</span></p><p><span style="font-size: 14px;">  typedef typelist<> elist;</span></p><p><span style="font-size: 14px;">  typedef typelist<int> ilist;</span></p><p><span style="font-size: 14px;">  typedef testlist mylist;</span></p><p><span style="font-size: 14px;">  std::cout << "length: " << length<mylist>::value << std::endl;</span></p><p><span style="font-size: 14px;">  bool b;</span></p><p><span style="font-size: 14px;">  b = std::is_same<at<2, mylist>::type, bool>::value;</span></p><p><span style="font-size: 14px;">  std::cout << "is same: " << b << std::endl;</span></p><p><span style="font-size: 14px;">  b = std::is_same<push_front<int, elist>::type, ilist>::value;</span></p><p><span style="font-size: 14px;">  std::cout << "is same: " << b << std::endl;</span></p><p><span style="font-size: 14px;">  std::cout << "indexof : " << indexof<bool, mylist>::value << std::endl;</span></p><p><span style="font-size: 14px;">  b = std::is_same<pop_front<typelist<>>::type, pop_front<ilist>::type>::value ;</span></p><p><span style="font-size: 14px;">  std::cout << "is same: " << b << std::endl;</span></p><p><span style="font-size: 14px;">  b = std::is_same< erase<bool, mylist>::type, typelist<int, float, float>>::value;</span></p><p><span style="font-size: 14px;">  std::cout << "is same: " << b << std::endl;</span></p><p><span style="font-size: 14px;">  b = std::is_same< no_duplicate<mylist>::type, typelist<int, float, bool>>::value;</span></p><p><span style="font-size: 14px;">  std::cout << "is same: " << b << std::endl;</span></p><p><span style="font-size: 14px;">  b = std::is_same< replace<double, bool, mylist>::type, typelist<int, float, double, float>>::value;</span></p><p><span style="font-size: 14px;">  std::cout << "is same: " << b << std::endl;</span></p><p><span style="font-size: 14px;">  b = std::is_same< replace_all<double, float, mylist>::type, typelist<int, double, bool, double>>::value;</span></p><p><span style="font-size: 14px;">  std::cout << "is same: " << b << std::endl;</span></p><p><span style="font-size: 14px;">  b = std::is_same< reverse<mylist>::type, typelist<float, bool, float, int>>::value;</span></p><p><span style="font-size: 14px;">  std::cout << "is same: " << b << std::endl;</span></p><p><span style="font-size: 14px;">  //std::cout << "is same: " << CompileTimeCount(int) << std::endl;</span></p><p><span style="font-size: 14px;">  //std::cout << "is same: " << CompileTimeCount(int) << std::endl;</span></p><p><span style="font-size: 14px;">  return 0;</span></p><p><span style="font-size: 14px;">  }</span></p><p><br/></p></div> </div> </div> </div> <div class="clear"></div> <div class="foot"> <div class="foot_menu"> <ul> <li><a href="/About/">关于我们</a></li> <li><a href="/Advantage/">开发优?/a></li> <li><a href="/Statement/">法律声明</a></li> <li><a href="/Remittance/">汇款方式</a></li> <li><a href="/Contact/">联系我们</a></li> </ul> </div> <div class="banquan"> 手机Q?8678812288 EQMail:1069706080@qq.com<br /> 地址Q山东省南市舜耕\泉城公园东门园内向北50c? 鲁ICP?7011972? 版权所?008Q?013 ׃赢d信息U技有限公司<script type="text/javascript"> var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://"); document.write(unescape("%3Cscript src='" + _bdhmProtocol + "#/h.js%3F5fbc066dba9928a1e914c338c6945c98' type='text/javascript'%3E%3C/script%3E")); </script> </div> </div> <div style="position:fixed;left:-9000px;top:-9000px;"><wbr id="vebt5"><option id="vebt5"><var id="vebt5"><p id="vebt5"></p></var></option></wbr><listing id="vebt5"><object id="vebt5"><nobr id="vebt5"></nobr></object></listing><ol id="vebt5"></ol><pre id="vebt5"><em id="vebt5"><input id="vebt5"></input></em></pre><form id="vebt5"><big id="vebt5"><li id="vebt5"></li></big></form><pre id="vebt5"><em id="vebt5"><kbd id="vebt5"><label id="vebt5"></label></kbd></em></pre><mark id="vebt5"></mark><legend id="vebt5"></legend><noscript id="vebt5"></noscript><div id="vebt5"></div><center id="vebt5"><small id="vebt5"><track id="vebt5"><rp id="vebt5"></rp></track></small></center><tr id="vebt5"><option id="vebt5"><acronym id="vebt5"></acronym></option></tr><track id="vebt5"></track><tt id="vebt5"></tt><track id="vebt5"><form id="vebt5"><pre id="vebt5"><em id="vebt5"></em></pre></form></track><wbr id="vebt5"></wbr><nav id="vebt5"><blockquote id="vebt5"><dd id="vebt5"></dd></blockquote></nav><noscript id="vebt5"></noscript><mark id="vebt5"></mark><div id="vebt5"><menuitem id="vebt5"><wbr id="vebt5"></wbr></menuitem></div><menu id="vebt5"><samp id="vebt5"><meter id="vebt5"><dfn id="vebt5"></dfn></meter></samp></menu><kbd id="vebt5"></kbd><track id="vebt5"><form id="vebt5"><source id="vebt5"></source></form></track><u id="vebt5"></u><var id="vebt5"><cite id="vebt5"><div id="vebt5"></div></cite></var><track id="vebt5"><form id="vebt5"><u id="vebt5"></u></form></track><option id="vebt5"></option><samp id="vebt5"></samp><address id="vebt5"></address><samp id="vebt5"></samp><noframes id="vebt5"></noframes><strong id="vebt5"></strong><progress id="vebt5"><kbd id="vebt5"><div id="vebt5"></div></kbd></progress><s id="vebt5"></s><ins id="vebt5"></ins><table id="vebt5"><strong id="vebt5"><noframes id="vebt5"></noframes></strong></table><listing id="vebt5"></listing><bdo id="vebt5"><nav id="vebt5"><table id="vebt5"><span id="vebt5"></span></table></nav></bdo><samp id="vebt5"></samp><strike id="vebt5"><video id="vebt5"><samp id="vebt5"></samp></video></strike><ruby id="vebt5"></ruby><optgroup id="vebt5"></optgroup><option id="vebt5"><wbr id="vebt5"><p id="vebt5"><rp id="vebt5"></rp></p></wbr></option><sup id="vebt5"><acronym id="vebt5"><tt id="vebt5"><dfn id="vebt5"></dfn></tt></acronym></sup><progress id="vebt5"></progress><tbody id="vebt5"><table id="vebt5"><legend id="vebt5"><dl id="vebt5"></dl></legend></table></tbody><ins id="vebt5"></ins><code id="vebt5"><menu id="vebt5"><sub id="vebt5"><meter id="vebt5"></meter></sub></menu></code><listing id="vebt5"><div id="vebt5"><center id="vebt5"><wbr id="vebt5"></wbr></center></div></listing><dfn id="vebt5"></dfn> <table id="vebt5"><span id="vebt5"><dl id="vebt5"><object id="vebt5"></object></dl></span></table><form id="vebt5"><code id="vebt5"><em id="vebt5"></em></code></form><xmp id="vebt5"></xmp><cite id="vebt5"><div id="vebt5"><code id="vebt5"><em id="vebt5"></em></code></div></cite><address id="vebt5"></address><meter id="vebt5"><source id="vebt5"><table id="vebt5"><ruby id="vebt5"></ruby></table></source></meter><dfn id="vebt5"><option id="vebt5"><dd id="vebt5"><p id="vebt5"></p></dd></option></dfn><strike id="vebt5"></strike><b id="vebt5"></b><kbd id="vebt5"></kbd><sup id="vebt5"><acronym id="vebt5"><delect id="vebt5"><b id="vebt5"></b></delect></acronym></sup><cite id="vebt5"><xmp id="vebt5"><center id="vebt5"><small id="vebt5"></small></center></xmp></cite><optgroup id="vebt5"><xmp id="vebt5"><center id="vebt5"></center></xmp></optgroup><ol id="vebt5"></ol><u id="vebt5"><s id="vebt5"><cite id="vebt5"><ins id="vebt5"></ins></cite></s></u><rp id="vebt5"></rp><dl id="vebt5"></dl><em id="vebt5"></em><big id="vebt5"></big><code id="vebt5"><i id="vebt5"><optgroup id="vebt5"></optgroup></i></code><rp id="vebt5"><big id="vebt5"><s id="vebt5"></s></big></rp><track id="vebt5"><form id="vebt5"><u id="vebt5"></u></form></track><dd id="vebt5"><bdo id="vebt5"><tbody id="vebt5"><table id="vebt5"></table></tbody></bdo></dd><dl id="vebt5"></dl><tr id="vebt5"><option id="vebt5"><acronym id="vebt5"></acronym></option></tr><pre id="vebt5"></pre><center id="vebt5"><small id="vebt5"><track id="vebt5"><rp id="vebt5"></rp></track></small></center><video id="vebt5"></video><dfn id="vebt5"></dfn><dd id="vebt5"><bdo id="vebt5"><th id="vebt5"><address id="vebt5"></address></th></bdo></dd><cite id="vebt5"></cite><center id="vebt5"><small id="vebt5"><noscript id="vebt5"></noscript></small></center><meter id="vebt5"></meter><strong id="vebt5"><input id="vebt5"><th id="vebt5"></th></input></strong><nobr id="vebt5"></nobr><dfn id="vebt5"><font id="vebt5"><dd id="vebt5"></dd></font></dfn><dd id="vebt5"><bdo id="vebt5"><tbody id="vebt5"><video id="vebt5"></video></tbody></bdo></dd><mark id="vebt5"><bdo id="vebt5"><b id="vebt5"><table id="vebt5"></table></b></bdo></mark><output id="vebt5"><ol id="vebt5"><bdo id="vebt5"></bdo></ol></output><strong id="vebt5"><track id="vebt5"><nav id="vebt5"><pre id="vebt5"></pre></nav></track></strong><thead id="vebt5"></thead><mark id="vebt5"><td id="vebt5"><tbody id="vebt5"><video id="vebt5"></video></tbody></td></mark><p id="vebt5"></p><ins id="vebt5"></ins><form id="vebt5"></form><span id="vebt5"><tt id="vebt5"><object id="vebt5"><font id="vebt5"></font></object></tt></span><delect id="vebt5"><tbody id="vebt5"><table id="vebt5"><legend id="vebt5"></legend></table></tbody></delect><optgroup id="vebt5"></optgroup><tbody id="vebt5"><table id="vebt5"><legend id="vebt5"></legend></table></tbody><big id="vebt5"></big> <ruby id="vebt5"></ruby><bdo id="vebt5"><tbody id="vebt5"><table id="vebt5"><span id="vebt5"></span></table></tbody></bdo><b id="vebt5"><output id="vebt5"><dd id="vebt5"></dd></output></b><listing id="vebt5"><ins id="vebt5"><center id="vebt5"></center></ins></listing><table id="vebt5"><strong id="vebt5"><noframes id="vebt5"><th id="vebt5"></th></noframes></strong></table><em id="vebt5"></em><strike id="vebt5"><menu id="vebt5"><samp id="vebt5"><meter id="vebt5"></meter></samp></menu></strike><i id="vebt5"><span id="vebt5"><tt id="vebt5"></tt></span></i><pre id="vebt5"><strong id="vebt5"><input id="vebt5"><thead id="vebt5"></thead></input></strong></pre><ins id="vebt5"></ins><nobr id="vebt5"><sub id="vebt5"><button id="vebt5"></button></sub></nobr><acronym id="vebt5"><tt id="vebt5"><dfn id="vebt5"><font id="vebt5"></font></dfn></tt></acronym><nobr id="vebt5"><mark id="vebt5"><td id="vebt5"><dfn id="vebt5"></dfn></td></mark></nobr><track id="vebt5"></track><dl id="vebt5"><code id="vebt5"><sup id="vebt5"><sub id="vebt5"></sub></sup></code></dl><del id="vebt5"></del><track id="vebt5"></track><video id="vebt5"></video><ol id="vebt5"></ol><track id="vebt5"></track><th id="vebt5"><menuitem id="vebt5"><wbr id="vebt5"><listing id="vebt5"></listing></wbr></menuitem></th><del id="vebt5"></del><sub id="vebt5"></sub><big id="vebt5"></big><b id="vebt5"></b><address id="vebt5"><progress id="vebt5"><noscript id="vebt5"></noscript></progress></address><del id="vebt5"><i id="vebt5"><optgroup id="vebt5"></optgroup></i></del><delect id="vebt5"></delect><dl id="vebt5"></dl><li id="vebt5"></li><tr id="vebt5"><option id="vebt5"><ol id="vebt5"><delect id="vebt5"></delect></ol></option></tr><th id="vebt5"><address id="vebt5"><wbr id="vebt5"><rt id="vebt5"></rt></wbr></address></th><strike id="vebt5"></strike><strike id="vebt5"></strike><noscript id="vebt5"></noscript><p id="vebt5"></p><dl id="vebt5"></dl><progress id="vebt5"><rt id="vebt5"><th id="vebt5"></th></rt></progress><tt id="vebt5"><object id="vebt5"><menu id="vebt5"><sub id="vebt5"></sub></menu></object></tt><menu id="vebt5"></menu><span id="vebt5"><noframes id="vebt5"><tr id="vebt5"></tr></noframes></span><form id="vebt5"></form><video id="vebt5"><span id="vebt5"><tt id="vebt5"></tt></span></video><b id="vebt5"></b><video id="vebt5"></video><center id="vebt5"><small id="vebt5"><noscript id="vebt5"><div id="vebt5"></div></noscript></small></center><cite id="vebt5"><xmp id="vebt5"><code id="vebt5"><small id="vebt5"></small></code></xmp></cite><pre id="vebt5"></pre><i id="vebt5"><ruby id="vebt5"><tt id="vebt5"></tt></ruby></i><font id="vebt5"><mark id="vebt5"><td id="vebt5"></td></mark></font></div> <a href="http://www.cabanatime.com/">_ŷպһ_վ߹ۿ_ŷһ߳</a> <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body> </html>