auto sum( A... )( A a ) if( isIntegral!( typeid( a[ 0 ] ) ) ) { int temp; foreach( t ; a ) { temp += t; } return temp; } but it gives out error( note : I want all the parameter to be integral, i.e sum( 1, 2, 5, "error" ); //error
how to do template constraints with variadic templates ?
Flaze07 via Digitalmars-d-learn Sat, 07 Jul 2018 17:51:52 -0700
I want to force the variadic templates's type to be of certain
types, I thought doing this would work
- how to do template constraints with... Flaze07 via Digitalmars-d-learn
- Re: how to do template constra... Flaze07 via Digitalmars-d-learn
- Re: how to do template con... Simen Kjærås via Digitalmars-d-learn
- Re: how to do template... Flaze07 via Digitalmars-d-learn