RAD Studio |  |

Stricter C++ Compiler: Template Changes
See Also
Collapse All

The C++ compiler no longer allows an explicit template without the 'template <>' prefix. Use the compiler switch -Vbe to allow this. The following example shows this:

Copy Code

    template <class>
    class foo {
     foo();
    };
    foo<int>::foo();//Error
    template<> foo<int>::foo();//OK

Also, the C++ compiler no longer allows explicit template specialization within a class. Use the compiler switch -Vbx to allow this. For example, the following generates an error:

Copy Code

    struct S {};
      struct SP
      {
        template <typename> void foo(const T &) {}
        template <> void foo(const S &) {} // Error
      };

      template <> void SP::foo(const S &) {} //OK

See Also

Stricter C++ Compiler (C++Builder 2007)

Binding of References and Qualifiers

String Literals Are Now Constants

Function Overload Resolution

Initialization and Conversion

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!