c++ - Inline functions in a class -


this question has answer here:

is true if function body defined inside class, compiler mark inline? (even if not marked writer)

example:

class f { public:     void func() {     std::cout << "is inline?\n";     } }; 

yes.

[c++14: 9.3/2]: a member function may defined (8.4) in class definition, in case inline member function (7.1.2), or may defined outside of class definition if has been declared not defined in class definition. [..]

however, whether has observable effects beyond associated linkage requirements predictable inline keyword ever is.

the reason rule legal include class definition — member functions , — via header multiple translation units. have multiple reference linker errors otherwise.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -