const

Michel Fortin michel.fortin at michelf.com
Mon Mar 31 20:14:49 PDT 2008


On 2008-03-31 11:45:09 -0400, "Steven Schveighoffer" 
<schveiguy at yahoo.com> said:

> What about declaring intermediate variables:
> 
> typeof(a) foo(const(T) a)
> {
>     ???(T) b = a;
> }
> 
> How is this enforced?

Well, can't you do that with a template? I don't have D 2 at hand right 
now, but shouldn't something like this do?

	T2 foo(T2 : const(T))(T2 a)
	{
		T2 b = a;
	}

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list