qiezi的学习园地

AS/C/C++/D/Java/JS/Python/Ruby

  C++博客 :: 首页 :: 新随笔 ::  ::  :: 管理 ::
Nov 23, 2005

New/Changed Features

  • Added std.string.soundex.
  • Added std.string.entab.
  • Added std.string.wrap.
  • Added std.string.abbrev.
  • Added std.windows.charset (thanks to Stewart Gordon, D/28246).
  • Added std.demangle to demangle D names.
  • Improved promotion of names inside templates.
  • Now allows floating point and string literals as template value arguments.
  • To support the previous, the name mangling of template instances has changed. This will necessitate recompilation of any code that uses templates.
  • std.utf.UtfError is now deprecated. Use std.utf.UtfException instead.

Bugs Fixed


比较感兴趣的是浮点数和字符串常量作为模板值参数,简单测试了一下:

import std.stdio;

template TFloat (
float F)
{
    
float value = F;
}

template TString (
char[] S)
{
    
char[] value = S;
}

void main()
{
    alias TFloat
!(3.14f) PI;
    writefln(PI.value);
    writefln(TString
!("hello").value);
}

编译通过,运行结果如下:

3.14
hello
posted on 2005-11-25 13:38 qiezi 阅读(307) 评论(0)  编辑 收藏 引用 所属分类: 学习方向D