On Thursday, 11 July 2013 at 03:29:13 UTC, Kenji Hara wrote:
On Thursday, 11 July 2013 at 03:10:38 UTC, timotheecour wrote:
On Thursday, 11 July 2013 at 02:17:13 UTC, Timothee Cour wrote:
[snip]
can we add this to std.traits?
it allows (among other things) to write unittests for CTFE,
etc.
On Thursday, 11 July 2013 at 03:10:38 UTC, timotheecour wrote:
On Thursday, 11 July 2013 at 02:17:13 UTC, Timothee Cour wrote:
[snip]
can we add this to std.traits?
it allows (among other things) to write unittests for CTFE, etc.
Phobos has an internal helper function for testing CTFEable.
h
On Thursday, 11 July 2013 at 02:17:13 UTC, Timothee Cour wrote:
template isCallableCTFE(alias fun){
template isCallableCTFE_aux(alias T){
enum isCallableCTFE_aux=T;
}
enum
isCallableCTFE=__traits(compiles,isCallableCTFE_aux!(fun()));
}
template isCallableCTFE2(fun...){
enum isCallableCTFE2=tru
On Wed, Jul 10, 2013 at 7:16 PM, Timothee Cour wrote:
> template isCallableCTFE(alias fun){
> template isCallableCTFE_aux(alias T){
> enum isCallableCTFE_aux=T;
> }
> enum isCallableCTFE=__traits(compiles,isCallableCTFE_aux!(fun()));
> }
>
> template isCallableCTFE2(fun...){
> enum isCallableCTFE
template isCallableCTFE(alias fun){
template isCallableCTFE_aux(alias T){
enum isCallableCTFE_aux=T;
}
enum isCallableCTFE=__traits(compiles,isCallableCTFE_aux!(fun()));
}
template isCallableCTFE2(fun...){
enum isCallableCTFE2=true;
}
unittest{
int fun1(){
return 1;
}
auto fun1_N(){
import std.a