Prev: STL efficiency question
Next: C++ boxing
From: demo on 11 Feb 2010 02:06 Given the following code, is it possible to declare an instance of bar without explicitly specifying the Class and Type? The compiler should know the complete type of &foo::value, so specifying the type more than once is tedious. Could decltype or something like that be used in C++0x? #include "stdafx.h" struct foo { int value; }; template<typename Class, typename Type, Type Class::* Member> struct bar { }; int main(int argc, char* argv[]) { bar<foo, int, &foo::value>(); // Could this be bar<&foo::value>() somehow? return EXIT_SUCCESS; } -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
|
Pages: 1 Prev: STL efficiency question Next: C++ boxing |