Re: How to partially forward properties of struct array member to struct (disable length property) ?

2015-09-08 Thread Kenji Hara via Digitalmars-d-learn
On Sunday, 6 September 2015 at 10:12:58 UTC, ParticlePeter wrote: In the end all that I want is "just" to disable access to array.length through vector and alias this array. struct Vec(T, size_t n = 3) { T[n] data; alias data this; @disable @property size_t length() const; }

Re: Cannot use the same template arguments on function as the ones on struct

2015-02-12 Thread Kenji Hara via Digitalmars-d-learn
On Wednesday, 11 February 2015 at 22:24:53 UTC, anonymous wrote: On Wednesday, 11 February 2015 at 22:14:44 UTC, MrSmith wrote: http://dpaste.dzfl.pl/5f1d5d5d9e19 Instead I need to use template constraint which is less compact. http://dpaste.dzfl.pl/571ae84d783e Why such behavior happens?

Re: class is forward referenced when looking for 'v'

2015-01-30 Thread Kenji Hara via Digitalmars-d-learn
On Friday, 30 January 2015 at 00:09:17 UTC, Amber Thralll wrote: And the errors dmd returns: test.d(16): Error: class test.A!int.A is forward referenced when looking for 'v' test.d(16): Error: class test.A!int.A is forward referenced when looking for 'opDot' test.d(16): Error: class

Re: Segfault upon modifying immutable AA in static this

2015-01-24 Thread Kenji Hara via Digitalmars-d-learn
On Saturday, 24 January 2015 at 13:29:36 UTC, Nordlöw wrote: The issue originates from module level intialization of static immutable AAs at https://github.com/nordlow/justd/blob/master/conv_ex.d Do I have to change the initialization of the AAs to be explicitly inline at definition of the

Re: Initialization of structure field w/o default ctor

2015-01-22 Thread Kenji Hara via Digitalmars-d-learn
On Thursday, 22 January 2015 at 12:45:53 UTC, drug wrote: On 22.01.2015 15:30, bearophile wrote: drug: Also can I avoid dummy non-default ctor for Bar? One solution: struct Foo { int foo; @disable this(); this(int foo_) pure nothrow @safe @nogc { this.foo = foo_;

Re: Redirect to different overloads at compile time?

2014-06-29 Thread Kenji Hara via Digitalmars-d-learn
On Monday, 30 June 2014 at 02:24:10 UTC, David Bregman wrote: Suppose I have a C library which implements a function for several types. C doesn't have overloading, so their names will be distinct. extern(C): double foo_double(double); float foo_float(float); Now I want to build a D wrapper,

Re: Don't Understand why Phobos Auto-Tester fails for PR #3606

2014-06-07 Thread Kenji Hara via Digitalmars-d-learn
On Saturday, 7 June 2014 at 08:56:38 UTC, Nordlöw wrote: My recent https://github.com/D-Programming-Language/dmd/pull/3606 fails in all the Auto-Testers but I don't understand why. Running make unittest locally in phobos using my locally built branch of dmd passes all tests. Please help!