On Tuesday, 14 August 2018 at 16:03:05 UTC, vit wrote:
import std.traits : EnumMembers;
import std.string : join;
import std.algorithm : map;
pragma(msg, [EnumMembers!Type].map!(x => cast(string)x).join("
"));
Thank you!
Jonathan M Davis, I understood.
On Tuesday, August 14, 2018 8:37:33 AM MDT Andrey via Digitalmars-d-learn
wrote:
> On Tuesday, 14 August 2018 at 14:07:23 UTC, Timoses wrote:
> > Here's one version:
> >
> > template StringEnumValues(alias Enum)
> > {
> >
> > import std.traits : EnumMembers;
> > string[] StringEnumValues()
On Tuesday, 14 August 2018 at 14:37:33 UTC, Andrey wrote:
On Tuesday, 14 August 2018 at 14:07:23 UTC, Timoses wrote:
Here's one version:
template StringEnumValues(alias Enum)
{
import std.traits : EnumMembers;
string[] StringEnumValues()
{
string[] enumValues;
static
On Tuesday, 14 August 2018 at 14:37:33 UTC, Andrey wrote:
Thank you. Hmm, I thought that standard library already has
this stuff.
There might be more elegant solutions and I'd be happy to see
some more. I'm always just digging into std.traits [1] and Traits
spec part [2] and try to fumble thi
On Tuesday, 14 August 2018 at 14:07:23 UTC, Timoses wrote:
Here's one version:
template StringEnumValues(alias Enum)
{
import std.traits : EnumMembers;
string[] StringEnumValues()
{
string[] enumValues;
static foreach (member; EnumMembers!Enum)
enumValues
On Tuesday, 14 August 2018 at 13:42:04 UTC, Andrey wrote:
Hello,
I have a enum:
enum Type : string
{
One = "Q1",
Two = "W2",
Three = "R3"
}
I want to concat it in compile-time:
enum result = doConcat!Type();
And get this result:
writeln(result); // output: "Q1 W2 R3"
Delimiter h
On Tuesday, 14 August 2018 at 13:45:48 UTC, Mike Franklin wrote:
I think you just need to use the concatenation operator `~`.
enum Type : string
{
One = "Q1",
Two = "W2",
Three = "R3"
}
enum concatenation = Type.One ~ " " ~ Type.Two ~ " " ~
Type.Three;
void main()
{
import st
On Tuesday, 14 August 2018 at 13:42:04 UTC, Andrey wrote:
Hello,
I have a enum:
enum Type : string
{
One = "Q1",
Two = "W2",
Three = "R3"
}
I want to concat it in compile-time:
enum result = doConcat!Type();
And get this result:
writeln(result); // output: "Q1 W2 R3"
Delimiter h
Hello,
I have a enum:
enum Type : string
{
One = "Q1",
Two = "W2",
Three = "R3"
}
I want to concat it in compile-time:
enum result = doConcat!Type();
And get this result:
writeln(result); // output: "Q1 W2 R3"
Delimiter here is space symbol.
How do do it?