Hi, I'm unfortunately in D this construction is not possible to
define:
class A(T){
abstract void method(S)(T arg1,S arg2);
}
As adding S to function declaration makes it not virtual.
But we can add this kind of functionality using mixin templates
mixin template BaseMix(T,S){
abstract
Hi, i want to join two or more tupples in to one, with mixing the
indexes like roundRobin but in compile time.
unittest{
import std.meta;
alias first=AliasSeq!(int, string,bool);
alias second=AliasSeq!("abc","def","ghi");
alias third=...
static assert(third==AliasSeq!(int, "abc", string,
On Wednesday, 23 March 2016 at 19:18:50 UTC, Chris Wright wrote:
Consider the `coerce` method:
http://dpldocs.info/experimental-docs/std.variant.VariantN.coerce.html
Example:
import std.variant;
class A {}
class B : A {}
void main()
{
A b = new B;
auto bb = Variant(b).coerce!B;
On Wednesday, 23 March 2016 at 12:52:24 UTC, Adam D. Ruppe wrote:
On Wednesday, 23 March 2016 at 08:01:36 UTC, Voitech wrote:
Hi Variant stores variant.type as not the "highest" in
hierarchy.
Yeah, it stores the static type. You can use it to get that
then do a normal dynamic cast to test
Hi Variant stores variant.type as not the "highest" in hierarchy.
Like this
A a= new A;
A b = new B; //B:A
Variant bVar=Variant(b);
bVar.type will be typeid(A) not typeid(B). Is this intentional ?
If so is there a way to get "concrete" type of "b" variable like
when passing to template
How to handle this situation:
module typeTest;
class A{
void a(){}
}
class B:A{
int b(){
return 1;
}
}
class C:B,D{
string c(){
return "";
}
override int d() {
return 0;
}
}
On Sunday, 13 March 2016 at 01:08:29 UTC, Mike Parker wrote:
On Sunday, 13 March 2016 at 01:06:33 UTC, Mike Parker wrote:
it. Assuming both files live in the same directory, they can
be compiled with this command:
Somehow I deleted that line:
dmd main.d something.d
Wow. Thank You very
At beginning I want to say that I'm Java devloper so most of
linking, joining, dependent classes, libs could be solve with
simple 3 click in eclipse so please be patient with me :).
I'm using Mono-D under Ubuntu 14.04 to create my project it would
be a library for further development process,
On Thursday, 25 February 2016 at 14:29:30 UTC, Nicholas Wilson
wrote:
On Thursday, 25 February 2016 at 13:16:43 UTC, Voitech wrote:
Hi, I have some code processing functions definition in
compile time, I want to override
them in some other class but not explicitly so created this
code:
Hi, I have some code processing functions definition in compile
time, I want to override
them in some other class but not explicitly so created this code:
template MixinFunction(alias attributes,alias returnType,alias
name,alias parameters,alias bodyy){
enum string MixinFunction =
Hi, I'm trying to create a proxy with automatic method generation
. Let say i hava Service object which can be Local service and
Remote service. f.e:
interface Service{
string serviceInfo();
}
interface LocalService:Service{
int doSmth(string param);
}
class
On Wednesday, 10 February 2016 at 20:53:15 UTC, ZombineDev wrote:
On Wednesday, 10 February 2016 at 10:31:34 UTC, Voitech wrote:
Hi, why this is not working ?
class Base{
int a;
}
class BaseTemplate(E):Base{
E value;
this(E value){
this.value=value;
Hi, why this is not working ?
class Base{
int a;
}
class BaseTemplate(E):Base{
E value;
this(E value){
this.value=value;
}
}
class Concrete:BaseTemplate!int{
this(int value){
super(value);
}
}
unittest{
On Monday, 8 February 2016 at 15:09:30 UTC, Kagamin wrote:
http://dpaste.dzfl.pl/1f25ac34c1ee
You need Tuple, not Algebraic. Algebraic stores only one value
of one type from a set, like Variant.
Thank you for answering. You right if i would want to store all
types of T.. in an Inner
On Monday, 8 February 2016 at 07:08:58 UTC, Voitech wrote:
On Saturday, 6 February 2016 at 23:35:17 UTC, Ali Çehreli wrote:
On 02/06/2016 10:05 AM, Voitech wrote:
> [...]
You can use string mixins (makeCtor and makeCtors):
string makeCtor(T)() {
import std.string : format;
[...]
Thank
On Saturday, 6 February 2016 at 23:35:17 UTC, Ali Çehreli wrote:
On 02/06/2016 10:05 AM, Voitech wrote:
> [...]
You can use string mixins (makeCtor and makeCtors):
string makeCtor(T)() {
import std.string : format;
[...]
Thank you very much for answering.
Cheers
On Saturday, 6 February 2016 at 18:05:05 UTC, Voitech wrote:
Hi, i have a variadic args template, with a class inside
something like:
template foo(T...){
class Inner(){
...
...
}
}
Now i want to make Inner create or i will create manually,
constructor for each of T... parameter types,
Hi, i have a variadic args template, with a class inside
something like:
template foo(T...){
class Inner(){
...
...
}
}
Now i want to make Inner create or i will create manually,
constructor for each of T... parameter types, but don't know what
is syntax for it. I found that there is
On Tuesday, 2 February 2016 at 13:52:55 UTC, Marc Schütz wrote:
On Tuesday, 2 February 2016 at 13:20:33 UTC, Voitech wrote:
[...]
Two possible solutions... If you don't need to know the number
of arguments at compile time, you can use normal variadic
arguments:
[...]
Thank you I'll try
Hi, Is it possible to bound T... in template with some type ? For
single Parameter declaration it can be done by T:SomeType but
variadics does not seems to have that possibility ?
Cheers
Hello, I'm having problem with converting from Java style coding
to D, probably doing wrong something. I want to have a map
(associative array) which will return specific object depending
on provided key. Key is a type of other object. Let say i want to
hold single instances of some kind of
On Saturday, 23 January 2016 at 13:19:34 UTC, anonymous wrote:
On 23.01.2016 12:30, Voitech wrote:
Ok so i want to hold different types in LogicRule maybe
Algebraic
implementation would do?
private alias ControllTemplate(T) =Rule!(T,ControllFlag);
private alias SymbolRule
Hi, I have a problem with creating proper inheritance chain with
templates. First i will give some background about my problem.
I'm trying to create a validator for math calculation
expressions. I don't want to use regexps as this is approach
gives me headache and probably will not allow
Hi. I'm trying to parse an simple string expression to something
like Element array. Each Element can have a value of unknown
type, which will be further combined and calculated to let say
real/double/float value, no mather.
In Java i had something like generics and this could be
implemented
On Monday, 18 January 2016 at 21:15:51 UTC, Chris Wright wrote:
On Mon, 18 Jan 2016 19:19:22 +, Voitech wrote:
Hi. I'm trying to parse an simple string expression to
something like Element array. Each Element can have a value of
unknown type, which will be further combined and calculated
Hello, i am new to D language and trying to learn it by coding.
I compile my programs on Xubuntu 14.04 with DMD64 D Compiler
v2.069.2.
So i have a struct/union which contains two fields representing
real and string values:
public union Element
{
private real _value;
private
On Wednesday, 6 January 2016 at 12:25:31 UTC, Nicholas Wilson
wrote:
Probably because you are accessing uninitialised memory. the
values 4,5,9 appear in the first unittest and are left on the
stack. Unions ,unlike structs, do not initialise their fields
because it does not make sense to do so
27 matches
Mail list logo