ptrmem1.c

来自「this is a gcc file, you can download it 」· C语言 代码 · 共 34 行

C
34
字号
// { dg-do compile }// Copyright (C) 2001 Free Software Foundation, Inc.// Contributed by Nathan Sidwell 31 Dec 2001 <nathan@codesourcery.com>// PR 3716 tsubsting a pointer to member function did not create a// pointer to member function.template <class C, class T, T C::*M>struct Closure{  T operator() (C & c) const { return (c.*M); }};template <class C, class T, T (C::* M)()>struct Closure<C, T (), M>{  T operator()(C & c) const { return (c.*M)(); }};struct A{  int get();};  static Closure<A, int (), & A::get> get_closure;void Foo (){  A a;  get_closure (a);}

⌨️ 快捷键说明

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