Partial template function specialization
Sato. E.
sato at nomail.com
Thu Aug 20 06:04:09 PDT 2009
Peter Alexander Wrote:
> Hey all,
>
> I'm considering learning D at the moment, and one thing that has bothered me in C++ is the lack of partial template function specializations. For example, you can create something like this:
> template <class Field>
> const Field norm(const Vector3<Field>& v)
> { /* return sqrt( ... ) */ }
> Thanks in advance.
Field norm(Field, V)(V v) {
...
}
Field norm(Field, V : Vector3!(Field))(ref V v) {
...
}
---
auto v = new Vector3!(float)
norm!(float)(v)
More information about the Digitalmars-d-learn
mailing list