On Friday, 25 August 2017 at 08:27:41 UTC, Jacob Carlborg wrote:
Since you're converting the returned index to a bool, can't you
use "canFind" instead?
immutable englishIndefiniteArticles = [`a`, `an`];
bool isEnglishIndefiniteArticle(S)(S s)
{
return englishIndefiniteArticles.canFind(s);
On 2017-08-25 08:12, Nordlöw wrote:
Thanks!
Your advice led to the following sample solution
import std.meta : aliasSeqOf;
immutable englishIndefiniteArticles = [`a`, `an`];
bool isEnglishIndefiniteArticle(S)(S s)
{
return cast(bool)s.among!(aliasSeqOf!englishIndefiniteArticles);
}
Is
On Thursday, 24 August 2017 at 22:38:29 UTC, Meta wrote:
https://dlang.org/phobos/std_meta.html#aliasSeqOf
Thanks!
Your advice led to the following sample solution
import std.meta : aliasSeqOf;
immutable englishIndefiniteArticles = [`a`, `an`];
bool isEnglishIndefiniteArticle(S)(S s)
{
On Thursday, 24 August 2017 at 19:41:46 UTC, Nordlöw wrote:
Given
enum e = ['a', 'b', 'c'];
import std.meta : AliasSeq;
enum a = AliasSeq!['a', 'b', 'c'];
is it somehow possible to convert (at compile-time) `e` to `a`?
Is it cheaper CT-performance wise to use AliasSeq instead of
Given
enum e = ['a', 'b', 'c'];
import std.meta : AliasSeq;
enum a = AliasSeq!['a', 'b', 'c'];
is it somehow possible to convert (at compile-time) `e` to `a`?
Is it cheaper CT-performance wise to use AliasSeq instead of enum
static arrays?
My use case is expressed by the TODOs in