On Fri, Mar 23, 2012 at 23:19, Andrej Mitrovic
wrote:
> Yes but check the isA template. It seems there's something causing a
> nested variadic template to fail. This won't work in a template
> constraint (it returns false):
> But if you change "Args..." to "Args" then it works, although only for
On 3/23/12, Philippe Sigaud wrote:
> It works for me
Yes but check the isA template. It seems there's something causing a
nested variadic template to fail. This won't work in a template
constraint (it returns false):
template isA(alias Foo)
{
template isA(T)
{
enum bool isA = __trai
On Fri, Mar 23, 2012 at 21:27, Andrej Mitrovic
wrote:
> That can't work. For a Foo!int your code will expand like so:
> See for yourself:
? It works for me:
template isBar(T)
{
enum isBar = __traits(compiles,
{
vo
On 3/23/12, Philippe Sigaud wrote:
> testFoo is a function that accepts any Foo!( ... ) for any ... The
> second line tests it on a value of type T (T.init).
That can't work. For a Foo!int your code will expand like so:
// original code
void tester(Args...)(Foo!Args args);
tester(T.init);
void
On Fri, Mar 23, 2012 at 10:17, Ed McCardell wrote:
>>> Is there a way to write a template constraint that matches any
>>>
>>> specialization of a given type?
>>
>>
>> Nope. But there are simple workarounds:
>>
>> class Foo(bool feature1, bool feature2) { enum _isFoo = true; }
>>
>> template isFoo
Andrej Mitrovic:
Nope. But there are simple workarounds:
Why isn't something similar to this working?
import std.traits: Unqual;
class Foo(bool feature1, bool feature2) {}
template isFoo(T) {
static if (is(Unqual!T Unused : Foo!Features, Features...)) {
enum isFoo = true;
}
On 03/23/2012 04:14 AM, Andrej Mitrovic wrote:
On 3/23/12, Ed McCardell wrote:
Is there a way to write a template constraint that matches any
specialization of a given type?
Nope. But there are simple workarounds:
class Foo(bool feature1, bool feature2) { enum _isFoo = true; }
template isFo
On 3/23/12, Ed McCardell wrote:
> Is there a way to write a template constraint that matches any
> specialization of a given type?
Nope. But there are simple workarounds:
class Foo(bool feature1, bool feature2) { enum _isFoo = true; }
template isFoo(T) {
enum bool isFoo = __traits(hasMember
Is there a way to write a template constraint that matches any
specialization of a given type?
For example can the following be done without having to write out every
combination of feature1 and feature2:
class Foo(bool feature1, bool feature2) { ... }
void useFoo(T)(T foo)
if (is(T ==