1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
struct B
{
B( int a, int b, int c ) : d(a), e(b), f(c) {}
private: int d,e,f;
};
struct I : B
{
template< typename... A >
I( A&& ...a ) : B(std::forward<A>(a)...) {}
I( double a, int b, char c ) : B( int( std::ceil(a) + 0.1 ), b, c ) {}
I( const std::string& n, int a, int b, int c ) : B(a,b,c), name(n) {}
const std::string name = "anonymous" ;
};
int main()
{
I a( 2.6f, 1, 2 ) ; // un-intuitive
I b( std::string("a name"), 1, 2, 3 ) ; // *** error
}
|