https://run.dlang.io/is/xiqi4P
not pretty :)) but ...
On Wednesday, 9 September 2020 at 17:02:26 UTC, visitor wrote:
On Friday, 14 February 2020 at 06:41:02 UTC, cc wrote:
import std.meta;
enum A = AliasSeq!(1, 2, 3, 4);
static foreach (idx, field; A) {
static if (__traits(compiles, THREELOOP)) {} else {
static if (field == 3) {
On Friday, 14 February 2020 at 06:41:02 UTC, cc wrote:
import std.meta;
enum A = AliasSeq!(1, 2, 3, 4);
static foreach (idx, field; A) {
static if (__traits(compiles, THREELOOP)) {} else {
static if (field == 3) {
pragma(msg, "Got a 3!");
enum
On 2/14/20 1:41 AM, cc wrote:
import std.meta;
enum A = AliasSeq!(1, 2, 3, 4);
THREELOOP: static foreach (idx, field; A) {
static if (field == 3) {
pragma(msg, "Got a 3!");
break THREELOOP;
}
static if (idx == A.length - 1) {
static assert(0, "Got no
this kind of thing doesn't work super well due to the nature of
compile time. My suggestion is to put the checks and the
implementation in separate things.
void foo(T...)() {
static bool checkHelper() {
bool passed;
static foreach(t; T) {
static if(is(t ==
Here's a more involved example of what I'm trying to accomplish.
Is there an easier/cleaner way to do this? (This is still a bit
reduced, what I'm actually trying to do is compare whether a
given variadic typetuple passed to opDispatch is implicitly
convertible to one of the parameter
import std.meta;
enum A = AliasSeq!(1, 2, 3, 4);
THREELOOP: static foreach (idx, field; A) {
static if (field == 3) {
pragma(msg, "Got a 3!");
break THREELOOP;
}
static if (idx == A.length - 1) {
static assert(0, "Got no