On Tuesday, 7 May 2013 at 00:15:06 UTC, Luís Marques wrote:
On Monday, 6 May 2013 at 23:53:51 UTC, Idan Arye wrote:
If the type handlers are your own classes, then you can let
them check it. Have a method in the handlers that check if an
object can be handled by that handler, and use it on
template Test(alias N)
if (isIntegral!(typeof(N)))
{
struct S
{
typeof(N) n = N;
auto opAdd(T)(T rhs)
{
//Error: argument S to typeof is not an expression
pragma(msg, typeof(T));
//Error: variable rhs cannot be read at compile
On Tuesday, 7 May 2013 at 06:41:25 UTC, Meta wrote:
template Test(alias N)
if (isIntegral!(typeof(N)))
{
struct S
{
typeof(N) n = N;
auto opAdd(T)(T rhs)
{
//Error: argument S to typeof is not an expression
pragma(msg, typeof(T));
Sorry for my english.
Hello,
I am new to D. According to that power of 2 rule I want to
reserve 2 sized chunks to my array, But how do I do that in a
struct? Say:
struct Stack(int){
int a[];
}
Where do I put that a.reserve(2);
Because right after the declaration of a I get an error
Error: unexpected ( in
On Tuesday, 7 May 2013 at 06:41:25 UTC, Meta wrote:
I don't really understand why either of these error messages
are occurring. The first is just incomprehensible, and the
second seems like it should work. In this case, rhs is fully
accessible at compile time in the expression (a + b), so why
On Tuesday, 7 May 2013 at 10:29:44 UTC, Namal wrote:
Hello,
I am new to D. According to that power of 2 rule I want to
reserve 2 sized chunks to my array, But how do I do that in a
struct? Say:
struct Stack(int){
int a[];
}
2 sized chunks?
Perhaps you want something like this:
struct
On 2013-05-07 08:41, Meta wrote:
template Test(alias N)
if (isIntegral!(typeof(N)))
{
struct S
{
typeof(N) n = N;
auto opAdd(T)(T rhs)
{
//Error: argument S to typeof is not an expression
pragma(msg, typeof(T));
On Tuesday, 7 May 2013 at 11:03:31 UTC, Jacob Carlborg wrote:
As a workaround for typeof you can use this:
https://github.com/jacob-carlborg/orange/blob/master/orange/util/Traits.d#L213
You may want to update your implementation:
http://dpaste.1azy.net/640a2580
On Tuesday, 7 May 2013 at 10:58:42 UTC, John Colvin wrote:
...
int a[];
please don't use C style declarations, D style is type followed
by id:
int[] a;
On Tue, 07 May 2013 06:29:43 -0400, Namal soti...@mail.ru wrote:
Hello,
I am new to D. According to that power of 2 rule I want to
reserve 2 sized chunks to my array, But how do I do that in a
struct? Say:
struct Stack(int){
int a[];
}
Where do I put that a.reserve(2);
Because right
On Tuesday, 7 May 2013 at 10:29:44 UTC, Namal wrote:
Hello,
I am new to D. According to that power of 2 rule I want to
reserve 2 sized chunks to my array, But how do I do that in a
struct?
You can set some kind of statically allocated array size:
struct S
{
int[] a;
On Tue, 07 May 2013 00:03:58 +0100, Sean Kelly s...@invisibleduck.org
wrote:
On May 2, 2013, at 6:17 AM, Regan Heath re...@netmail.co.nz wrote:
On Wed, 01 May 2013 01:12:39 +0100, Sean Kelly s...@invisibleduck.org
wrote:
On Apr 23, 2013, at 2:21 PM, Jack Applegame jappleg...@gmail.com
Version D 2.062
class MyClass
{}
struct MyStruct(T)
if (is(T == class))
{
string _message = nothing;
this(T obj)
{
if (obj is null){
_message = Null reference message;
}
else{
On Tuesday, 7 May 2013 at 10:33:58 UTC, Dicebot wrote:
On Tuesday, 7 May 2013 at 06:41:25 UTC, Meta wrote:
I don't really understand why either of these error messages
are occurring. The first is just incomprehensible, and the
second seems like it should work. In this case, rhs is fully
On Tue, 07 May 2013 10:58:09 -0400, ref2401 refacto...@gmail.com wrote:
Version D 2.062
class MyClass
{}
struct MyStruct(T)
if (is(T == class))
{
string _message = nothing;
this(T obj)
{
if (obj is null){
_message = Null
i'm using VisualD.
this assertion fails assert(msg == Null reference message);
in my actual code instead of variable _message an exception is
thrown if (obj is null) == true.
i'm using the unittest block to test exception throwing.
...
this(T obj)
{
if (obj is
You could allocate space inside a class itself with something
like this:
class Base {
int[] slice;
}
template Derived(size_t N) {
class Derived : Base {
int[N] array;
this() {
slice = array;
}
}
}
Base b = new Derived!32();
A bit pointless
On 2013-05-07 13:08, Dicebot wrote:
You may want to update your implementation: http://dpaste.1azy.net/640a2580
Thanks.
--
/Jacob Carlborg
Hi
I'm running Windows Vista 64 with dmd 2.062.
I have a simple program:
import std.stdio, core.memory, std.cstream;
void main()
{
string[] temp_array;
for(int i=0;i500;i++)
{
++temp_array.length;
temp_array[temp_array.length - 1] =
On 05/07/2013 04:09 PM, Matic Kukovec wrote: Hi
When the program waits at din.getc();, memory usage in the Task
Manager is 150MB.
Why isn't the memory deallocating?
P.S.;
I tried temp_array.clear() and destroy(temp_array), but nothing changed.
GC.minimize() may work.
Ali
On Tuesday, 7 May 2013 at 23:14:20 UTC, Ali Çehreli wrote:
On 05/07/2013 04:09 PM, Matic Kukovec wrote: Hi
When the program waits at din.getc();, memory usage in the
Task
Manager is 150MB.
Why isn't the memory deallocating?
P.S.;
I tried temp_array.clear() and destroy(temp_array), but
On 05/07/2013 04:18 PM, Matic Kukovec wrote:
On Tuesday, 7 May 2013 at 23:14:20 UTC, Ali Çehreli wrote:
GC.minimize() may work.
Tried it, no changes.
Works for your test program under Linux but as the documentation says,
it is not guaranteed to have any effect at all.
Ali
On Tuesday, 7 May 2013 at 23:31:41 UTC, Ali Çehreli wrote:
On 05/07/2013 04:18 PM, Matic Kukovec wrote:
On Tuesday, 7 May 2013 at 23:14:20 UTC, Ali Çehreli wrote:
GC.minimize() may work.
Tried it, no changes.
Works for your test program under Linux but as the
documentation says, it is not
On 05/07/2013 04:42 PM, Matic Kukovec wrote:
On Tuesday, 7 May 2013 at 23:31:41 UTC, Ali Çehreli wrote:
On 05/07/2013 04:18 PM, Matic Kukovec wrote:
On Tuesday, 7 May 2013 at 23:14:20 UTC, Ali Çehreli wrote:
GC.minimize() may work.
Tried it, no changes.
Works for your test program
Matic Kukovec:
The system is Windows Vista 64bit. DMD is 2.062.
DMD doesn't yet produce 64 bit binaries on Windows.
I have tried to solve your problem using GC.free, but I am not
seeing good results...
Bye,
bearophile
Why isn't the memory deallocating?
The memory might be free, but still not released to the OS.
Especially in windows, when you free memory it still isn't freed
from
your process.
But you can reuse it in your program if the GC has collected it.
The correct test would be to copy and paste
I found this problem with a program that reads a large xml file
(25+ lines), then stores the lines in a string[], does a
comparison with another array and finally clears the original
array.
On the second or third file I always get an OutOfMemoryError,
when the Task Manager shows about
On Tue, 07 May 2013 19:09:28 -0400, Matic Kukovec
matic.kuko...@pametnidom.si wrote:
Hi
I'm running Windows Vista 64 with dmd 2.062.
I have a simple program:
import std.stdio, core.memory, std.cstream;
void main()
{
string[] temp_array;
for(int i=0;i500;i++)
{
29 matches
Mail list logo