On Thursday, 9 March 2017 at 10:35:18 UTC, dummy wrote:
On Wednesday, 8 March 2017 at 10:24:24 UTC, Joakim wrote:
On Tuesday, 7 March 2017 at 12:06:48 UTC, dummy wrote:
Just thought. I do want to know. :-)
As far as I know is,
* LDC2 woring on NDK(yah!)
* Native OpenGLES:
http://wiki.dlan
On Sunday, 12 March 2017 at 21:38:44 UTC, Inquie wrote:
Is there any easy way to create a scope for termination of the
object?
I have a template method that takes a type and allocates and
deallocates based on that type.
class bar
{
void foo(T)()
{
T x;
alloc(x);
scope
What it says on the tin. Is there a way to create interfaces with
a constructor or must I use an abstract class.
Additionally, is there a way to force the linker to link a
function in a class without an implementation with another that
does have an implementation?
i.e.
---
//module a;
On Sunday, 12 March 2017 at 21:12:13 UTC, data pulverizer wrote:
On Sunday, 12 March 2017 at 20:15:43 UTC, Meta wrote:
auto max(T: const U, U)(T* x, T* y) <- Changed `ConstOf!U`
to `const U`
{
writeln("Const template");
return *x > *y ? x : y;
}
How detailed can I be about t
On Monday, 13 March 2017 at 00:02:12 UTC, Inquie wrote:
I just figured it didn't work in general, but seems to be an
issue with appending.
Oh, it is because of the implicit construction thing, see my
answer here to learn more:
http://stackoverflow.com/a/42285015/1457000
You can construct th
On 03/13/2017 01:02 AM, Inquie wrote:
Ok, it doesn't work for appending though ;)
[...]
Tuple!(int, "A", double, "B")[] y;
y ~= tuple(3, 2.5);
Interestingly, this works:
Tuple!(int, "A", double, "B")[] y;
y.length += 1;
y[$ - 1] = tuple(3, 2.5);
On Sunday, 12 March 2017 at 23:55:44 UTC, Adam D. Ruppe wrote:
On Sunday, 12 March 2017 at 23:16:48 UTC, Inquie wrote:
Tuple!(int, "A") x;
x = tuple(3);
fails of course
umm it works for me...
Ok, it doesn't work for appending though ;)
Tuple!(int, "A", double, "B")[] y;
y ~= tuple!("A", "
On Sunday, 12 March 2017 at 23:16:48 UTC, Inquie wrote:
Tuple!(int, "A") x;
x = tuple(3);
fails of course
umm it works for me...
Tuple!(int, "A") x;
x = tuple(3);
fails of course
x = tuple!("A")(3);
Works but specifying the name seems to be redundant. Can we
simplify for the more complex case?
e.g.,
x = tuple!(GetTypleNames!x)(3);
which should then be possible to simplify even further to
x = tuple(3);
or, rather
On Sunday, 12 March 2017 at 22:13:21 UTC, Stefan Koch wrote:
On Sunday, 12 March 2017 at 21:38:44 UTC, Inquie wrote:
Is there any easy way to create a scope for termination of the
object?
[...]
scope(exit)
That is for the function, correct? If I release the resource at
the end of the func
On Sunday, 12 March 2017 at 21:38:44 UTC, Inquie wrote:
Is there any easy way to create a scope for termination of the
object?
[...]
scope(exit)
Is there any easy way to create a scope for termination of the
object?
I have a template method that takes a type and allocates and
deallocates based on that type.
class bar
{
void foo(T)()
{
T x;
alloc(x);
scope(~this) dealloc(x); // hypothetical that wraps the
state
On Sunday, 12 March 2017 at 20:15:43 UTC, Meta wrote:
auto max(T: const U, U)(T* x, T* y) <- Changed `ConstOf!U`
to `const U`
{
writeln("Const template");
return *x > *y ? x : y;
}
How detailed can I be about the template specialisation? From
example in the book "C++ the com
Meta wrote:
On Sunday, 12 March 2017 at 20:22:33 UTC, ketmar wrote:
Meta wrote:
The reason this doesn't work is when you use ConstOf!U, it's not
looking for a `const U`, it's looking for the type `ConstOf!U`. I'm not
sure if this is a bug or not...
no, not a bug. this is the way type decon
On Sunday, 12 March 2017 at 20:22:33 UTC, ketmar wrote:
Meta wrote:
The reason this doesn't work is when you use ConstOf!U, it's
not looking for a `const U`, it's looking for the type
`ConstOf!U`. I'm not sure if this is a bug or not...
no, not a bug. this is the way type deconstruction work
On Sunday, 12 March 2017 at 20:15:43 UTC, Meta wrote:
import std.stdio : writeln;
import std.traits : ConstOf;
auto max(T)(T x, T y)
{
writeln("General template");
return x > y ? x : y;
}
auto max(T: const U, U)(T* x, T* y) <- Changed `ConstOf!U`
to `const U`
{
w
Meta wrote:
The reason this doesn't work is when you use ConstOf!U, it's not looking
for a `const U`, it's looking for the type `ConstOf!U`. I'm not sure if
this is a bug or not...
no, not a bug. this is the way type deconstruction works: it checks if your
type was constructed with a given t
On Sunday, 12 March 2017 at 18:49:22 UTC, data pulverizer wrote:
Hello all,
I am attempting to write templates for differently qualified
types using specialisations. Below is an example for const and
non-const outlining my approach:
``
import std.stdio : writeln;
imp
On Sunday, 12 March 2017 at 17:50:41 UTC, Stefan wrote:
On Sunday, 12 March 2017 at 10:47:35 UTC, Andrey wrote:
Hello, how better to declare properties, for example I have
class:
class Foo {
this(in int x, in int y, Bar bar) {
this.x = x;
this.y = y;
this.bar = bar;
data pulverizer wrote:
I need at least those two implementation for the different cases, a
general "default", and for specified types and type qualifications.
p.s.: if you want that to work with both pointers and non-pointers, you
have to add more constraints, to remove further conflicts.
data pulverizer wrote:
If I change the implementation of the second template to your above
declaration, I get the error:
max.max called with argument types (const(double)*, const(double)*)
matches both:
max.d(34): max.max!(const(double)*).max(const(double)* x,
const(double)* y)
and:
max
On Sunday, 12 March 2017 at 19:32:37 UTC, ketmar wrote:
data pulverizer wrote:
In this case would like to use the ConstOf specialisation
instead of the default implementation for the inputs which are
const.
actually, second template is uninstantiable at all. you want to
do type deconstructi
data pulverizer wrote:
In this case would like to use the ConstOf specialisation instead of the
default implementation for the inputs which are const.
actually, second template is uninstantiable at all. you want to do type
deconstruction at instantiation, and that doesn't work.
i.e. what yo
On Sunday, 12 March 2017 at 18:49:22 UTC, data pulverizer wrote:
Hello all,
I am attempting to write templates for differently qualified
types using specialisations. Below is an example for const and
non-const outlining my approach:
``
import std.stdio : writeln;
imp
Hello all,
I am attempting to write templates for differently qualified
types using specialisations. Below is an example for const and
non-const outlining my approach:
``
import std.stdio : writeln;
import std.traits : ConstOf;
auto max(T)(T x, T y)
{
writeln
On Sunday, 12 March 2017 at 10:47:35 UTC, Andrey wrote:
Hello, how better to declare properties, for example I have
class:
class Foo {
this(in int x, in int y, Bar bar) {
this.x = x;
this.y = y;
this.bar = bar;
}
private:
int x;
int y;
Bar bar;
}
And
Am Sun, 12 Mar 2017 12:09:01 +
schrieb Russel Winder via Digitalmars-d-learn
:
> Hi,
>
> ldc2 has the -unittest --main options to compile a file that has
> unittests and no main so as to create a test executable. What causes
> the same behaviour with gdc?
>
https://github.com/D-Programming-
On Sunday, 12 March 2017 at 11:15:04 UTC, Nicholas Wilson wrote:
You should only declare getters/setters if you need to (or
think you may need to later)
intercept the assignment or acquisition of a variable
(logging, computing on demand)
have a field as externally read only (setter
On Sunday, 12 March 2017 at 11:15:04 UTC, Nicholas Wilson wrote:
On Sunday, 12 March 2017 at 10:47:35 UTC, Andrey wrote:
And I want make access to read x, y and bar. Probably I should
add prefix for private members, that is a question: what
prefix should I use? Now I use prefix p_ (from the wor
On Sunday, 12 March 2017 at 07:58:40 UTC, helxi wrote:
string[string] change(ref string[string] arg_array){
//..
arg_array["first"] = strip(readln());
//..
arg_array["second"] = strip(readln());
//..
return def;
}
Nicholas clarified why your decl
Hi,
ldc2 has the -unittest --main options to compile a file that has
unittests and no main so as to create a test executable. What causes
the same behaviour with gdc?
--
Russel.
=
Dr Russel Winder t: +44 20 7585 220
On Sunday, 12 March 2017 at 10:47:35 UTC, Andrey wrote:
Hello, how better to declare properties, for example I have
class:
class Foo {
this(in int x, in int y, Bar bar) {
this.x = x;
this.y = y;
this.bar = bar;
}
private:
int x;
int y;
Bar bar;
}
And I
Hello, how better to declare properties, for example I have class:
class Foo {
this(in int x, in int y, Bar bar) {
this.x = x;
this.y = y;
this.bar = bar;
}
private:
int x;
int y;
Bar bar;
}
And I want make access to read x, y and bar. Probably I should
On Sunday, 12 March 2017 at 07:58:40 UTC, helxi wrote:
How would an experienced programmer declare an associative
array of strings that has 2 keys?
My initial impression was string[string][2] my_array; which
does not seem to work.
Here is a snippet of the code I am working on:
import std.s
On Sunday, 12 March 2017 at 07:58:40 UTC, helxi wrote:
return def;
I meant
return arg_array;
How would an experienced programmer declare an associative array
of strings that has 2 keys?
My initial impression was string[string][2] my_array; which does
not seem to work.
Here is a snippet of the code I am working on:
import std.string;
import std.stdio;
string[string] change(ref str
36 matches
Mail list logo