#include <iostream>
#include <type_traits>
template<typename T, typename... Haystack>
struct SearchImpl : std::is_same<T, Haystack>...
{
};
template<typename T, typename... Haystack>
struct Search : std::is_base_of<std::true_type, SearchImpl<T, Haystack...>>::type
{
};
int main() {
std::cout << Search<int, double, double, double, int, double, int>::value << std::endl;
// your code goes here
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dHlwZV90cmFpdHM+Cgp0ZW1wbGF0ZTx0eXBlbmFtZSBULCB0eXBlbmFtZS4uLiBIYXlzdGFjaz4Kc3RydWN0IFNlYXJjaEltcGwgOiBzdGQ6OmlzX3NhbWU8VCwgSGF5c3RhY2s+Li4uCnsKfTsKCnRlbXBsYXRlPHR5cGVuYW1lIFQsIHR5cGVuYW1lLi4uIEhheXN0YWNrPgpzdHJ1Y3QgU2VhcmNoIDogc3RkOjppc19iYXNlX29mPHN0ZDo6dHJ1ZV90eXBlLCBTZWFyY2hJbXBsPFQsIEhheXN0YWNrLi4uPj46OnR5cGUgCnsKfTsKCmludCBtYWluKCkgewoJCglzdGQ6OmNvdXQgPDwgU2VhcmNoPGludCwgZG91YmxlLCBkb3VibGUsIGRvdWJsZSwgaW50LCBkb3VibGUsIGludD46OnZhbHVlIDw8IHN0ZDo6ZW5kbDsKCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCXJldHVybiAwOwp9
prog.cpp: In instantiation of ‘struct SearchImpl<int, double, double, double, int, double, int>’:
/usr/include/c++/4.8/type_traits:1287:12: required from ‘struct std::is_base_of<std::integral_constant<bool, true>, SearchImpl<int, double, double, double, int, double, int> >’
prog.cpp:10:8: required from ‘struct Search<int, double, double, double, int, double, int>’
prog.cpp:16:68: required from here
prog.cpp:5:8: error: duplicate base type ‘std::is_same<int, double>’ invalid
struct SearchImpl : std::is_same<T, Haystack>...
^