On Saturday, 22 November 2014 at 02:37:21 UTC, Eric wrote:
I know I can make a class immutable, but the problem is I want
to constrain a template parameter to only immutable types,
and I want to use class types.
template Foo(T : immutable Object)
Accepts immutable(Object) and other immutable
On Monday, 17 November 2014 at 21:12:54 UTC, Steven Schveighoffer
wrote:
On 11/14/14 6:29 PM, Satoshi wrote:
Hi, Im using GDC 4.9.0 compiler. I have template classes like
public
class LinkedList(T) {...} and when I try compile it together,
everything works fine. But when I compile every source
On Saturday, 22 November 2014 at 09:57:55 UTC, anonymous wrote:
On Saturday, 22 November 2014 at 02:37:21 UTC, Eric wrote:
I know I can make a class immutable, but the problem is I want
to constrain a template parameter to only immutable types,
and I want to use class types.
template Foo(T :
I tried to pass pointer to static array but it didn't work.
On Sat, 22 Nov 2014 18:20:44 +0400
drug via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
I tried to pass pointer to static array but it didn't work.
i tried it right now and it works.
if you really want to get some help, you'd better give us something to
start with. i.e. your
On Saturday, 22 November 2014 at 15:20:55 UTC, drug wrote:
I tried to pass pointer to static array but it didn't work.
try this:
import std.stdio;
void change(ref int[3] arr)
{
arr[1] = 6;
}
void main()
{
int[3] a = [1, 2, 3];
writeln(a = , a);
change(a);
writeln(a = ,
On Saturday, 22 November 2014 at 15:20:55 UTC, drug wrote:
I tried to pass pointer to static array but it didn't work.
Also, if you really want to be lame and actually use a pointer
try this:
import std.stdio;
void change(int *arr)
{
arr[1] = 6;
}
void main()
{
int[3] a = [1, 2, 3];
On Sat, 22 Nov 2014 15:45:51 +
Eric via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
Maybe this is not so lame because change() can take
any length of static array.
void change (int[] arr) {
arr[1] = 42;
}
void main () {
int[$] a = [1, 2, 3];
change(a);
On Sat, Nov 22, 2014 at 05:57:30PM +0200, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 15:45:51 +
Eric via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
Maybe this is not so lame because change() can take
any length of static array.
void change (int[]
On Saturday, 22 November 2014 at 15:57:40 UTC, ketmar via
Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 15:45:51 +
Eric via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
Maybe this is not so lame because change() can take
any length of static array.
void change (int[]
On 22.11.2014 19:34, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 18:20:44 +0400
drug via Digitalmars-d-learndigitalmars-d-learn@puremagic.com wrote:
I tried to pass pointer to static array but it didn't work.
i tried it right now and it works.
if you really want to get some
On Saturday, 22 November 2014 at 16:07:25 UTC, drug wrote:
On 22.11.2014 19:34, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 18:20:44 +0400
drug via
Digitalmars-d-learndigitalmars-d-learn@puremagic.com wrote:
I tried to pass pointer to static array but it didn't work.
i tried
On 11/22/2014 07:07 AM, drug wrote:
On 22.11.2014 19:34, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 18:20:44 +0400
drug via Digitalmars-d-learndigitalmars-d-learn@puremagic.com wrote:
I tried to pass pointer to static array but it didn't work.
i tried it right now and it
On Sat, 22 Nov 2014 08:07:31 -0800
H. S. Teoh via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
On Sat, Nov 22, 2014 at 05:57:30PM +0200, ketmar via Digitalmars-d-learn
wrote:
On Sat, 22 Nov 2014 15:45:51 +
Eric via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
On 22.11.2014 20:26, Ali Çehreli wrote:
On 11/22/2014 07:07 AM, drug wrote:
On 22.11.2014 19:34, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 18:20:44 +0400
drug via Digitalmars-d-learndigitalmars-d-learn@puremagic.com wrote:
I tried to pass pointer to static array but it
On 22.11.2014 20:26, Eric wrote:
On Saturday, 22 November 2014 at 16:07:25 UTC, drug wrote:
On 22.11.2014 19:34, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 18:20:44 +0400
drug via Digitalmars-d-learndigitalmars-d-learn@puremagic.com wrote:
I tried to pass pointer to static
On 22.11.2014 20:30, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 08:07:31 -0800
H. S. Teoh via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
On Sat, Nov 22, 2014 at 05:57:30PM +0200, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 15:45:51 +
Eric
On Saturday, 22 November 2014 at 15:00:00 UTC, Eric wrote:
Yes, but if I don't declare the class T as immutable, I don't
think this constraint will work.
You're mistaken. It works just fine.
class X /* not immutable */
{
private int x;
this(int x) pure { this.x = x; }
}
template
On Sat, 22 Nov 2014 20:05:13 +0400
drug via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
Does it worth to make some compiler option that for example prohibits
passing static array instead of dynamic one without slicing? Who has a
lot of breakable correct D code doesn't use
On 22.11.2014 21:22, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 20:05:13 +0400
drug via Digitalmars-d-learndigitalmars-d-learn@puremagic.com wrote:
Does it worth to make some compiler option that for example prohibits
passing static array instead of dynamic one without slicing?
On Saturday, 22 November 2014 at 17:06:29 UTC, anonymous wrote:
On Saturday, 22 November 2014 at 15:00:00 UTC, Eric wrote:
Yes, but if I don't declare the class T as immutable, I don't
think this constraint will work.
You're mistaken. It works just fine.
class X /* not immutable */
{
On Saturday, 22 November 2014 at 17:40:42 UTC, Eric wrote:
Yes, but this is what I really want:
class X(T : immutable Object)
{
private T x;
this(T x) pure { this.x = x; }
}
class Y
{
private int x;
this(int x) pure { this.x = x; }
}
void main()
{
immutable(Y) y = new
Hello, I would like to write a popcnt function. This works fine
ulong popcnt(ulong x)
{
asm { mov RAX, x ; popcnt RAX, RAX ; }
}
However, if I add the naked keyword ( which should improve
performance? ) it doesn't work anymore and I can't figure out
what change I am supposed to make ( aside
On Friday, 21 November 2014 at 01:23:55 UTC, Mike Parker wrote:
On 11/21/2014 10:22 AM, Mike Parker wrote:
You are adding anything
You /aren't/
The problem is 'no available video device' when trying to init
SDL. I've recently wiped/re-installed this machine so something
must be missing.
But I'm not sure if maybe I changed to much about it.
My point is, that I think it's generally a good idea to be
flexible when possible, and not make (im)mutability demands
unless actually necessary.
You may know the following, but I feel like there may be some
confusion about it: Note that
// Two simple value type structures. one embedded in the other.
I've stepped through the debugger and I see the embedded
structure being set to 2, and dog.
import std.stdio;
struct NestedBottom
{
int i;
char[3] fixedArray;
// this(){} no-argument ctor can only be defined by
On Saturday, 22 November 2014 at 18:30:06 UTC, Ad wrote:
Hello, I would like to write a popcnt function. This works
fine
ulong popcnt(ulong x)
{
asm { mov RAX, x ; popcnt RAX, RAX ; }
}
However, if I add the naked keyword ( which should improve
performance? ) it doesn't work anymore and I
On Saturday, 22 November 2014 at 20:57:07 UTC, WhatMeWorry wrote:
auto bottom = NestedBottom(2, ['d','o','g']);
That 'auto' is the problem. You want 'this.bottom = ...' instead.
On Sat, 22 Nov 2014 20:57:05 +
WhatMeWorry via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
auto bottom = NestedBottom(2, ['d','o','g']);
ah, that good old thingy! there were some debates about locals that
shadows fields and how that can introduce some hard-to-catch
On Sat, Nov 22, 2014 at 11:54:01PM +0200, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 20:57:05 +
WhatMeWorry via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
auto bottom = NestedBottom(2, ['d','o','g']);
ah, that good old thingy! there were some
On Saturday, November 22, 2014 14:59:58 Eric via Digitalmars-d-learn wrote:
On Saturday, 22 November 2014 at 09:57:55 UTC, anonymous wrote:
On Saturday, 22 November 2014 at 02:37:21 UTC, Eric wrote:
I know I can make a class immutable, but the problem is I want
to constrain a template
On 11/23/2014 3:52 AM, Paul wrote:
Whenever I try to learn a new language I always seem to end up fighting
the OS or the IDE rather than spending time where I should. Therefore,
I'm going to put this idea on hold and stick to console programs for a
while (tried to install ncurses as well
Am Sat, 22 Nov 2014 18:30:05 +
schrieb Ad a...@fakmail.fg:
Hello, I would like to write a popcnt function. This works fine
ulong popcnt(ulong x)
{
asm { mov RAX, x ; popcnt RAX, RAX ; }
}
However, if I add the naked keyword ( which should improve
performance? ) it doesn't work
33 matches
Mail list logo