#include <vector>
#include <algorithm>
#include <iostream>
#include <iterator>
template< typename T, typename ...U >
std::vector<T> my_unique( std::vector<T> & cont, std::vector<U> &... other_containers )
{
std::vector<T> destination{};
auto uniq = []( std::vector<T> & arg )->typename std::vector<T>::iterator { std::sort(arg.begin(), arg.end() );
return std::unique( std::begin( arg ), std::end( arg ) ); };
auto coppy = [&]( std::vector<T> & args )-> void { std::copy( std::begin( args ), uniq( args ), std::back_inserter( destination ) ); };
int hack[]{( void( coppy( cont ) ), 0 ), ( void( coppy( other_containers )), 0)... };
return destination;
}
int main()
{
std::vector<int> a { 11, 12, 11, 15, 16, 23, 15, 23, 15 }, b { 3, 5, 6, 2, 3, 4, 3, 8, 9, 8 }, c { 1, 1, 3, 6, 60, 2, 2, 1 };
std::vector<int> d = my_unique( a, b, c );
for( const auto &x: d ) std::cout << x << ", ";
return 0;
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aXRlcmF0b3I+Cgp0ZW1wbGF0ZTwgdHlwZW5hbWUgVCwgdHlwZW5hbWUgLi4uVSA+CnN0ZDo6dmVjdG9yPFQ+IG15X3VuaXF1ZSggc3RkOjp2ZWN0b3I8VD4gJiBjb250LCBzdGQ6OnZlY3RvcjxVPiAmLi4uIG90aGVyX2NvbnRhaW5lcnMgKQp7CiAgICBzdGQ6OnZlY3RvcjxUPiBkZXN0aW5hdGlvbnt9OwogICAgYXV0byB1bmlxID0gW10oIHN0ZDo6dmVjdG9yPFQ+ICYgYXJnICktPnR5cGVuYW1lIHN0ZDo6dmVjdG9yPFQ+OjppdGVyYXRvciB7IHN0ZDo6c29ydChhcmcuYmVnaW4oKSwgYXJnLmVuZCgpICk7IAogICAgcmV0dXJuIHN0ZDo6dW5pcXVlKCBzdGQ6OmJlZ2luKCBhcmcgKSwgc3RkOjplbmQoIGFyZyApICk7IH07CiAgICBhdXRvIGNvcHB5ID0gW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