template startsNotWith(string s,char c){
enum startsNotWith = s.length == 0 || s[0] != c;
}
Better still:
enum startsNotWith(string s, char c) = { return s.length == 0 ||
s[0] != c; }
On 2015-05-04 03:52:21 +, Rikki Cattermole said:
Have you looked at my book? https://leanpub.com/ctfe
No, thanks for the hint. You will have one more reader ;-)
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
On 2015-05-03 23:28:00 +, anonymous said:
Here T would have to be a type. But you want to accept a string. So:
template startsNotWith(string s,char c){
enum startsNotWith = s.length == 0 || s[0] != c;
}
Hi, ok, just to better understand this (I have a C++ background (even
On 2015-05-03 23:28:00 +, anonymous said:
You need to turn T into a parameter, so that StaticFilter can set it.
(And it's really a string again, so I'm renaming to s.)
template startsNotWithp(string s)
{
enum startsNotWithp = startsNotWith!(s, 'p');
}
/* Shorthand syntax: enum
On Monday, 4 May 2015 at 11:22:16 UTC, Robert M. Münch wrote:
Hi, ok, just to better understand this (I have a C++ background
(even quite old)): When I want to use some functions I need to
specify the type? It's not possible to use T.length() which
would compile if T is a string? I thought
On 4/05/2015 11:15 p.m., Robert M. Münch wrote:
On 2015-05-04 03:52:21 +, Rikki Cattermole said:
Have you looked at my book? https://leanpub.com/ctfe
No, thanks for the hint. You will have one more reader ;-)
I'm currently live streaming, feel free to jump on and ask any questions!
On Monday, 4 May 2015 at 11:41:23 UTC, Robert M. Münch wrote:
Hi, I have one more questions: Is it possible to write
something like this?
alias rules = StaticFilter!(startsNotWith(?, 'p'), org_rules);
The ? should be used for every memember of org_rules.
No, we don't have template literals.
On 2015-05-04 03:52:21 +, Rikki Cattermole said:
Have you looked at my book? https://leanpub.com/ctfe
I bought it. Will it be updated?
It's very generic with respect the concept and I'm missing code
examples for all the user-cases. Especially the generator part is IMO
very interesting.
On 5/05/2015 6:24 a.m., Robert M. Münch wrote:
On 2015-05-04 03:52:21 +, Rikki Cattermole said:
Have you looked at my book? https://leanpub.com/ctfe
I bought it. Will it be updated?
It's very generic with respect the concept and I'm missing code examples
for all the user-cases.
Hi, I have now played a around couple of hours (reading everything I
could find) to get something to work, but I think I'm missing some
basic concepts/understanding. Maybe someone can enlighten me how these
things work. I thought that some code from David Nadlinger is what I'm
searching for
On Sunday, 3 May 2015 at 21:46:11 UTC, Robert M. Münch wrote:
Hi, I have now played a around couple of hours (reading
everything I could find) to get something to work, but I think
I'm missing some basic concepts/understanding. Maybe someone
can enlighten me how these things work. I thought
On Sunday, 3 May 2015 at 21:46:11 UTC, Robert M. Münch wrote:
3. TupleType is a very missleading name when you are learning
these things, because the tuple can hold values as well. Or is
there a more extensive explanation for the name I don't get?
Legacy we are trying to get rid of. See also:
On 4/05/2015 9:46 a.m., Robert M. Münch wrote:
Hi, I have now played a around couple of hours (reading everything I
could find) to get something to work, but I think I'm missing some basic
concepts/understanding. Maybe someone can enlighten me how these things
work. I thought that some code from
13 matches
Mail list logo