c++ - Why MSVC accepts to instanciate a template class without template arguments? -
template< typename type > struct tequalto { bool operator() (type const& lhs, type const& rhs ) const { homecoming lhs == rhs; } }; // .... later in function takes functor: find(a, tequalto());
msvc accepted it, commited, got build error reports other compilers, based on gcc suppose.
missing template arguments before '(' token
obviously prepare utilize t find function (t type of a) , becomes:
find(a, tequalto<t>()); and well. question, how on earth first build ever allowed msvc (2012) ?
i see 1 reason, fellow member of class operator() function, hence there nil instanciate, not typedef. compiler realised deduce type later operator() instanciation. nice weird no ? standard ?
c++ templates visual-studio-2012
No comments:
Post a Comment