#include <iostream>

struct foobar {
    foobar( int a, int b ) {
        std::cout << "foobar created with " << a << " " << b << "\n";
    }
};

struct barbaz {
    barbaz( int a ) {
        std::cout << "barbaz created with " << a << "\n";
    }
};

template <typename T>
auto make( int a, int b ) -> decltype( T( a ,b ) ) {
    return T( a, b );
}

template <typename T>
auto make( int a, int b ) -> decltype( T( a ) ) {
    return T( a );
}

int main() {
    auto x = make<foobar>( 10, 42 );
    auto y = make<barbaz>( 10, 42 );
}
