Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ Inline Question

Name: Anonymous 2012-01-19 20:40

Suppose the following:

struct C {
    void method() {}
};


template<typename T>
struct D {
    void method1() {}
    void method2();
};

template<typename T> void D<T>::method2() {}

Since C::method() is defined inside the class, it is defined as though as it were declared inline. Does the same apply to templates?

That is:
- Is D<T>::method1() inline?
- Is D<T>::method2() inline?

Thank you, /prog/riders.

Name: Anonymous 2012-01-19 20:45

Also, let me add another silly question:

Does a complete template specialization require template<>? For example:


template<typename T>
class X {};

template<> // Is this strictly required?
class X<int> {};


It is not clear from the standard whether this is required, and G++ does not complain even in pedantic ISO mode.

Thank you.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List