Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<size_t n>
- class A
- {
- int x;
- public:
- void foo() {
- A<1> a;
- //a.x; // Как получить прямой доступ к x для инстанциаций A<i>, i != 1?
- }
- };
- template<size_t n>
- class A
- {
- int x;
- template<size_t u>
- friend class A;
- public:
- void foo() {
- A<5> a5;
- cout << a5.x;
- A<2> a2;
- cout << a2.x;
- }
- };
- int main(int argc, const char * argv[])
- {
- A<8> x;
- x.foo();
- }
Add Comment
Please, Sign In to add comment