
13 Jan
2014
13 Jan
'14
2:50 a.m.
Hemanth Choudary M V (RBEI/ETA1
Why is the behaviour different in these 2 scenarios? How is Boost able to differenciate between the 2 test cases in Scenario1?
I think what it essentially comes to is this: If you have in header H: class A{ public: void test_method(); } void A::test_method() {} // note NO inline and include this header in 2 C++ files A and B linker will complain. If on the other hand you have this in H: template<typename Foo> class A{ public: void test_method(); } template<typename Foo> void A<Foo>::test_method() {} // inline implied Linker is required to merge multiple definitions from different translation units and program builds fine. These are rules of C++. HTH, Gennadiy