c++ - Check if C++0x parameter pack contains a type -


What I'm wondering if C ++ 0x offers to test any underlying capabilities of a variadic template a parameter pack specific types of today, encouraging ::: ml :: can be used to access it if you are fair use as a substitute for variadic templates boost :: mpl :: vector . However, there is a serious compile time overhead in it. I think, there is compiler-level support for std :: is_same in C ++ 0x. So I was thinking that a generalization like in compiler is supported

  template  

No, you can use the (partial) with a variety of templates to compile expertise - Timelines like this:

  #include & lt; Type_traits & gt; Template & lt; Typename TP, TypeName ... List & gt; The structure includes: std :: true_type {}; Template & lt; Typename TP, Typeman name head, typename ... Rest & gt; In the structure & lt; TP, Head, Rest ... & gt; : Std :: conditional & lt; Std :: is_same & lt; TP, Head & gt; :: value, std :: true_type, in & lt; TP, rest ... & gt; & Gt; :: type {}; Template & lt; Typ name named TP & gt; In the strip & lt; Tp & gt; : Std :: false_type {};  

Varaidik The only other internal operation templates and calculate the length of the list of parameters which is especially size operators like:

  Template & lt; Typename ... type & gt; Struct typelist_len {constant static size_t value = size ... (type); };  

Where are you getting "It's a serious compile-time overhead" to encourage empla? I hope to have settled here are not making assumptions Boost IPL uses techniques such as lazy template Instaliant like spamming templates to reduce compile time rather than explode like meta-programming and less.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -