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-20 10:48

>Since C::method() is defined inside the class, it is defined as though as it were declared inline
What? Why? an inline need to have its implementation available for whoever is using it, but just because there's an implementation available doesn't mean that it will be inlined! So NO to both of your questions, because you haven't declared them as "inline".

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