- 浏览: 389195 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (309)
- xaml C# wpf (0)
- scala java inner clas (1)
- Tools UML Eclipse UML2 (1)
- Timer .NET Framework (1)
- perl (6)
- python function paramter (1)
- Python Docstring (1)
- Python how to compare types (1)
- Python (8)
- java (5)
- C# (76)
- C# WPF (0)
- p4 (0)
- WPF (46)
- .net (6)
- xaml (1)
- javascript (40)
- windows (10)
- scala (4)
- winform (1)
- c++ (48)
- tools (12)
- cmd (1)
- os (0)
- CI (0)
- shell (0)
- C (2)
- haskell (49)
- functional (1)
- tool (1)
- gnu (1)
- linux (1)
- kaskell (0)
- svn (0)
- wcf (3)
- android (1)
最新评论
There are three kinds of friends declaration that may appear within a class template.
A nontemplate friend class or friend function.
/** - A nontemplate friend class or friend function. * A nontemplate friend class or friend function. In the following example, the function foo(), the member function bar() * the member function bar() and the class foobar are friends to all instantiation of the class tepmlate QueueItem . * * this is a one-to-one relationship and the fiends are determined/fixed right in the declaration (there is only one declaration of the friends) */ class Foo { void bar(); }; class foobar {} template <class T> class QueueItem { friend class foobar; friend void foo(); friend void Foo::bar(); };
It is the one-to-one relationship, and there is only one function . and no matter how many instance of the function template , there is only one declaration.
A Bound friend class template or function template.
/** - A bound friend class template or function template * this is a one-to-one relationship and the friends are not determined (the friends is created when the class is instantiated).- */ template <class Type> class foobar { // }; template <class Type> void foo(QueueItem<Type>); template <class Type> class Queue { void bar(); }; template <class Type> class QueueItem { friend class foobar<Type>; friend class foo<Type>(QueueItem<Type>); friend class Queue<Type>::bar(); };
this is also a one-to-one relationship, but for a particular instantiation of the class template, there is one friend for that instantiation.
An unbound friend class
/** - An unbound friend class template or function template * unbound friend classes are multiple-to-one relationship * */ template <class Type> template QueueItem { friend class foobar; template <class T> friend void foo(QueueItem<T>); template <class T> friend void Queue<T>::bar(); };
There is a one-to-many relationship, where for a particular instantiation of the class template, there could be many function/classes that are the friends of the class template instantion.
发表评论
-
不安装Visual Studio,只用Windows SDK搭建VC环境
2013-12-31 21:52 15284首先你需要下载的是 Microsoft Windows S ... -
rpath - runtime search path
2013-04-03 11:36 964RPath is a very interesting to ... -
C++ - autogenerated copy constructor and assignment operator gotchas
2013-01-24 13:32 744It has been changed that the s ... -
c++ - rethrow a exception gotchas
2012-12-23 10:57 919As in my prevoius example in j ... -
c++ -typeid operator
2012-10-15 22:30 1031typeid is the one of the meager ... -
c++ - dynamic_cast revisit
2012-10-14 21:21 735There are several built-in type ... -
c++ - virtual inheritance example 1
2012-10-14 15:25 783we have discussed the virtual i ... -
c++ - virtual inheritance
2012-10-12 08:58 913As we have discussed in the pos ... -
c++ type of inheritance
2012-09-28 08:58 721There are 3 types of inheritanc ... -
c++ - vritually virtual new
2012-09-27 23:59 930Let's see what if we want to cl ... -
c++ - virtual destructor
2012-09-27 22:01 924As we all know that virtual des ... -
c++ - vritual function and default arguments
2012-09-27 08:56 950As we all know that we virtual ... -
c++ - template specialization and partial specialization
2012-09-26 22:38 1286in this post, we are going to e ... -
c++ - member template in class template
2012-09-26 08:19 903class member template can be us ... -
c++ template class and the pattern to use its friends
2012-09-25 23:47 957template class may defined thei ... -
c++ - class template default parameters
2012-09-25 08:18 800the template has parameter, it ... -
c++ - operator new and delete and an example of linked list stores by new/delete
2012-09-24 07:53 553The operator new and delete ope ... -
c++ - delete(void *, size_t) or delete(void *)
2012-09-24 07:18 1133In my previous dicuss, we have ... -
c++ - placement operator new() and the operator delete()
2012-09-23 15:22 837A class member operator new() c ... -
c++ - overloaded subscript operator - []
2012-09-23 08:50 1126You can overload the subscript ...
相关推荐
3D-vertex-declaration-system.zip,用于管理三维图形顶点结构。2013年为个人游戏引擎撰写。,3D建模使用专门的软件来创建物理对象的数字模型。它是3D计算机图形的一个方面,用于视频游戏,3D打印和VR,以及其他应用...
17-declaration-merging(声明合并17).pdf
一个文件用于保存程序的声明(declaration),称为头文件。另一个文件用于保存程序的实现(implementation),称为定义(definition)文件。 C++/C程序的头文件以“.h”为后缀,C程序的定义文件以“.c”为后缀,C++...
TI-EU Declaration of Conformity (DoC)U Declaration of Conformity (DoC
TI-EU Declaration of Conformity (DoC)U Declaration of Conformity (DoC
- C++ 2.1 support, including the new nested class specifications, and support of C++ 3.0 templates. - Support for pre-compiled headers for substantial time savings during subsequent recompiles. ...
For example, if your header file uses the File class in ways that do not require access to the declaration of the File class, your header file can just forward declare class File; instead of having ...
Too many type in declaration -----------------说明中类型太多 houjiuming Too much auto memory in function -----------------函数用到的局部存储太多 Too much global data defined in file ----------------...
- C++ 2.1 support, including the new nested class specifications, and support of C++ 3.0 templates. - Support for pre-compiled headers for substantial time savings during subsequent recompiles. ...
Files contained in apt-mirror-api-0.1.jar: META-INF/MANIFEST.MF META-INF/maven/com.moparisthebest.aptIn16/apt-mirror-api/pom.properties META-INF/maven/...
Kotlin_in_Action 英文 带完整书签和个人批注笔记 。
stylelint声明限制值 一个插件,可强制执行以下变量( $sass , namespace.$sass , @less , var(--cssnext) , css-loader @value ),函数或自定义CSS值,例如关键字( inherit , none , currentColor等) ,...
stylelint声明块没有被忽略的属性 原始规则: 。 禁止由于同一规则中的另一个属性值而被忽略的属性值。 a { display : inline; width : 100 px ; } /** ↑ * This property */ 某些属性值对排除了其他属性值对...
GNU Go是免费的带源代码的人机对弈软件,棋力在九级左右。和其它GNU 软件一样, 它遵从 GNU 公用许可证GPL。你可免费获得它的源代码,并可自由使用和修改。 但GNU GO只提供字符界面,更多相关内容请参见其主页...
CSS声明排序器 一个Node.js模块和插件,可根据其属性名称对CSS,SCSS或Less声明进行排序。 确保样式井井有条,更一致且井井有条...该软件包的目标是在构建过程中对项目的源代码进行排序,或者减小分布式CSS压缩后的...
请注意,您需要使用或类似的包将“父”属性添加到ast-declaration-source成功导航树所需的每个节点。 var source = require ( 'ast-declaration-source' ) var escodegen = require ( 'escodegen' ) var acorn = ...
The C++ Builder demo forms are distributed in binary format. 7) If upgrading from a previous version of the Drag and Drop Component Suite, please read the document "upgrading_to_v4.txt" before you ...
android 7.1的shortcuts功能demo
函数模板 我们可以把函数模板当做一种特殊的函数,里面的参数类型可以是任意类型,这样的话我们就可以减少重复定义,从而让这个函数模板自动...template <class> function_declaration; template <typename identi