![]() |
От: | DarkEld3r | |
Дата: | 25.11.13 11:54 | ||
Оценка: |
![]() |
class Test
{
private:
int a;
template<typename Container>
friend void f1(Container &container);
template<template<typename, typename> class Container, template <typename> class Allocator>
friend void f2(Container<Test, Allocator<Test>> &container);
};
template<typename Container>
void f1(Container &container)
{
Test test;
test.a = 10;
}
template<template<typename, typename> class Container, template <typename> class Allocator>
void f2(Container<Test, Allocator<Test>> &container)
{
Test test;
test.a = 10;
}
int main(int argc, char *argv[])
{
std::vector<Test> v;
f1(v); // Oк
f2(v); // Не ок
return 0;
}
Есть какой-нибудь не сильно ужасный воркараунд? В GCC всё ок.Error 2 error C2248: 'Test::a' : cannot access private member declared in class 'Test'