Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
accessing private of different type of template
#include <iostream> #include <string> template<class T> class ManagedObject { public: template<class U> void func(ManagedObject<U> & other) { std::cout << other.var << '\n'; } private: // without this the other ManagedObject of different type cannot access the private // of this managed object template<class> friend class ManagedObject; T var; }; int main() { ManagedObject<int> i; ManagedObject<std::string> s; s.func(i); }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
GetFinalPathNameByHandle Behaviour
derived_tempalte
Triangle N5
std::is_same doesn't check calling convension
multiplie linked list numbers
hex manip
parameter pack workaround
zero size std::array parameter
Arrays
boost::synchronize
Please log in to post a comment.