I have a template function with a particular constraint (in this
case [1]). When this constraint doesn't match, I want to give the
user a suggestion what to do instead.
The only way I know of to do this currently is to relax the
template constraints, and adding a `static assert`. However, if
hello, I'd like to test if it's possible to add an automatic
radix detection in std.conv, parse.
I've added...
if (s.length = 2)
{
if (s[0..2] == 0x || s[0..2] == 0X)
{
uint radix = 16;
Source nbr = s[2..$];
Hello.
Just to finish this thread, umockdev[1] seems to be just what I
want.
Thank you for your sugestion!
[1] https://github.com/martinpitt/umockdev
On Friday, 25 July 2014 at 01:54:53 UTC, Jay Norwood wrote:
I don't recall the exact use case for the database expressions,
but I believe they were substituting a simple symbol for the
fully qualified object.
The sql with clause is quite a bit different than I remembered.
For one thing, I
Is it possible to automatically convert an associative array to a
struct?
Basically I want to do the following (for any struct).
struct A {
double x = 1;
}
double[string] aa = [x:1];
auto a = toStruct!A( aa );
I've been trying to do this at compile time, but can't work out
how setMembers
BlackEdder:
Is this possible at all?
I think it's possible, as long as your associative array contents
are known at compile-time. You can write a function that given
the associative array returns a string that mixed-in defines the
struct. And then you can define a toStruct template.
Bye,
Hello!
I started exploring D today and one of the things that caught my
attention was the array operations feature.
While playing around and writing some code with it, I came across
a problem I wasn't able to find a solution for. The following is
a simple example of the assignment array
Márcio Martins:
float[10] a;
a[] = uniform(0.0f, 1.0f);
This is going to set all values to the result of a single call
to uniform();
Is there a way to express my intent that I want one result per
array element?
Currently D array operations can't be used for that kind of
usage. So you
On Friday, 25 July 2014 at 15:25:43 UTC, BlackEdder wrote:
Is it possible to automatically convert an associative array to
a
struct?
Basically I want to do the following (for any struct).
struct A {
double x = 1;
}
double[string] aa = [x:1];
auto a = toStruct!A( aa );
I've been trying
On Friday, 25 July 2014 at 15:48:54 UTC, John Colvin wrote:
On Friday, 25 July 2014 at 15:25:43 UTC, BlackEdder wrote:
Is it possible to automatically convert an associative array
to a
struct?
Basically I want to do the following (for any struct).
struct A {
double x = 1;
}
On Thu, 24 Jul 2014 22:00:43 +, Pavel wrote:
On Thursday, 24 July 2014 at 16:09:25 UTC, Justin Whear wrote:
On Thu, 24 Jul 2014 16:04:01 +, Pavel wrote:
Thanks to all you folks who explained in operator for me. My bad.
Let's focus on the real problem, which is JSON wrapper class. Is
Hello,
is there a pretty way to split a range into 3 pieces, like
findSplit, just with a predicate instead of comparing it with an
element.
Like this :
void main() {
import std.algorithm, std.stdio;
auto list = [1,2,3,4,5,6,7];
writeln(findSplit!(x = x == 3 )(list));
On Friday, 25 July 2014 at 18:56:44 UTC, Gecko wrote:
findSplit accepts a predicate but it doesnt compile for me if i
use an other function than ((a,b) = a == b).
Not at the moment. I've been working on a patch that makes the
`findSplit*` family of algorithms as powerful as `find`,
including
On Friday, 25 July 2014 at 01:54:53 UTC, Jay Norwood wrote:
On Thursday, 24 July 2014 at 20:16:53 UTC, monarch_dodra wrote:
Or did I miss something?
Yes, sorry, I should have pasted a full example previously. The
code at the end is with the Raw_met members renamed (they were
originally a
I am presently trying to port a driver I wrote for Windows to
OSX. The one thing standing in my way is figuring out how to get
the equivalent of DllMain on OSX.
I need a place to call Runtime.initialize() and whatnot.
Reading the wiki, it seemed like `shared static this()` was the
Is there a function for doing this?
myrange.at(i)
(with meaning of myrange.dropExactly(i).front)
it's a common enough operation (analog to myrange[i]; the naming is from
C++'s std::vectorT::at)
On Friday, 25 July 2014 at 21:33:23 UTC, Timothee Cour via
Digitalmars-d-learn wrote:
Is there a function for doing this?
myrange.at(i)
(with meaning of myrange.dropExactly(i).front)
it's a common enough operation (analog to myrange[i]; the
naming is from
C++'s std::vectorT::at)
That would
On Friday, 25 July 2014 at 21:23:00 UTC, Mark Isaacson wrote:
I am presently trying to port a driver I wrote for Windows to
OSX. The one thing standing in my way is figuring out how to
get the equivalent of DllMain on OSX.
I need a place to call Runtime.initialize() and whatnot.
Reading the
Loading multiple D shared libraries isn't supported on OS X
yet, see these warnings in druntime:
https://github.com/D-Programming-Language/druntime/blob/master/src/rt/sections_osx.d#L198
If you only have a single D shared library, I think it's
possible, you just may have to tweak
On 7/25/14, 1:06 PM, Justin Whear wrote:
On Thu, 24 Jul 2014 22:00:43 +, Pavel wrote:
On Thursday, 24 July 2014 at 16:09:25 UTC, Justin Whear wrote:
On Thu, 24 Jul 2014 16:04:01 +, Pavel wrote:
Thanks to all you folks who explained in operator for me. My bad.
Let's focus on the real
On 7/25/14, 6:39 PM, Jonathan M Davis wrote:
On Friday, 25 July 2014 at 21:33:23 UTC, Timothee Cour via
Digitalmars-d-learn wrote:
Is there a function for doing this?
myrange.at(i)
(with meaning of myrange.dropExactly(i).front)
it's a common enough operation (analog to myrange[i]; the naming is
On Saturday, 26 July 2014 at 00:28:32 UTC, Ary Borenszweig wrote:
On 7/25/14, 6:39 PM, Jonathan M Davis wrote:
On Friday, 25 July 2014 at 21:33:23 UTC, Timothee Cour via
Digitalmars-d-learn wrote:
Is there a function for doing this?
myrange.at(i)
(with meaning of myrange.dropExactly(i).front)
On Saturday, 26 July 2014 at 00:26:08 UTC, Ary Borenszweig wrote:
Or use Algebraic, but it currently doesn't support recursive
type definitions.
Algebraic does support recursive type definitions.
import std.variant;
alias Rec = Algebraic!(int, This*);
void main()
{
//I'm not sure why
23 matches
Mail list logo