pure and custom new / delete

Jonathan M Davis jmdavisProg at gmx.com
Tue Jun 26 11:35:13 PDT 2012


On Tuesday, June 26, 2012 20:08:14 Benjamin Thaut wrote:
> Thanks this works, but it seems to be a very ugly hack just to work
> around the type system. Also I have templated allocator functions I can
> not use this trick on. This is going to be a lot of work to get done
> properly, so I just ignore pure for now I think.

Note that since telling the compiler something is pure when it doesn't think 
so _is_ forcing the type system, it's not entirely unreasonable that it not be 
super-easy to do. However, it would definitely be nice if it were a lot easier 
than it is.

You could try std.traits.SetFunctionAttributes (it was recently added and is 
not in 2.59 IIRC). David Nadlinger created it specifically for being able to 
create easily add function attributes such as pure to a function. I haven't
messed around with it yet, but it looks very easy to use.

- Jonathan M Davis


More information about the Digitalmars-d mailing list