⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 friend4.c

📁 this is a gcc file, you can download it and learn its usetility, for further detail please look at t
💻 C
字号:
// Build don't link:// by Alexandre Oliva <oliva@dcc.unicamp.br>// I'm not 100% sure this program is correct, but g++ shouldn't just// crash.// The idea is to give privileged access to bar<A> only to// specializations foo<A,B>, for all B.template <class A, class B> void foo();template <class C> class bar {  int i; // ERROR - private  template <class B> friend void foo<C,B>(); // ERROR - bogus declaration};template <class A, class B> void foo() {  bar<A> baz; baz.i = 1;   // ERROR - foo cannot access bar<int>::i  bar<int> buz; buz.i = 1; // ERROR - foo cannot access bar<int>::i}int main() {  foo<void,void>();  foo<int,void>();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -