On 04/25/2014 09:14 AM, FrankLike via Digitalmars-d wrote:
Hi,everyone,
Here has a error after run: main.exe 11 or main.exe 10 :
template find(T)
{
size_t find(T[] Array,T Element)
{
find returns a size_t being a nonnegativ number.
return -1;
But here it returns -1.
In
On 02/06/2014 10:44 PM, Timon Gehr wrote:
On 02/06/2014 10:32 PM, Matthias Walter wrote:
Is this a bug?
Yes.
Okay, added a ticket: http://d.puremagic.com/issues/show_bug.cgi?id=12102
Hi,
I realized the following behavior and want to ask whether this is
expected behavior and if yes, I'd like to know a reason.
The check of MyClass.func(MyClass.A) and MyClass.func(MyClass.B) in the
main() function succeeds, but the alias line *in* the class definition
fails with template
Hi,
I read about inout functions in the language documentation which allows
to use inout in order to set the constness of the return type based on
the constness of some argument. What is not mentioned is that this also
works for the this-reference by marking the function itself inout:
So instead
Hi,
about 2 years ago I stopped using D for my projects since there were too
many bugs that hindered me from making quick progress. Since I got
several mails from bugzilla about those bugs being fixed I wanted to
give it another try. Unfortunately, the following non-working code made
me think to
On 07/18/2012 03:32 PM, Christophe Travert wrote:
Matthias Walter , dans le message (digitalmars.D:172673), a écrit :
I looked at Bug #6153 (Array!(Array!int) failure) and found that the
This exactly is what makes the following code fail:
Array!(Array!int) array2d;
array2d.length = 1
On 07/19/2012 10:14 AM, Christophe Travert wrote:
monarch_dodra , dans le message (digitalmars.D:172700), a écrit :
I think it would be better to initialize on copy, rather than
default initialize. There are too many cases an empty array is
created, then initialized on the next line, or
the user explicitly initialized the reference counter.
Or is there a reasonable alternative?
Best regards,
Matthias Walter
On 07/19/2012 06:44 AM, Jonathan M Davis wrote:
On Thursday, July 19, 2012 04:39:26 Francisco Soulignac wrote:
So, my question is how can I (correctly) traverse a const SList,
const DList, etc?
Right now? I'm pretty sure that that's impossible. Hopefully that will
change,
but getting
On 07/19/2012 02:27 PM, Namespace wrote:
I have a 2 questions.
I have this code:
[code]
import std.stdio;
struct Test {
public:
this(int i = 0) {
writeln(Test CTor.);
}
this(this) {
writeln(Test Copy CTor);
}
~this() {
On 07/19/2012 03:00 PM, Namespace wrote:
Is there any way to avoid the implizit copy ctor by array concatenation?
Or is the only way to use a pointer?
Yes, in some way you have to. If you want to not copy a lot of data (or
avoid additional on-copy effort) you either have to you pointers
enlarging the outer array, the inner
array is a null pointer which must be created by new.
Best regards,
Matthias Walter
Hi,
I'd like to know who is currently working on std.container - at some
point I read that Andrei works on user-controlled allocation and then
the issues of container structures will be addressed. Unforntunately, at
the moment std.container.Array is unusable for me because of missing
const Range
On 07/17/2012 12:41 AM, Andrei Alexandrescu wrote:
On 7/16/12 4:19 AM, Matthias Walter wrote:
Hi,
I'd like to know who is currently working on std.container - at some
point I read that Andrei works on user-controlled allocation and then
the issues of container structures will be addressed
On 06/29/2012 12:47 PM, Namespace wrote:
A friend of mine ask me why D's foreach isn't like C#
Means, why is it like
int[] arr = [1, 2, 3];
foreach (int val; arr) {
and not
foreach (int val in arr) {
which it is more intuitive.
I could give him no clever answer to, so maybe
On 06/19/2012 04:04 PM, Timon Gehr wrote:
On 06/19/2012 02:54 PM, Christophe Travert wrote:
Jonathan M Davis , dans le message (digitalmars.D:170054), a écrit :
I'd propose to always add a bool template parameter (maybe isConst?) to
the range since most of the write-functionality can be
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 06/18/2012 01:08 PM, Jonathan M Davis wrote:
On Monday, June 18, 2012 10:06:44 Matthias Walter wrote:
Hi,
last week I realized that a const version of
std.container.Array.opSlice() is missing. Now I looked at the
code and I think
On 06/18/2012 07:36 AM, Mehrdad wrote:
Is it just me, or did I subvert the type system here?
import std.stdio;
struct Const
{
this(void delegate() increment)
{ this.increment = increment; }
int a;
void delegate() increment;
void oops() const { this.increment(); }
On 06/18/2012 08:04 AM, Mehrdad wrote:
On Monday, 18 June 2012 at 06:00:11 UTC, Matthias Walter wrote:
On 06/18/2012 07:36 AM, Mehrdad wrote:
Is it just me, or did I subvert the type system here?
import std.stdio;
struct Const
{
this(void delegate() increment)
{ this.increment
On 06/18/2012 08:19 AM, Mehrdad wrote:
On Monday, 18 June 2012 at 06:14:22 UTC, Matthias Walter wrote:
Its not, that a const method cannot modify an object, it just
ensures that the const method cannot modify the object *by using
the this-pointer*.
I see...
So that means you /can't
Hi,
last week I realized that a const version of
std.container.Array.opSlice() is missing. Now I looked at the code and I
think that it is a general design problem.
The docs state that c.Range is The primary range type associated with
the container.. I think we really always need two Range types
Hi,
I have a const std.container object (e.g., a const(Array!int)) of which
I'd like to have a range which can traverse that container having
read-only access. This does not seem to be possible with opSlice(). Is
there an alternative?
Best regards,
Matthias
On 06/10/2012 12:30 AM, Era Scarecrow wrote:
On Saturday, 9 June 2012 at 10:09:25 UTC, Matthias Walter wrote:
First, thank you for your answer. I've already made some tiny
modifications in order to make BitArray work for my purposes:
https://github.com/xammy/phobos/commit
On 2012-06-08 22:47, Era Scarecrow wrote:
On Friday, 8 June 2012 at 16:33:28 UTC, Matthias Walter wrote:
Hi,
trying to traverse the entries of a std.bitmanip.BitArray I stumbled
upon the following problem:
In case I want to accept const(BitArray) objects, it shall look like
the following
++)
{
bool b = opIndex(i);
result = dg(b);
if (result)
break;
}
return result;
}
Can one glue both things together into a single routine (using inout
magic or whatever)?
Best regards,
Matthias Walter
On 06/01/2012 07:42 AM, d coder wrote:
Why am I being taken to Digital Daemon when I goto http://dlang.org ?
Seems like the DNS entry points still to the original IP address. That's
all I could find out.
Where can I find official D language site now?
http://erdani.com/d/web/index.html exists
On 2012-05-19 09:05, Philippe Sigaud wrote:
On Fri, May 18, 2012 at 11:51 PM, Simen Kjaeraas simen.kja...@gmail.com
wrote:
Because Wrapper!(AliasStruct).Wrap does not exist. And _error_ is not
equal to any other type.
Yes. Wrap is included in the complete template name (Wrapper!(Wrap))
On 2012-05-19 15:28, Philippe Sigaud wrote:
On Sat, May 19, 2012 at 12:23 PM, Matthias Walter
xa...@xammy.homelinux.net wrote:
I would open a bug report with the following code which is a bit smaller
than my first wrong version:
=
(...)
pragma(msg, typeof
Hi,
how do I test two types for equality? Suppose I have A and B aliasing
some type(s), how do I find out if they are aliases the same thing?
I tried the is(A == B) expression, but this does not always work (tell
me if I shall give an example).
On the other hand, according to the spec the
On 2012-05-18 16:12, Steven Schveighoffer wrote:
On Fri, 18 May 2012 06:06:45 -0400, Matthias Walter wrote:
how do I test two types for equality? Suppose I have A and B aliasing
some type(s), how do I find out if they are aliases the same thing?
I tried the is(A == B) expression
On 03/19/2012 08:21 PM, Andrej Mitrovic wrote:
On 3/19/12, Matthias Walter xa...@xammy.homelinux.net wrote:
Hi,
I've written a small module (at the moment called utils.keywordargs)
which simulates keyword arguments (aka named parameters).
Cool. A small tip (in case you didn't already know
On 03/19/2012 07:53 PM, bearophile wrote:
Matthias Walter:
I've written a small module (at the moment called utils.keywordargs)
which simulates keyword arguments (aka named parameters). The
documentation can be found here,
Regardless the implementation quality of your code, I wait
Hi,
I've written a small module (at the moment called utils.keywordargs)
which simulates keyword arguments (aka named parameters). The
documentation can be found here,
http://xammy.xammy.homelinux.net/~xammy/utils_keywordargs.html
while the code is at
Hi,
I wanted to have a binary heap where I can update entries and restore
the heap structure.
1. First I observed that due to the implementation of
std.container.BinaryHeap, keeping track of the position of a certain
value in the heap cannot be done directly, but it would be helpful to
pass a
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
named parameters have been discussed awhile ago and it seems to me
that they won't get into the language soon. I came up with a
workaround that makes it possible to use them with some extra typing.
Suppose we have a function
foo(int a, int b,
Hi,
I'd like to have a function foo which shall depend on several
compile-time expressions (e.g. strings) and gets several arguments whose
types are templatized. Here, several means in both cases that the
number of expressions/arguments are to be determined at compile-time.
Here is an example:
Hi,
Recently, I realized that several dup methods in D2's phobos are
declared like the one for BitArray:
@property BitArray dup()
My question is why it is declared without const? Is it a bug or is
there a reason for it? I can think of a case where one only has
implemented a shallow copy and
On 2011-11-27 23:48, mta`chrono wrote:
that's a real good question. it fails with the following error:
Error: function std.bitmanip.BitArray.dup () is not callable using
argument types () const
here is a hack:
---
import std.bitmanip;
import core.stdc.string;
void main()
{
regards,
Matthias Walter
1. Are there any further suggestions on the implementations / Did I
forget something?
Are benchmarks done with BigInt and long too? (If you test bigints you
need bigger numbers too, and to test that the results are correct).
Yeah, so I did tests for long now, too. Unfortunately with gdc I
1. Are there any further suggestions on the implementations / Did I
forget something?
Are benchmarks done with BigInt and long too? (If you test bigints you
need bigger numbers too, and to test that the results are correct).
I'd like to work on the BigInt things but there are a couple of
On 02/07/2011 05:13 PM, Andrei Alexandrescu wrote:
On 2/7/11 3:18 PM, Matthias Walter wrote:
Hi everyone,
as I'm currently working on a C++ project which involves gcd
computations I had a quick look at phobos' implementation.
1. First thing I saw is that gcd(-3,6) raises an exception
Hi everyone,
as I'm currently working on a C++ project which involves gcd
computations I had a quick look at phobos' implementation.
1. First thing I saw is that gcd(-3,6) raises an exception, although
mathematically it is just 2. Of course checking the sign of the
arguments takes computation
On 01/30/2011 01:01 PM, Peter Alexander wrote:
On 30/01/11 5:17 PM, Andrej Mitrovic wrote:
The unittest topic is about to get derailed so I want to continue
this silly discussion here.
Wheres Nick? I want to see the CRT vs LCD discussion heated up again
with Andrei claiming that LCDs are
On 01/29/2011 09:13 AM, Jim wrote:
so Wrote:
I'm a bit troubled with the class/struct dichotomy. I would prefer them
both to use the same keyword. Heap/stack allocation could be specified
during instantiation instead. Why? Now you need to choose one over the
other. Not even C++ has
On 12/20/2010 05:01 PM, Andrei Alexandrescu wrote:
Just saw this:
http://www.reddit.com/r/programming/comments/eoq15/implementing_shortest_path_in_c_is_much_easier/
in which a reader points to this paper on thin heaps:
On 12/16/2010 04:17 AM, Andrei Alexandrescu wrote:
On 12/15/10 10:21 PM, Matthias Walter wrote:
Hi all,
I uploaded [1] a patch for std.container to use BinaryHeap as a priority
queue. For the latter one it is often necessary to change a value (often
called decreaseKey in a MinHeap
On 12/16/2010 10:53 AM, Andrei Alexandrescu wrote:
On 12/16/10 7:55 AM, Matthias Walter wrote:
On 12/16/2010 04:17 AM, Andrei Alexandrescu wrote:
On 12/15/10 10:21 PM, Matthias Walter wrote:
Hi all,
I uploaded [1] a patch for std.container to use BinaryHeap as a
priority
queue
On 12/16/2010 09:36 PM, Craig Black wrote:
It was brought to my attention that the quick sort has a very bad
worst case, so I implemented a simple fix for it. Now the worst case
(completely ordered) is the best case, and it only slows down the
general case by a small percentage. I thought to
Hi all,
I uploaded [1] a patch for std.container to use BinaryHeap as a priority
queue. For the latter one it is often necessary to change a value (often
called decreaseKey in a MinHeap). For example, Dijkstra's shortest path
algorithm would need such a method. My implementation expects that the
Hi all,
suppose I have an array of comparable Foo structs which I want to access
in a sorted order (e.g. a priority queue) using a BinaryHeap object (I
know that for just sorting, the BinHeap is not the right tools), but I
do not want to change the order of the objects in the original array.
I
On 12/12/2010 06:15 AM, Dmitry Olshansky wrote:
On 12.12.2010 7:25, Matthias Walter wrote:
Hi all,
there was a discussion in 2006 but w/o a result, and I didn't find any
bugs about implicitely casting functions to delegates. It seems to be
impossible as long as function-pointer calls work
On 12/12/2010 02:04 AM, Christopher Nicholson-Sauls wrote:
On 12/11/10 22:41, Matthias Walter wrote:
Hi all,
I wrote a ByToken tokenizer that models Range, i.e. it can be used in a
foreach loop to read from a std.stdio.File. For it to work one has to
supply it with a delegate, taking
Hi all,
there was a discussion in 2006 but w/o a result, and I didn't find any
bugs about implicitely casting functions to delegates. It seems to be
impossible as long as function-pointer calls work differently than
delegate calls in the ABI. Will this at some point be fixed?
If not, is there a
Hi all,
I wrote a ByToken tokenizer that models Range, i.e. it can be used in a
foreach loop to read from a std.stdio.File. For it to work one has to
supply it with a delegate, taking a current buffer and a controller
class instance. It is called to extract a token from the unprocessed
part of
On 12/11/2010 01:00 AM, Christopher Nicholson-Sauls wrote:
On 12/10/10 22:36, Matthias Walter wrote:
On 12/10/2010 09:57 PM, Matthias Walter wrote:
Hi all,
I currently work on a parser for some file format. I wanted to use the
std.stdio.ByChunk Range to read from a file and extract tokens
The only thing I've been able to think of is
byte[][] a;
a.length = size;
for (int i; i size; i++) {
a[i].length = size;
}
Well, you can do at least:
auto a = new byte[][size];
foreach (ref row; a)
row = new byte[size];
Matthias
On 11/27/2010 02:05 PM, bearophile wrote:
Reduced case for bugzilla:
http://d.puremagic.com/issues/show_bug.cgi?id=5281
I investigated into the bug and the reason is the signature of opEquals,
which currently is
bool opEquals(Tdummy=void)(ref const BigInt y) const
bool opEquals(T:
On 11/27/2010 12:54 PM, Ellery Newcomer wrote:
Hello.
Today I've been thinking about calculating the range of values for
x % y
You might want to state the problem more precisely. What exactly is a
range of values x % y ? Do you look at the result for x,y in some
sets? Or is either x or y
On 11/23/2010 12:12 AM, Jonathan M Davis wrote:
On Monday 22 November 2010 21:03:27 Walter Bright wrote:
Matthias Walter wrote:
What about adding a compiler switch that one can turn on and that warns
on obviously wrong names? Is this realistic? At least to check the usage
On 11/22/2010 06:21 PM, JimBob wrote:
bearophile bearophileh...@lycos.com wrote in message
news:icdnn4$2cn...@digitalmars.com...
I have four or five times tried to explain why coding standards are
important for the
development of the D community
And them there stupid people just
On 11/21/2010 04:33 PM, Don wrote:
Matthias Walter wrote:
as it seems, the current version of BigInt is not capable of const, i.e.
BigInt(1) + const(BigInt)(1) does not work.
Is there already an effort to fix this or would it make sense if I had
taken some time to create a fix for it? I have
Hi all,
as it seems, the current version of BigInt is not capable of const, i.e.
BigInt(1) + const(BigInt)(1) does not work.
Is there already an effort to fix this or would it make sense if I had
taken some time to create a fix for it? I have no idea of all the asm in
the x86 specialization but
Hi,
I'm currently using DMD v2.049 with phobos. I found an old discussion
about how toString should be designed and how it is supposed to work. As
the following code does not print out the number, I wonder what is the
current status of how to implement a toString function for a struct/class:
|
On 06/28/2010 05:32 AM, Simen kjaeraas wrote:
Matthias Walter xa...@xammy.homelinux.net wrote:
Can I handle this in another way (like making the template a conditional
one)?
Template constraints[1] sounds like what you want.
Basically, you want the following:
== Module a ==
| module
On 06/28/2010 09:49 AM, Justin Spahr-Summers wrote:
On Sun, 27 Jun 2010 18:51:35 +0200, Matthias Walter
xa...@xammy.homelinux.net wrote:
Hi list,
I tried to write a traits class comparable to iterator_traits in C++ STL
or graph_traits in Boost Graph Library in D 2.0, but failed to do so
;
| }
The error message is:
bug.d(8): Error: template instance ambiguous template declaration
b.Base(T : T*) and a.Base(T)
Can I handle this in another way (like making the template a conditional
one)?
best regards
Matthias Walter
67 matches
Mail list logo