On 08/31/2015 08:55 PM, WhatMeWorry wrote:
> Thanks for all the above suggestions, but after many hour of re-reading
> Ali's book on template, structs, and mixins, I still in the woods. I've
> tried two approaches:
>
> Templatetized struct
>
> st
Hi,
I cannot use the definition of SIGRTMIN on ubuntu.
For following code I receive errors:
import core.sys.posix.time, core.sys.posix.signal,
core.sys.posix.stdlib, core.sys.posix.unistd;
import std.stdio;
alias SIG = SIGRTMIN;
void main()
{
writeln("Establishing handler for signal %d\n",
Thanks for all the above suggestions, but after many hour of
re-reading Ali's book on template, structs, and mixins, I still
in the woods. I've tried two approaches:
Templatetized struct
struct Chameleon(T, Purpose p)
{
static if (p == P
On Monday, 31 August 2015 at 21:22:07 UTC, jmh530 wrote:
I'm not sure about how the first local.S resolves things. I had
been using a selective import for S before. To get the local.S
to compile, I have to change the import to a normal one. I'm
concerned about the case where local contains more
On Monday, 31 August 2015 at 22:24:28 UTC, Adam D. Ruppe wrote:
On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist
wrote:
I thought that perhaps spawing a process would work but
Try the browse function from std.process:
http://dlang.org/phobos/std_process.html#browse
What it does i
On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist
wrote:
I thought that perhaps spawing a process would work but
execute("PATH TO HTML
FILE",null,Config.none,size_t.max,dirName(exepath));
Didn't seem to work? any ideas?
Use curl:
void main(string[] args) {
import std.stdio,
On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist
wrote:
I thought that perhaps spawing a process would work but
execute("PATH TO HTML
FILE",null,Config.none,size_t.max,dirName(exepath));
Didn't seem to work? any ideas?
Actually executeShell worked for me thanks for the reference
On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist
wrote:
I thought that perhaps spawing a process would work but
Try the browse function from std.process:
http://dlang.org/phobos/std_process.html#browse
What it does is execute a browser process with the given
argument. I think a f
I thought that perhaps spawing a process would work but
execute("PATH TO HTML
FILE",null,Config.none,size_t.max,dirName(exepath));
Didn't seem to work? any ideas?
On 8/30/15 3:45 PM, Spacen Jasset wrote:
On Sunday, 30 August 2015 at 18:12:40 UTC, BBasile wrote:
On Sunday, 30 August 2015 at 17:02:58 UTC, Spacen Jasset wrote:
[...]
try
---
Vector3 opBinary(string op)(Vector3 rhs)
{
static if (op =="/"){}
else static assert(0, op ~ " not implemen
On Monday, 31 August 2015 at 20:54:53 UTC, Enamex wrote:
You can't use it with foo(S) because the type is used /outside/
the scope of the function, in its head. You have to qualify it
( void foo(local.S s) ) or import the type as:
{ import local: S;
void foo(S s) { ... }
}
I figured t
On Monday, 31 August 2015 at 19:10:45 UTC, jmh530 wrote:
module local;
struct S { int a = 2; }
module app;
import local : S;
void foo(S s)
{
import std.stdio : writeln;
writeln(s.a);
}
void bar()
{
import std.stdio : writeln;
import local : S;
S s;
I've been thinking about scoped imports. While it seems like you
can use scoped imports a lot of the time, it seems like there are
some potential cases where you can't. Most notably if a function
input is a struct or class, then I can't figure out a way to use
a scoped import. This also applies
On Monday, 31 August 2015 at 18:00:54 UTC, Andrew Brown wrote:
Is this correect behaviour?
Yes, the reason is because the nested struct has a hidden member
- a pointer to its stack context. This allows it to access
variables from the surrounding local scope.
It adds 8 bytes on 64 bit cuz th
Thanks very much for all the help, your advice worked a treat.
One final question, originally I was defining the struct inside
the main loop and it was using 4 bytes per field rather than 2
bits, e.g.:
import std.bitmanip;
import std.stdio;
struct Crumb1
{
mixin(bitfields!(
On Monday, 31 August 2015 at 01:56:05 UTC, yawniek wrote:
can someone explain a bit how the @before hooks works in detail,
i mainly have problems understanding why ensureAuth in belows
example refers to
"SampleService." as an instance:
https://github.com/rejectedsoftware/vibe.d/blob/a1efc05c
On Monday, 31 August 2015 at 12:43:25 UTC, drug wrote:
On 31.08.2015 15:28, Andrea Fontana wrote:
On Monday, 31 August 2015 at 11:06:40 UTC, drug wrote:
On 31.08.2015 13:57, Andrea Fontana wrote:
Just create a function that return a string with those three
lines and
mixin it!
Like:
import
On Monday, 31 August 2015 at 13:17:30 UTC, cym13 wrote:
On Monday, 31 August 2015 at 13:00:49 UTC, Namal wrote:
Hey guys, since I am learning D arrays here, can you tell me
the best way to remove an element at the end of an array or at
some index i?
import std.algorithm;
T[] arr;
arr = arr.r
On Monday, 31 August 2015 at 13:00:49 UTC, Namal wrote:
Hey guys, since I am learning D arrays here, can you tell me
the best way to remove an element at the end of an array or at
some index i?
import std.algorithm;
T[] arr;
arr = arr.remove(index);
http://p0nce.github.io/d-idioms/#Adding-or
Hey guys, since I am learning D arrays here, can you tell me the
best way to remove an element at the end of an array or at some
index i?
On 31.08.2015 15:28, Andrea Fontana wrote:
On Monday, 31 August 2015 at 11:06:40 UTC, drug wrote:
On 31.08.2015 13:57, Andrea Fontana wrote:
Just create a function that return a string with those three lines and
mixin it!
Like:
import std.stdio;
string toMix( string a, string b, string c)
{
On Monday, 31 August 2015 at 01:01:32 UTC, mzf wrote:
On Saturday, 29 August 2015 at 12:56:08 UTC, cym13 wrote:
Hi,
Let's say I have a simple binary file whose structure is
well-known. Here is
an example which stores points:
struct Point {
long x;
long y;
long z;
}
struct Bi
On Monday, 31 August 2015 at 11:06:40 UTC, drug wrote:
On 31.08.2015 13:57, Andrea Fontana wrote:
Just create a function that return a string with those three
lines and
mixin it!
Like:
import std.stdio;
string toMix( string a, string b, string c)
{
return `string a = "` ~ a ~ `";` ~ `
On Monday, 31 August 2015 at 12:00:26 UTC, bearophile wrote:
Namal:
std::vector foo(int N){
std::vector V(N);
int some_array[N];
VLAs are not present in D.
Bye,
bearophile
Yah, I guess I have been damaged with them when I started to
learn programming in C++ >(
Namal:
std::vector foo(int N){
std::vector V(N);
int some_array[N];
VLAs are not present in D.
Bye,
bearophile
On Monday, 31 August 2015 at 11:27:20 UTC, Rikki Cattermole wrote:
You cannot define static arrays using runtime information.
You must use dynamic arrays.
int[] foo(int N) {
int[] v;
v.length = N;
// do something with it
int[] 2;
return s;
}
Of course y
On 31.08.2015 14:36, cym13 wrote:
On Monday, 31 August 2015 at 11:06:40 UTC, drug wrote:
On 31.08.2015 13:57, Andrea Fontana wrote:
Just create a function that return a string with those three lines and
mixin it!
Like:
import std.stdio;
string toMix( string a, string b, string c)
{
ret
On Monday, 31 August 2015 at 11:06:40 UTC, drug wrote:
On 31.08.2015 13:57, Andrea Fontana wrote:
Just create a function that return a string with those three
lines and
mixin it!
Like:
import std.stdio;
string toMix( string a, string b, string c)
{
return `string a = "` ~ a ~ `";` ~ `
On 31/08/15 11:24 PM, Namal wrote:
Hello,
can someone explain to me please what I am doing wrong by passing an
integer to this function and then just creating a static array? The
error I get is:
Error: variable N cannot be read at compile time
int[] foo(int N){
int[N] v;
//do somet
Hello,
can someone explain to me please what I am doing wrong by passing
an integer to this function and then just creating a static
array? The error I get is:
Error: variable N cannot be read at compile time
int[] foo(int N){
int[N] v;
//do something with it
int[]
On 31.08.2015 13:57, Andrea Fontana wrote:
Just create a function that return a string with those three lines and
mixin it!
Like:
import std.stdio;
string toMix( string a, string b, string c)
{
return `string a = "` ~ a ~ `";` ~ `string b = "` ~ b ~ `";`
`string c = "` ~ c ~ `";`;
}
vo
On Monday, 31 August 2015 at 10:38:41 UTC, drug wrote:
On 31.08.2015 13:35, drug wrote:
I have code that is being duplicated in several places and I'd
like to
use mixins to simplify code maintenance but I failed to do it.
For
example
https://github.com/drug007/hdf5-d-examples/blob/tmp/examples
On 31.08.2015 13:35, drug wrote:
I have code that is being duplicated in several places and I'd like to
use mixins to simplify code maintenance but I failed to do it. For
example https://github.com/drug007/hdf5-d-examples/blob/tmp/examples/aux.d
Lines 80-82, 91-93 and 99-101 are identical, how c
I have code that is being duplicated in several places and I'd like to
use mixins to simplify code maintenance but I failed to do it. For
example https://github.com/drug007/hdf5-d-examples/blob/tmp/examples/aux.d
Lines 80-82, 91-93 and 99-101 are identical, how can I use mixin here?
I failed to
On Monday, 31 August 2015 at 05:38:54 UTC, Jonathan M Davis wrote:
So, you're going to need to pass it a Chameleon!(float,
purpose.POSITIONAL) and a Chameleon!(float, purpose.COLOR_ONLY
color), not 6 doubles - either that, or you're going to need to
declare a constructor for VertexData which ta
On 31.08.2015 11:12, Enamex wrote:
On Monday, 31 August 2015 at 07:55:53 UTC, drug wrote:
Hello
I need to get the type to which I can cast the enum for using with
foreign library. For example:
```
enum Foo { A = "a", B = "b", }
enum Bar { A = 123, B = 432, }
static assert(is(BaseEnumType!Foo ==
On Monday, 31 August 2015 at 07:55:53 UTC, drug wrote:
Hello
I need to get the type to which I can cast the enum for using
with foreign library. For example:
```
enum Foo { A = "a", B = "b", }
enum Bar { A = 123, B = 432, }
static assert(is(BaseEnumType!Foo == string));
static assert(is(BaseEn
On Monday, 31 August 2015 at 07:55:53 UTC, drug wrote:
Hello
I need to get the type to which I can cast the enum for using
with foreign library. For example:
```
enum Foo { A = "a", B = "b", }
enum Bar { A = 123, B = 432, }
static assert(is(BaseEnumType!Foo == string));
static assert(is(BaseEn
On Monday, 31 August 2015 at 08:10:35 UTC, wobbles wrote:
On Monday, 31 August 2015 at 07:55:53 UTC, drug wrote:
import std.stdio;
import std.traits;
void main(){
static if(isSomeString!Foo){
writefln("String: %s", Foo.A);
}
static if(isScalarType!Bar){
On 31.08.2015 11:10, wobbles wrote:
In std.traits there is the required isX funcitons.
import std.stdio;
import std.traits;
void main(){
static if(isSomeString!Foo){
writefln("String: %s", Foo.A);
}
static if(isScalarType!Bar){
writef
On Monday, 31 August 2015 at 01:32:01 UTC, Yuxuan Shui wrote:
Why is reduce defined as 'auto reduce(S, R)(S seed, R r)',
instead of reduce(R r, S seed)? I can't chain it.
Maybe provide both?
You might be interested in this PR
https://github.com/D-Programming-Language/phobos/pull/1955
It's a
Hello
I need to get the type to which I can cast the enum for using with
foreign library. For example:
```
enum Foo { A = "a", B = "b", }
enum Bar { A = 123, B = 432, }
static assert(is(BaseEnumType!Foo == string));
static assert(is(BaseEnumType!Bar == int));
I guess there is simple answer som
On Monday, 31 August 2015 at 05:47:31 UTC, Ali Çehreli wrote:
On 08/30/2015 10:38 PM, Jonathan M Davis via
Digitalmars-d-learn wrote:
On Monday, August 31, 2015 04:57:05 WhatMeWorry via
Digitalmars-d-learn wrote:
This seemingly trivial array initialization has caused me
hours
of grief.
enum
43 matches
Mail list logo