On Saturday, 22 February 2014 at 07:26:26 UTC, Steve Teale wrote:
This is probably not exactly a D question.
The library librsvg expects to get an SVG file filename. I have
the data of such a file in memory.
If it's the same librsvg as below, then it looks like it has an
API function which c
This is probably not exactly a D question.
The library librsvg expects to get an SVG file filename. I have
the data of such a file in memory.
How do I dress up that memory as a file with a name so that I can
pass the name to the librsvg open function.
I've looked at std.mmfile, and played w
Generic?
"Frustrated" ...
> interface iGui
> {
> @property iButton button(ref iButton button);
> }
>
> class WindowsGui : iGui
> {
> WindowsButton _button;
>
> @property WindowsButton button(ref WindowsButton button)
> //@property iButton button(ref iButton button)
> {
> _button = button;
> retur
On Thursday, 20 February 2014 at 18:55:06 UTC, Frustrated wrote:
This should work. Just have to add the overrides and call the
base function(e.g., "override" insert and then call x's insert).
This at least gets the job done... I wonder if there is a better
way?
If you want a.Add() (insert() in
On Fri, 21 Feb 2014 17:54:06 -0500, Frustrated wrote:
interface iGui
{
@property iButton button(ref iButton button);
}
class WindowsGui : iGui
{
WindowsButton _button;
@property WindowsButton button(ref WindowsButton button)
//@property iButton button(ref iButt
thanks. works nice
On Friday, 21 February 2014 at 23:19:19 UTC, Ali Çehreli wrote:
On 02/21/2014 02:54 PM, Frustrated wrote:
interface iGui
{
@property iButton button(ref iButton button);
}
class WindowsGui : iGui
{
WindowsButton _button;
@property WindowsButton button(ref WindowsButton button)
/
On Friday, 21 February 2014 at 23:46:10 UTC, voyager wrote:
is there some thing like typedef?
alias int XXX;
alias int YYY;
void a1(XXX a, YYY b) {int c = a+b;}
void a1(int a, YYY b) {int c = a+b;}
gives an error:
Building Debug\bgitest.exe...
bgitest.obj : fatal error LNK1179: invalid or cor
is there some thing like typedef?
alias int XXX;
alias int YYY;
void a1(XXX a, YYY b) {int c = a+b;}
void a1(int a, YYY b) {int c = a+b;}
gives an error:
Building Debug\bgitest.exe...
bgitest.obj : fatal error LNK1179: invalid or corrupt file:
duplicate COMDAT '_D4main2a1FiiZv (void main.a1(i
On 02/21/2014 02:54 PM, Frustrated wrote:
interface iGui
{
@property iButton button(ref iButton button);
}
class WindowsGui : iGui
{
WindowsButton _button;
@property WindowsButton button(ref WindowsButton button)
//@property iButton button(ref iButton button)
{
D version of to!string(uint):
size_t index = 12;
char[12] buffer = void;
uint div = void;
uint mod = void;
char baseChar = 'A';
do {
div = cast(uint)(mValue / 10);
mod = mValue % 10 + '0';
buffer[--index] = cast(char)mod;
mValue = div;
} while (mValue);
return cast(string)buffer[index
interface iGui
{
@property iButton button(ref iButton button);
}
class WindowsGui : iGui
{
WindowsButton _button;
@property WindowsButton button(ref WindowsButton button)
//@property iButton button(ref iButton button)
{
_button = button;
Justin:
> alias MyFoo = Foo!(opt1(23), opt2("foo"));
That's also my preferred solution. I find it easy to read and it's quite
typesafe (also, it allows for more complex possibilities like n-params
options).
Another solution could be to use an associative array literal for each
option (you have to
On Fri, 21 Feb 2014 19:09:56 +, Uranuz wrote:
>> You could do something like this:
>>
>> alias Foo!(
>> OptionType.optType1, 100, OptionType.optType2, "example,
>> ...etc...
>> ) MyFoo;
>
> Yes. I already use this. But it makes it not semanticaly obvious that
> OptionType.optType1 is
On Friday, 21 February 2014 at 19:13:13 UTC, Chris Williams wrote:
On Thursday, 20 February 2014 at 17:02:15 UTC, Dicebot wrote:
You can't do it without allocation because memory layout is
different for int** and int[][] in D - are.ptr in latter
points to slice struct (pointer+length) as oppose
On Thursday, 20 February 2014 at 17:02:15 UTC, Dicebot wrote:
You can't do it without allocation because memory layout is
different for int** and int[][] in D - are.ptr in latter points
to slice struct (pointer+length) as opposed to raw pointer in
former.
You should only have to copy the top
You could do something like this:
alias Foo!(
OptionType.optType1, 100,
OptionType.optType2, "example,
...etc...
) MyFoo;
Yes. I already use this. But it makes it not semanticaly obvious
that OptionType.optType1 is a kind of `key` and 100 is `value`.
Also it needs to parse it and
On Fri, 21 Feb 2014 17:57:57 +, Uranuz wrote:
> My idea is that pass these options using syntax like this:
>
> alias Foo!( [
>OptionType.optType1 : 100, OptionType.optType2 : "example",
>"someOtherOpt1": "someOtherOptValue", "someOtherOpt2": true
> ] ) MyFoo;
>
> Using [] brackets
In my template functions, classes it's necessary to write
variadic template parameter list, where elements are options to
this class/function changing it's behaviour. But they are
optional and may be not set at all. These options may be folowed
by variadic template parameter list that will be
On Thursday, 20 February 2014 at 22:36:58 UTC, Ali Çehreli wrote:
int proccessRowTemplate(size_t optionVariant)(in Row table)
{
int sum = 0;
foreach(size_t i; StaticRange!(Row.numberField))
{
static if (optionVariant & 1<
This version of the program looks more graceful than m
On 02/21/2014 08:46 AM, Gopan wrote:
> On Friday, 21 February 2014 at 14:04:45 UTC, FreeSlave wrote:
>> Another strange thing:
>>
>> import std.stdio;
>>
>> uint Test()
>> {
>> if (!__ctfe)
>> {
>> return 3;
>> }
>> return 2;
>> }
>>
>>
>>
>> void main()
>> {
>> immuta
On Friday, 21 February 2014 at 14:04:45 UTC, FreeSlave wrote:
Another strange thing:
import std.stdio;
uint Test()
{
if (!__ctfe)
{
return 3;
}
return 2;
}
void main()
{
immutable n = Test();
int[n] arr;
writeln("arrary length = ", arr.length, " ; n = ", n
On Friday, 21 February 2014 at 13:39:08 UTC, Orvid King wrote:
The single biggest reason that this is slower in D than in C# is
because of the GC. By default with MS.Net, and Mono (when
compiled
with sgen) an allocation is almost literally just a
bump-the-pointer,
with an occasional scan (no co
On Thursday, 20 February 2014 at 13:40:38 UTC, anonymous wrote:
When a
value is needed at compile time (e.g. initializer for a static
variable, length of a static array), then CTFE is forced. When
the value is not needed at compile time, the optimizer may go
for
it, but that's not guaranteed.
On Friday, 21 February 2014 at 13:38:58 UTC, Gopan wrote:
Attempting to learn CTFE, I tried the following test.
size_t counter;
uint Test()
{
if (!__ctfe)
{
++counter;// This code is for execution at run time
}
return 2;
}
void main()
{
w
Another strange thing:
import std.stdio;
uint Test()
{
if (!__ctfe)
{
return 3;
}
return 2;
}
void main()
{
immutable n = Test();
int[n] arr;
writeln("arrary length = ", arr.length, " ; n = ", n);
}
Output:
arrary length = 2 ; n = 3
When you think about i
On Friday, 21 February 2014 at 13:38:58 UTC, Gopan wrote:
Attempting to learn CTFE, I tried the following test.
size_t counter;
uint Test()
{
if (!__ctfe)
{
++counter;// This code is for execution at run time
}
return 2;
}
void main()
{
w
Attempting to learn CTFE, I tried the following test.
size_t counter;
uint Test()
{
if (!__ctfe)
{
++counter;// This code is for execution at run time
}
return 2;
}
void main()
{
writeln("counter = ", counter);
immutable i
The single biggest reason that this is slower in D than in C# is
because of the GC. By default with MS.Net, and Mono (when compiled
with sgen) an allocation is almost literally just a bump-the-pointer,
with an occasional scan (no compaction for this code) and collection
of the 64kb (on MS.Net it ac
On Thursday, 20 February 2014 at 21:32:10 UTC, Robin wrote:
Hiho,
here are the results of both compilers (DMD and LDC2) on my
system:
LDC:
=
allocationTest ...
Time required: 5 secs, 424 msecs
multiplicationTest ...
Time required: 1 secs
On Thursday, 20 February 2014 at 17:24:55 UTC, D Apprentice wrote:
Greetings, D wizards.
Given a static array, int[5] a, presumed to be filled with
random
numbers, how does one sort it using std.algorithm.sort? Calling
sort(a) by itself errors out with:
test.d(7): Error: template std.algorith
On Friday, 21 February 2014 at 09:29:42 UTC, Mattdef wrote:
Thanks for yours replies.
I know it is the conversion of uint that is the problem but my
C#
code has the same conversion. So C# is better than D for string
conversions ?
(sorry for my english)
It's quite possible that C# has faster
On Friday, 21 February 2014 at 09:59:04 UTC, simendsjo wrote:
On Friday, 21 February 2014 at 09:46:20 UTC, Mengu wrote:
On Thursday, 20 February 2014 at 10:28:45 UTC, simendsjo wrote:
http://youtu.be/wFqHTCBt72M
enjoyed it, thanks!
what are you going to talk about next?
I only have a rough
On Friday, 21 February 2014 at 09:46:20 UTC, Mengu wrote:
On Thursday, 20 February 2014 at 10:28:45 UTC, simendsjo wrote:
http://youtu.be/wFqHTCBt72M
enjoyed it, thanks!
what are you going to talk about next?
I only have a rough outline in my head that will probably change
as I go:
* Split
On Thursday, 20 February 2014 at 10:28:45 UTC, simendsjo wrote:
http://youtu.be/wFqHTCBt72M
enjoyed it, thanks!
what are you going to talk about next?
Thanks for yours replies.
I know it is the conversion of uint that is the problem but my C#
code has the same conversion. So C# is better than D for string
conversions ?
(sorry for my english)
36 matches
Mail list logo