I want a module level initialised delegate. if I try
module foo;
enum Status
{
success,
}
class StatusException : Exception
{
Status s;
// usual exception constructors
}
void delegate(Status) onError = (Status s) { throw new
StatusException(s);};
I get a error like cannot initi
As far as I can tell, this code should compile:
class B { int a; }
class D1 : B { int b; }
class D2 : D1 { int c; }
template TupleOf(Classes...)
{
static if(Classes.length > 1)
alias TupleOf = AliasSeq!(Classes[0].tupleof,
TupleOf!(Classes[1..$]));
else static if(Classes
On Friday, 29 September 2017 at 19:31:14 UTC, Joseph wrote:
I am trying to have a multi-dimensional array and opIndex has
to have both an arbitrary number of parameters and allow for
slicing.
You may want to look into ndslice package source code [1] --Ilya
[1]
https://github.com/libmir/mir-a
On Saturday, 30 September 2017 at 01:02:08 UTC, Elronnd wrote:
dmd bla.d bla2.d -shared -fPIC -oflibbla.so
Thanks. I don't normally compile right into a .so, but I think
this is OK:
dmd my_file.o my_other_file.o -shared -of=libutest.so
One thing I picked up from SCons is creating dynami
dmd bla.d bla2.d -shared -fPIC -oflibbla.so
I would like to know that command line (I am on Linux) I would
use to compile a D file and create an object file that is
suitable for a Linux dynamic library (.so).
I believe it is probably
dmd -c -fPIC my_file.d
Also, what is the command line to create a dynamic library from
one or more obj
On Friday, 29 September 2017 at 02:34:08 UTC, DreadKyller wrote:
On Thursday, 28 September 2017 at 14:01:33 UTC, user1234 wrote:
[...]
I understand that, but because the operator isn't defined
normally for classes unless overloaded, then your statement
about this being an inconsistency on th
Have there been any investigations into using region-based memory
management (aka memory arenas) in D, possibly in conjunction with
GC allocated memory? This would be a very speculative idea, but
it'd be interesting to know if there have been looks at this area.
My own interest is request-resp
Well the purpose of the exercise kind of *is* to write a prime
number generator. You can look up prime number sieves and
algorithms. For REALLY large numbers, that takes an insane
amount of time, and you can instead use algorithms such as the
ones outlined at
https://csrc.nist.gov/csrc/media
Hi,
Does Phobos have an isPrime function? I cannot find it in the
library. I currently have a look at projecteuler.net problem no
7. Such a function makes it a lot easier to solve the problem.
https://projecteuler.net/problem=7
Kind regards
Andre
On Wednesday, 27 September 2017 at 04:08:39 UTC, Joakim wrote:
On Tuesday, 26 September 2017 at 17:48:06 UTC, Andre Pany wrote:
Hi,
I had set up a cross compilation from Windows to Raspberry Pi
using LDC and GCC toolchain. Almost everything is working
fine. Dub creates a binary which is runna
On Fri, Sep 29, 2017 at 07:31:14PM +, Joseph via Digitalmars-d-learn wrote:
> I am trying to have a multi-dimensional array and opIndex has to have
> both an arbitrary number of parameters and allow for slicing.
>
> The problem is if I create opIndex for non-slicing, it looks like
>
> ref aut
On Wednesday, 27 September 2017 at 21:48:35 UTC, timvol wrote:
On Wednesday, 27 September 2017 at 21:44:48 UTC, Ali Çehreli
wrote:
On 09/27/2017 02:39 PM, timvol wrote:
[...]
void main() {
auto mem = new ubyte[1024+15];
auto ptr = cast(ubyte*)(cast(ulong)(mem.ptr + 15) &
~0x0FUL);
I am trying to have a multi-dimensional array and opIndex has to
have both an arbitrary number of parameters and allow for slicing.
The problem is if I create opIndex for non-slicing, it looks like
ref auto opIndex(T...)(T index)
and this one catches all templates. But slices do not return the
On 9/29/17 2:03 PM, Joseph wrote:
static if ()
{
enum x;
}
static if (isDefined!x)
{
}
What's the correct way to check if a variable has been defined? (note x
may or may not be defined above. I need to know if it is)
Check to see that it has a type:
static if(is(typeof(x)))
{
}
-Steve
On 09/29/2017 11:34 AM, Joseph wrote:
Trying to do multi-dimension array but op-dollar doesn't seem to support
arbitrary dimensions
@property int opDollar(size_t dim : k)() { return dims[k]; }
It's called by multi-dimensional opIndex (or opSlice and perhaps
others?; can be very complicate
On Friday, 29 September 2017 at 18:03:52 UTC, Joseph wrote:
static if ()
{
enum x;
}
static if (isDefined!x)
{
}
What's the correct way to check if a variable has been defined?
(note x may or may not be defined above. I need to know if it
is)
import std.traits;
static if(hasMember!(T, "x")
Trying to do multi-dimension array but op-dollar doesn't seem to
support arbitrary dimensions
@property int opDollar(size_t dim : k)() { return dims[k]; }
static if ()
{
enum x;
}
static if (isDefined!x)
{
}
What's the correct way to check if a variable has been defined?
(note x may or may not be defined above. I need to know if it is)
On Friday, September 29, 2017 14:34:04 aberba via Digitalmars-d-learn wrote:
> On Friday, 29 September 2017 at 03:42:18 UTC, Jonathan M Davis
>
> wrote:
> > On Friday, September 29, 2017 04:32:44 rikki cattermole via
> >
> > Digitalmars-d- learn wrote:
> >> On 29/09/2017 4:25 AM, Joel wrote:
> >> >
On Friday, 29 September 2017 at 03:42:18 UTC, Jonathan M Davis
wrote:
On Friday, September 29, 2017 04:32:44 rikki cattermole via
Digitalmars-d- learn wrote:
On 29/09/2017 4:25 AM, Joel wrote:
> With a given date, I want to know what day it is (like
> Sunday, Monday,
> etc).
>
> I had a look u
21 matches
Mail list logo