动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
电脑书籍下载:程序设计书籍 | 数据库教程书籍 | 平面与多媒体书籍 | 网络通讯书籍 | 系统管理书籍 | 网络安全书籍 | 认证考试书籍
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > C/C++教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ C/C++教程 ]的信息



本月文章推荐
.3. 关键字和标识符.
.C++还能重新辉煌吗?C++复杂性的.
.C++ 内联函数.
.关于全排列算法,大家请指导!.
.C程序开发经典实例之4.
.C语言程序设计基础讲座之指针的慨.
.用一维数组存储上三角螺旋矩阵.
.LINUX C语言开发之2.
.基于Nokia S60的游戏开发之四.
.ActiveX技术综述(二) .
.C语言初级讲座之慨论.
.C++箴言:将强制转型减到最少.
.C++程序设计之四书五经(上篇).
.QQ用户小心了! C语言实现QQ密码大.
.如何在C/C++中调用Java.
.VC++开发PhotoShop插件之选区.
.Perl的经典用法.
.用C++程序删除文本文件中以“//”.
.Delphi 插件创建、调试与使用应用.
.打字游戏.

Another way to handle array initialization

发表日期:2008-3-8 |



  PROBLEM: bwh@kato.prl.ufl.edu (Brian Hook)

[...]

I STILL haven't gotten a good technical reason why
parameters to constrUCtors for arrays haven't been at least talked out (I'm
not a committee member, so I don't know if this has been shot down
informally, so if it has, forgive my lack of knowledge on this).

I even asked The Man himself, and his response was basically that he didn't
see much need for it. I know I run into instances on occasion where I want
to specify something that is constant over an entire array of objects. For
example, something even as simple as "name".

Object array1[100]("Member of array1");
Object array2[100]("Member of array2");

I suppose templates serve much the same purpose, but it just seems so
damned inconsistent to not have parameters to constructors for arrays!

Sure, there's the old trick:

Object::name = "Member of array1";
Object array[100];
Object::name = "Member of array2";
etc. etc.

Now if THAT ain't ugly, I don't know what is!


RESPONSE: kanze@us-es.sel.de (James Kanze), 6 Jul 94

The trick I use is slightly different:

template< double r , double i >
class ComplexWithInit : public Complex
{
public :
ComplexWithInit()
: Complex( r , i ) {}
} ;

Complex* c1 = new ComplexWithInit< 1.0 , 2.0 >[ 10 ] ;
Complex* c2 = new ComplexWithInit< 3.0 , 4.0 >[ 20 ] ;

Formally speaking, this is *not* guaranteed to work. Practically, I
would be interested in hearing about a plausible implementation where
it will not actually work. (Finding the correct standardese which
would permit guaranteeing this to work without causing problems
elsewhere is a non-trivial problem, however.)
上一篇:51单片机Keil C延时程序的简单研究 人气:908
下一篇:API之菜单函数 人气:373
浏览全部C/C++的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-7-23 Menalto Gallery v2.3 Rc1 多国语
2008-7-23 深度学习网址导航系统 v2.6.1
2008-7-23 因特达crm2008客户关系管理系统
2008-7-23 60度 CMS v1.0 Build 080723
2008-7-23 幻影动漫网视频系统(Ppdong) v1.
2008-7-23 好易祝福墙 2008
2008-7-23 APJE私服发布系统 v2.0 PHP版
2008-7-23 毕业论文在线指导系统源码
2008-7-23 Jacky法律在线网站源码
2008-7-19 UltraEdit 简体中文增强版 14.10
2008-7-19 CentOS 5.2 i386 LiveCD
2008-7-19 Snapture多功能相机 v1.4
2008-7-19 iAcces中文输入法 v1.0Build016
2008-7-19 Cookbook烹饪秘籍 v2.5
2008-7-19 苹果专用DVD转换工具 v1.1.59汉化
2008-7-19 Modem修复软件ZiPhone修改版04.0
2008-7-19 AgileMessenger即时通讯工具美化
2008-7-19 Sketches画图软件 v0.7b6破解版


  发表评论
姓 名: 验证码:
内 容:
[ 汉字翻译拼音 ] [ 广告代码 ] [ 符号对照表 ] [ 进制转换 ] [ 经典小工具 ] [ 个税计算 ] [ 汉字简繁转换 ] [ 普通单位换算 ] [ 公制单位换算 ]
[ 生辰老黄历 ] [ 国内电话区号 ] [ 国家代码与域名缩写 ] [ 文字加密解密 ] [ 健康查询 ] [ 万年历 ] [ 手机号码查询 ] [ ip搜索 ] [ Google PR查询 ]
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報
防水工事·改修工事 フットサル大会 探偵