Hello.
I'm trying to learn more of D templates, but I'm stuck with an issue I
cannot resolve. Well, actually, I don't know if this is even allowed, and
that's why I'm posting here. Suppose I have a function declared like this:
---
import std.traits;
void foo(T...)(T args) if( isSomeString!(
Yao G. wrote:
Hello.
Greetings.
foo( "Hello World", first, second );
---
You can notice that the first argument is a string literal. What I want
to know is: If a function argument is declared as a string literal, it
can be accessed at compile time? And if the answer is yes, how can I d
You have to take a look at what the compiler does normally. It doesn't do magic.
Generally a function is something that takes a run-time value with a simple
protocol. So when an argument is inside a function, it's a variable, even if
the function was called with a constant.
Walter actually trie
On Wed, 07 Apr 2010 03:05:34 -0400, Simen kjaeraas
wrote:
Yao G. wrote:
Hello.
Greetings.
foo( "Hello World", first, second );
---
You can notice that the first argument is a string literal. What I want
to know is: If a function argument is declared as a string literal, it
can be