相关讨论
一个singleton模板实现的练习
Sing.h
[code]#include
template class CTplSingleton
{
private:
static T _instance;
static pthread_mutex_t mutex;
protected:
CTplSingleton& operator=(const CTplSingleton&);
CTplSingleton();
~CTplSingleton();
public:
static T& instance();
};[/code]
Sing.cpp
[code]#include "Sing.h"
//static member data
template pthread_mu...
by
andyY
-
C/C++
-
2006-10-25 14:09:38 阅读(2786) 回复(2)
[color="#000000"]自定义的函数:
[color="#990000"]函数执行:
实例: 取得IP所对应的DNS名称 (IP -> FQDN)
[color="#000000"]$host= gethost($ip);
echo "hostname: $host";
?>
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/28922/showart_345382.html
* ファイル選択時のデフォルトパスの取得(汎用モジュール)
IF p_iofile IS INITIAL.
CALL function 'WS_ULDL_PATH'
IMPORTING
upload_path = p_iofile.
* ファイル選択ボックス(汎用モジュール)
CALL function 'WS_FILENAME_GET'
EXPORTING
def_filename = ' '
def_path = p_iofile
mask = ',*.*,*.*.'
m...
一个自定义脚本运行时需要调用另外一个自定义脚本?可以把被调用的脚本写成一个function放到要调用它的脚本中吗?
by
ha_
-
Shell
-
2006-02-14 11:17:48 阅读(1135) 回复(5)
[code]template
T add_func(T a,T b)
{
return a + b;
}
template int add_func(int a,int b);[/code]这里
template int add_func(int a,int b);
是不是实例化了一个参数和返回值都为int的函数?
template 定义:
定义一个操作中算法的骨架,将一些步骤的执行延迟到其子类中.
其实Java 的抽象类本来就是template 模式,因此使用很普遍.而且很容易理解和使用,我们
直接以示例开始:
public abstract class Benchmark
{
/**
* 下面操作是我们希望在子类中完成
*/
public abstract void benchmark();
/**
* 重复执行benchmark 次数
*/
public final long repeat (int count)...
If I add an template in SAM, so what's the template's derectory?
THX
BR
If I add an template in SAM, so what\'s the template\'s derectory?
THX
BR
我使用这样的语法
template
class A
{
public:
void print(){cout << "A print" << endl;}
};
templatetemplateclass Policy>
class B
{
Policy p;
public:
void print(){p.print();}
};
如果我想只有一个template参数的话该怎么办呢
template<templateclass Policy>
class B
{
&nb...
发现open64不支持nested function。
源码如下:[code] if (CURRENT_SYMTAB > 1)
ErrMsg (EC_Unimplemented_Feature, "Nested functions");[/code]验证如下:[code]$ cat nested.c
#include
int
main (void)
{
void
func (void)
{
printf ("hello\n");
}
func ();
return 0;
}
[/code]用gcc可以编译通过,并正确运行。用open64编译会报:
### Compiler Error during Writing WHIRL file...