some template questions

BCS BCS_member at pathlink.com
Tue May 23 00:46:15 PDT 2006


In article <e4ub7s$2v7l$1 at digitaldaemon.com>, Don Clugston says...
>
>BCS wrote:
>> Two questions:
[...]
>
>It doesn't work because D doesn't have array literals yet.

???

this works (I was using it tonight):

struct fo {int i}
fo[] bar = [ {i:5}, {i:6} ];

--------------------------
>> template hang()
>> {
>> static assert(false);
>> const int hang = hang!();
>> }
[...]
>-----
>If that it fails for you, enter it in Bugzilla as a regression or 
>Linux-only bug.
>

@#$%@ faulty memory (the gray wet stuff, not the silicon suff). Try:

template hang(int i)
{
static assert(0);
const int hang = hang!(i-1);
}

const int x = hang!(1);

this hangs 0.157 on Linux and XP (now bug #152)


OK, next question: has anyone done a sort?

static assert("abc" == sort!("bca"));





More information about the Digitalmars-d-learn mailing list