On 05/24/2015 09:14 PM, tcak wrote:
Line 243: auto fileResourceList = new shared FileResourceList( 2
);
main.d(243): Error: class main.FileResourceList(T) if (is(T :
FileResource)) is used as a type
struct and class templates do not have automatic type deduction;
function templates do.
On Monday, 25 May 2015 at 04:15:00 UTC, tcak wrote:
main.d(243): Error: class main.FileResourceList(T) if (is(T :
FileResource)) is used as a type
The error message is not indicating directly this, though
logically it is still correct.
Compiler means template is used as a type which is an
On Sun, 24 May 2015 23:32:50 +, ZombineDev wrote:
I know I can call a base implementation of a method like in 3), but I
need to do it generically like in 2). Does anybody now how I can achieve
this?
i don't know why you want that, but something like this may do:
auto
On Monday, 25 May 2015 at 07:57:49 UTC, ketmar wrote:
i don't know why you want that, but something like this may do:
auto callBaseMethod(string MTN, C, Args...) (inout C self, Args
args) {
alias FSC = BaseClassesTuple!(C)[0];
return mixin(`self.`~FSC.stringof~`.`~MTN~(args));
}
I'm a bit at a loss here. I cannot get the longest possible
match. I tried several versions with eager operators and stuff,
but D's regex engine(s) always seem to return the shortest match.
Is there something embarrassingly simple I'm missing?
void main()
{
import std.regex : regex,
I cannot get the longest possible
it match longest for first group ([a-z]+)
try
^([a-z]+?)(hula|ula)$
On Monday, 25 May 2015 at 11:20:46 UTC, novice2 wrote:
I cannot get the longest possible
it match longest for first group ([a-z]+)
try
^([a-z]+?)(hula|ula)$
Namespace, novice2:
Ah, I see. The problem was with the first group that was too
greedy, not with the second. I was focusing on the
On Monday, 25 May 2015 at 11:11:50 UTC, Chris wrote:
I'm a bit at a loss here. I cannot get the longest possible
match. I tried several versions with eager operators and stuff,
but D's regex engine(s) always seem to return the shortest
match. Is there something embarrassingly simple I'm
On Monday, 25 May 2015 at 09:24:58 UTC, ZombineDev wrote:
On Monday, 25 May 2015 at 07:57:49 UTC, ketmar wrote:
i don't know why you want that, but something like this may do:
auto callBaseMethod(string MTN, C, Args...) (inout C self,
Args args) {
alias FSC = BaseClassesTuple!(C)[0];
On Monday, 25 May 2015 at 15:46:54 UTC, Dennis Ritchie wrote:
On Monday, 25 May 2015 at 15:06:45 UTC, Alex Parrill wrote:
Hint: Use `cartesianProduct` [1] with three iota ranges to
replace the foreachs, and `filter` to replace the if
[1]
Hi,
Is it possible to write such a construction that could push
immediately to a conditional statement without using nested
loops? Ie organize search directly in the iterator if provided by
a map / each / iota and other support functions.
Ie I want to write this code shorter :)
import
On Monday, 25 May 2015 at 15:06:45 UTC, Alex Parrill wrote:
Hint: Use `cartesianProduct` [1] with three iota ranges to
replace the foreachs, and `filter` to replace the if
[1]
http://dlang.org/phobos/std_algorithm_setops.html#.cartesianProduct
Thank you. Is it possible to replace the loop
On Monday, 25 May 2015 at 14:25:52 UTC, Dennis Ritchie wrote:
Hi,
Is it possible to write such a construction that could push
immediately to a conditional statement without using nested
loops? Ie organize search directly in the iterator if provided
by a map / each / iota and other support
On Monday, 25 May 2015 at 16:41:35 UTC, Meta wrote:
import std.algorithm;
import std.range;
import std.stdio;
void main()
{
const x = 12, y = 65, z = 50, s = 1435;
auto a = iota(0, x + 1);
cartesianProduct(a, a, a)
.filter!(i = i[0] * (y + 3 * z)
+ i[1] * (y + 2
On Saturday, 23 May 2015 at 07:03:35 UTC, Vladimir Panteleev
wrote:
int[] arr = [1, 2, 3];
auto r = iota(4, 10);
// ???
assert(equal(arr, iota(1, 10)));
Hopefully in one GC allocation (assuming we know the range's
length).
I tried std.range.primitives.put but its behavior seems a
little
On Monday, 25 May 2015 at 17:05:35 UTC, Dennis Ritchie wrote:
On Monday, 25 May 2015 at 16:41:35 UTC, Meta wrote:
import std.algorithm;
import std.range;
import std.stdio;
void main()
{
const x = 12, y = 65, z = 50, s = 1435;
auto a = iota(0, x + 1);
cartesianProduct(a, a, a)
On Monday, 25 May 2015 at 19:16:04 UTC, anonymous wrote:
On Monday, 25 May 2015 at 17:52:09 UTC, Dennis Ritchie wrote:
But why is the solution breaks down when `s = 1` ? :)
import std.stdio, std.algorithm, std.range;
int c;
const x = 12, y = 65, z = 50, s = 10;
Which is it, now? 4
On Monday, 25 May 2015 at 17:52:09 UTC, Dennis Ritchie wrote:
But why is the solution breaks down when `s = 1` ? :)
import std.stdio, std.algorithm, std.range;
int c;
const x = 12, y = 65, z = 50, s = 10;
Which is it, now? 4 or 5 zeros?
void solve(Range)(Range r) {
On Monday, 25 May 2015 at 17:19:27 UTC, Meta wrote:
`each` doesn't support braces. There are 4 ways to write a
function/delegate literal in D (with a few minor variations):
Short form:
function(int i) = i;
(int i) = i
(i) = i
i = i
Long form:
function(int i) { return i; }
(int i) { return i;
On Thursday, 21 May 2015 at 19:06:35 UTC, Jacob Carlborg wrote:
On 2015-05-21 11:06, Timothee Cour via Digitalmars-d-learn
wrote:
Can I create an instance of A without calling a constructor?
(see below)
Use case: for generic deserialiaztion, when the
deserialization library
encounters a class
On Mon, 25 May 2015 09:24:56 +, ZombineDev wrote:
alias can't refer to a nested member:
-
struct Point2 {
float x;
float y;
}
struct Line2 {
Point2 start;
Point2 end;
mixin Access;
// alias x1 = this.start.x; - this doesn't work :(
On Mon, 25 May 2015 09:24:56 +, ZombineDev wrote:
On Monday, 25 May 2015 at 07:57:49 UTC, ketmar wrote:
i don't know why you want that, but something like this may do:
auto callBaseMethod(string MTN, C, Args...) (inout C self, Args args) {
alias FSC = BaseClassesTuple!(C)[0];
return
On Tuesday, 26 May 2015 at 05:22:26 UTC, Tofu Ninja wrote:
Actually the code seems to compile on 2.067.1 but definitely does
not work as expected.
Another example of Lazy variadic to show how it works...
void main(string[] args)
{
test(a(), b(), c());
}
bool a()
{
writeln(a);
On Tuesday, 26 May 2015 at 05:43:59 UTC, Tofu Ninja wrote:
On Tuesday, 26 May 2015 at 05:22:26 UTC, Tofu Ninja wrote:
Actually the code seems to compile on 2.067.1 but definitely
does not work as expected.
...
I guess it stems from the fact that its lazy (bool[])
Wish I could do (lazy
On Tuesday, 26 May 2015 at 05:22:26 UTC, Tofu Ninja wrote:
So I was writing a simple parser and I wanted a functionality
that was basically try list of tokens in order and if any of
them fail, rewind input.
I tried using a lazy variadic function:
bool tok_and(lazy bool[] terms ...)
{
So I was writing a simple parser and I wanted a functionality
that was basically try list of tokens in order and if any of
them fail, rewind input.
I tried using a lazy variadic function:
bool tok_and(lazy bool[] terms ...)
{
auto backup = getInputLocation();
for(int i = 0; i
26 matches
Mail list logo