mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-11-16 07:48:44 +01:00
TODO updated
This commit is contained in:
parent
e2378e6e5b
commit
2fa9c3c22c
1 changed files with 39 additions and 0 deletions
|
@ -44,6 +44,8 @@ struct Base
|
|||
{};
|
||||
};
|
||||
|
||||
// call a static member template of a class template:
|
||||
// ==================================================
|
||||
template <typename Type>
|
||||
struct Der: public Base<Type>
|
||||
{
|
||||
|
@ -55,5 +57,42 @@ struct Der: public Base<Type>
|
|||
};
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
template <typename Type>
|
||||
struct Base
|
||||
{
|
||||
template <typename Tp1> // to declare it as friend: use the normal
|
||||
friend class Friend; // template declaration and `friend'
|
||||
|
||||
template <typename Tp>
|
||||
static void fun();
|
||||
|
||||
|
||||
private:
|
||||
void run();
|
||||
|
||||
};
|
||||
|
||||
template <typename Tp1>
|
||||
class Friend
|
||||
{
|
||||
public:
|
||||
void call(Base<Tp1> &base)
|
||||
{
|
||||
base.run();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Friend<int> fr;
|
||||
Base<int> bi;
|
||||
|
||||
fr.call(bi);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue