On 11/25/16 18:33, Jonathan M Davis via Digitalmars-d-learn wrote:
> On Friday, November 25, 2016 18:20:11 Artur Skawina via Digitalmars-d-learn
> wrote:
>> On 11/25/16 17:30, Jonathan M Davis via Digitalmars-d-learn wrote:
>>> On Friday, November 25, 2016 17:03:32 Artur Ska
On 11/25/16 17:30, Jonathan M Davis via Digitalmars-d-learn wrote:
> On Friday, November 25, 2016 17:03:32 Artur Skawina via Digitalmars-d-learn
> wrote:
>> On 11/25/16 15:51, Jonathan M Davis via Digitalmars-d-learn wrote:
>>> On Friday, November 25, 2016 14:27:
On 11/25/16 15:51, Jonathan M Davis via Digitalmars-d-learn wrote:
> On Friday, November 25, 2016 14:27:39 Igor Shirkalin via Digitalmars-d-learn
> wrote:
>> I think you may write it (I mean actual D) with using some
>> template like this:
>>
>> auto array = static_array!uint(1, 2, 3, 4)
>>
>> Cou
On 06/09/16 07:20, cy via Digitalmars-d-learn wrote:
> Like this is why it doesn't really make sense:
>
> import std.stdio;
>
> auto foo(Callable)(Callable c) {
> return c(42);
> }
>
> auto foo2(alias c)() {
> return c(42);
> }
>
> void main() {
> // this works, when you know it's an int
On 03/30/16 20:12, jmh530 via Digitalmars-d-learn wrote:
> I wrote a version of cartesianProduct that will return the cartesian product
> when the some of the types are not ranges. The original code is below.
>
> My issue is that I can't figure out how to turn it into a variadic template.
> auto
On 03/11/16 09:21, Ali Çehreli via Digitalmars-d-learn wrote:
> You've been bitten by a common usability issue. :)
>
> On 03/11/2016 12:02 AM, Fynn Schröder wrote:
>> static if (is(U == ubyte)) {
>> } else if (is(U == ushort)) {
>
> You mean 'else static if'. (Not your fault: I (and ot
On 02/19/16 19:10, Nordlöw via Digitalmars-d-learn wrote:
> Have anybody put together a generalised form of findSplit that can split and
> decode using a compile time parameters somewhat like
>
> "(1)-(2.0)".decode!("(", int, ")", char, "(", double, ")")
>
> evaluates to
>
> to a
>
> tuple!(in
On 02/05/16 14:38, Ola Fosheim Grøstad via Digitalmars-d-learn wrote:
> On Friday, 5 February 2016 at 12:35:14 UTC, Artur Skawina wrote:
>> call used to print diagnostics. What I saw made me never use or look at D's
>> std lib again. Except for meta programing and toy/examp
On 02/05/16 08:04, cy via Digitalmars-d-learn wrote:
> On Thursday, 4 February 2016 at 15:32:48 UTC, Artur Skawina wrote:
>>void print(A...)(A a) {
>> foreach (N, ref e; a)
>> write(e, N==A.length-1?"\n":" ");
>>}
>
&
On 02/04/16 18:53, ixid via Digitalmars-d-learn wrote:
> On Thursday, 4 February 2016 at 17:34:33 UTC, Artur Skawina wrote:
>> On 02/04/16 16:32, Artur Skawina wrote:
>> but that seems too expensive, when the use is just in toy programs and
>> debugging.
>
> I h
On 02/04/16 16:32, Artur Skawina wrote:
>
>void print(A...)(A a) {
> foreach (N, ref e; a)
> write(e, N==A.length-1?"\n":" ");
>}
BTW, that was *deliberately* written that way as a compromise
between efficiency and template bloat. It
On 02/04/16 15:02, ixid via Digitalmars-d-learn wrote:
> On Thursday, 4 February 2016 at 13:46:46 UTC, Dejan Lekic wrote:
>> On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote:
>>> It would be nice to have a simple writeln that adds spaces automatically
>>> like Python's 'print' in std.stdio
On 02/01/16 21:42, Artur Skawina wrote:
> On 02/01/16 20:47, Meta via Digitalmars-d-learn wrote:
>> That looks much nicer. It still needs work to properly handle functions with
>> non-empty argument lists.
>
> Then it gets a bit long for a one-liner ;)
>
>enum
On 02/01/16 20:47, Meta via Digitalmars-d-learn wrote:
> On Monday, 1 February 2016 at 18:28:05 UTC, Artur Skawina wrote:
>> On 01/31/16 23:11, Steven Schveighoffer via Digitalmars-d-learn wrote:
>>> Thanks! I was surprised this is not straightforward.
>>
>>enum
On 01/31/16 23:11, Steven Schveighoffer via Digitalmars-d-learn wrote:
> Thanks! I was surprised this is not straightforward.
enum isLvalue(alias A) = is(typeof((ref _){}(A)));
artur
On 12/04/15 09:12, Andre via Digitalmars-d-learn wrote:
> Hi,
>
> I have a strange issue with following coding.
>
> void baz(); // forward declaration
>
> void foo()
> {
> void bar()
> {
> baz(); // (1) without f.d. syntax error
> }
>
> void baz()
> {
> b
On 11/25/15 17:11, Radek via Digitalmars-d-learn wrote:
> Hi, I'm making a trying to bind a gsl library
> http://www.gnu.org/software/gsl/ so far it was working but when i started
> binding complex numbers some functions won't work, like trigonometric
> functions - called they return null.
>
>
On 10/08/15 11:29, tcak via Digitalmars-d-learn wrote:
> I am "trying" to write a function that takes an array of items, and returns
> the length of longest item.
>
> [code]
> size_t maxLength(A)( const A[] listOfString ) if( __traits( hasMember, A,
> "length" ) )
> {
> return 0; // not impl
On 09/29/15 12:13, rumbu via Digitalmars-d-learn wrote:
> On Tuesday, 29 September 2015 at 09:53:39 UTC, Kagamin wrote:
>> On Tuesday, 29 September 2015 at 09:11:15 UTC, John Colvin wrote:
>>> Welcome to the weird and wonderful work of
>>> http://dlang.org/expression.html#IsExpression
>>
>> No, u
On 09/25/15 17:47, Ali Çehreli via Digitalmars-d-learn wrote:
> Perhaps we need an enhancement that either works in your original code [...]
His original code does work (`foreach` evaluates `args[N]` and
assigns the result to `arg`).
If he wanted to delay the evaluation, he would have written it
On 09/24/15 13:26, Marc Schütz via Digitalmars-d-learn wrote:
> On Thursday, 24 September 2015 at 01:01:09 UTC, Nicholas Wilson wrote:
>> On Wednesday, 23 September 2015 at 21:25:15 UTC, tcak wrote:
>>> On Wednesday, 23 September 2015 at 21:14:17 UTC, Adam D. Ruppe wrote:
On Wednesday, 23 Sept
On 08/26/15 14:42, Mike Parker via Digitalmars-d-learn wrote:
> This doesn't help me distinguish aliased function names.
[...]
> I don't want to put any restrictions on what the user can have in the
> module/class/struct that contains the function pointer. It's just that
> aliased function name
On 07/27/15 14:03, Vlad Leberstein via Digitalmars-d-learn wrote:
> Hi! My use case requires interaction with C API which in turn implies storing
> object instance reference as void *. I'm using gdc 4.9.2 and everything
> worked fine with "object -> void * -> object" conversion, but "object -> vo
On 07/03/15 12:52, Laeeth Isharc via Digitalmars-d-learn wrote:
> I have an array of structs eg
>
> struct PriceBar
> {
> DateTime date;
> double open;
> double high;
> double low;
> double close;
> }
>
> (which fields are present in this particular struct will depend on template
> arg
On 06/04/15 00:37, Tofu Ninja via Digitalmars-d-learn wrote:
> Is there a way other than exceptions for a called function to force the
> caller to return?
>
> Specifically, I know the return type of the caller(its always bool) and under
> certain circumstances I would like the caller to just giv
import std.algorithm;
template magicassign(A...) {
void magicassign(B)(B b) @property {
foreach(I, ref a; A)
static if (!is(typeof(A[I]):typeof(null)))
a = b[I];
}
}
template let(string D) {
mixin({
enum sdsl = D.findSplit
On 05/08/15 23:56, Brian Schott via Digitalmars-d-learn wrote:
> On Friday, 8 May 2015 at 12:44:31 UTC, Artur Skawina wrote:
>> On 05/08/15 03:53, Brian Schott via Digitalmars-d-learn wrote:
>>> The problem occurs when I want to register multiple modules to scan for
>>
On 05/08/15 03:53, Brian Schott via Digitalmars-d-learn wrote:
> The problem occurs when I want to register multiple modules to scan for
> functions. The grammar does not allow this syntax:
>
> ```
> template (alias Modules ...) {
> ...
> ```
The grammar allows omitting the 'alias' keyword.
art
On 05/02/15 05:28, Jens Bauer via Digitalmars-d-learn wrote:
> On Saturday, 2 May 2015 at 03:21:38 UTC, Jens Bauer wrote:
>> For some reason, my build time has increased dramatically...
>>
>> Building with 1 vector takes 0.6 seconds.
>> Building with 2 vector takes 0.7 seconds.
>> Building with 4 v
On 05/01/15 22:29, Jens Bauer via Digitalmars-d-learn wrote:
> On Wednesday, 29 April 2015 at 13:58:14 UTC, Artur Skawina wrote:
>> On 04/27/15 19:49, Jens Bauer via Digitalmars-d-learn wrote:
>>> I was wondering if there's a way to reduce my bulky startup files a bit.
>
On 04/27/15 19:49, Jens Bauer via Digitalmars-d-learn wrote:
> I was wondering if there's a way to reduce my bulky startup files a bit.
>
> If using the GNU Assembler (GAS), then one can reduce the code using a macro
> like this:
>
>
> /* The EXC macro makes a weak+alias for the
> * symbol 'va
On 04/10/15 17:36, John Colvin via Digitalmars-d-learn wrote:
> On Friday, 10 April 2015 at 15:13:54 UTC, Marc Schütz wrote:
>> Is there a way to turn an array (known at compile time) into a TypeTuple?
> For input ranges in general:
>
> import std.range : isInputRange;
>
> template TypeTupleOf(
On 04/08/15 18:10, Jens Bauer via Digitalmars-d-learn wrote:
> On Wednesday, 8 April 2015 at 11:17:12 UTC, Mike wrote:
>> On Tuesday, 7 April 2015 at 20:33:26 UTC, Jens Bauer wrote:
>>
>> enum weak = gcc.attribute.attribute("weak");
>> enum isrDefault = gcc.attribute.attribute("alias", "defaultHand
On 03/11/15 15:41, ketmar via Digitalmars-d-learn wrote:
> On Wed, 11 Mar 2015 14:36:07 +, wobbles wrote:
>
>> On Wednesday, 11 March 2015 at 14:34:32 UTC, ketmar wrote:
>>> On Wed, 11 Mar 2015 13:48:45 +, Namespace wrote:
>>>
This code does not work:
enum Test {
>
On 03/06/15 22:29, Artur Skawina wrote:
> No, you implement it using CTFE magic, and then that code becomes:
>#foreach (N; 0..PairInitValues.length/2) {
> enum PairInitValue(T:PairInitValues[$N*2]) = PairInitValues[$N*2+1];
>}
> Seriously though, avoid using `
On 03/06/15 19:27, Kagamin via Digitalmars-d-learn wrote:
> On Friday, 6 March 2015 at 16:39:56 UTC, Ali Çehreli wrote:
>> mixin (makePairInitValueDefinitions());
>
> Oh, so that's how you do static foreach.
No, you implement it using CTFE magic, and then that code becomes:
import std.typetup
On 01/31/15 17:04, tcak via Digitalmars-d-learn wrote:
>
> struct CommunicationMessage{
[...]
> content:
> }
>
>
> Example I defined something like above. I am using it as a base structure,
> and don't know how long the content of message will be. But I know that it
> will be at the end. I cou
On 01/28/15 10:44, zhmt via Digitalmars-d-learn wrote:
> I have a struct created by thrift:
>
> struct Card {
> long id;
> string pwd;
> long agentId;
> bool valid;
> long rmb;
> long createDate;
> long soldDate;
> long chargeDate;
>
> mixin TStructHelpers!([
> TFieldMeta(`i
On 01/27/15 10:40, Daniel Kozak via Digitalmars-d-learn wrote:
> On Tuesday, 27 January 2015 at 09:36:49 UTC, Daniel Kozak wrote:
>> On Tuesday, 27 January 2015 at 09:01:39 UTC, ref2401 wrote:
>>> For several times I've met struct(or static struct) usage in Phobos for
>>> singleton pattern impleme
On 01/13/15 21:52, Dominikus Dittes Scherkl via Digitalmars-d-learn wrote:
> On Tuesday, 13 January 2015 at 20:11:45 UTC, anonymous wrote:
>> On Tuesday, 13 January 2015 at 20:00:57 UTC, Dominikus Dittes Scherkl wrote:
>>> So if I have a function that allowes to do this:
>>>
>>> uint a;
>>> a.bit[1
On 01/06/15 23:14, Peter Alexander via Digitalmars-d-learn wrote:
> auto foo(T)(T a) {
> T b; // Error: cannot access frame pointer of main.X
> b.data[] = 1;
> return b;
> }
>
> void main() {
> struct X {
> this(int) {}
> int[4096] data;
> }
> foo(X());
On 12/28/14 10:24, Aiden via Digitalmars-d-learn wrote:
> Is `shared` in a workable state?
No.
> Shouldn't Mutex, Condition, etc be shared since they are basically only ever
> useful when used in multiple threads?
Yes, but there are so many problems with 'shared' that
using it that way (even on
On 11/06/14 18:32, bearophile via Digitalmars-d-learn wrote:
> Marc Schütz:
>
>> We'd need something taking and returning a RoR that "mirrors" them
>> diagonally. Then we could simply apply `map!(r => r.sum)` on the result.
>
> A simple solution is to create a row of values, and then sum them co
On 08/25/14 18:52, Jonathan M Davis via Digitalmars-d-learn wrote:
> Another commonly used one is is(typeof(foo)). typeof(foo) gets the type of foo
> and will result in void if foo doesn't exist, and is(void) is false, whereas
D is not quite that simple. ;)
static assert(is(void)==true);
(a)
On 08/16/14 13:58, Philippe Sigaud via Digitalmars-d-learn wrote:
> On Sat, Aug 16, 2014 at 1:30 PM, Artur Skawina via Digitalmars-d-learn
>> http://forum.dlang.org/post/mailman.125.1397731134.2763.digitalmar...@puremagic.com
>
> Okay...
>
> So @safe includes child scope
On 08/16/14 13:18, Philippe Sigaud via Digitalmars-d-learn wrote:
> We indeed need to put annotations inside aggregates to
> affect their innards.
>
> If that's true, I have a lot of annotation sprinkling to do.
It's not true for @safe, but true for some other attributes.
http://forum.dlang.org/
On 08/09/14 03:20, Vlad Levenfeld via Digitalmars-d-learn wrote:
> More opDispatch woes. This feature keeps biting me, yet I keep trying to use
> it.
>
> This time I'm trying to access elements of a vector GLSL-style (without
> swizzling... for now).
>
> Here's the relevant code:
>
> struct Ve
On 08/05/14 22:32, Philippe Sigaud via Digitalmars-d-learn wrote:
> I'd have thought that this would work:
>
> struct A
> {
> int[] i;
> B b;
>
> struct B
> {
> void foo() { i ~= 1;}
> }
> }
>
> void main()
> {
> A a;
> a.b.foo();
> }
>
> But the compiler tel
On 08/03/14 23:19, Vlad Levenfeld via Digitalmars-d-learn wrote:
>
> I made less_than to serve as a default sorting predicate, so in a few places
> there is something like this:
>
> void sort (R, T = ElementType!R, alias compare = less_than!T)(R range, T item)
> {...}
void sort (R, T = Element
On 07/29/14 17:45, H. S. Teoh via Digitalmars-d-learn wrote:
> You're right, opDispatch behaves like SFINAE. I've had trouble debugging
> it before, because when it works, it works very well, but when you
> accidentally make a typo, it just "disappears" -- you get an error that
> the property is mi
On 07/14/14 13:42, Philippe Sigaud via Digitalmars-d-learn wrote:
> asserts get an entire copy of the parse tree. It's a bit wasteful, but
> using 'immutable' directly does not work here, but this is OK:
>
> enum res = MyRegex("abcabcdefFOOBAR"); // compile-time parsing
> immutable result
On 06/21/14 18:01, Philippe Sigaud via Digitalmars-d-learn wrote:
> In what way is a template more reliable than the equivalent function?
> mixin template Function(string name) {
> mixin("public static int " ~ name ~ "() { return other.module." ~
> name ~"; }");
> }
>
> struct S {
> mix
On 06/21/14 05:32, Paul D Anderson via Digitalmars-d-learn wrote:
> I can't use a template mixin:
>
> mixin template Function(string name)
> {
> const char[] Function =
> "public static int " ~ name ~ "() { return other.module." ~ name ~"; }";
> }
>
> Error: mixin templates are not regular
On 06/20/14 14:42, Dicebot via Digitalmars-d-learn wrote:
> On Friday, 20 June 2014 at 12:17:22 UTC, Johann Lermer wrote:
>> So, why is there no init routine for the rectangle? There's only one for the
>> matrix.
>
> That needs actually building deimos cairo and checking symbols in object
> file
On 06/18/14 07:49, Ali Çehreli via Digitalmars-d-learn wrote:
> The idea is to be able to have standard comparison behavior for structs
> without boilerplate. For example, if the ordering should consider all members
> of the following struct one after the other (first 'i', then 'l', and finally
On 06/11/14 16:05, monarch_dodra via Digitalmars-d-learn wrote:
> Well, (IMO) it's a problem with no real solution. But for what it's worth,
> most (if not all) of the algorithms in the standard lib know how to handle
> strings efficiently and correctly (split, find, etc...). Things only start
>
On 06/11/14 15:44, Artur Skawina wrote:
> If, instead, you create a string-specific 'countUntil' that returns
> a type that holds both the byte and code-point counts and implicitly
> converts to the latter, then you can have a 'takeExactly' overload
> that
On 06/11/14 14:40, monarch_dodra via Digitalmars-d-learn wrote:
> For example, you should avoid "countUntil" and "takeExactly" when dealing
> with strings, since these are not O(1) operations, and don't actually return
> string slices. EG:
> string s = "someGGGreatVariableName".slicer().front;
>
On 06/11/14 00:31, "Nordlöw" via Digitalmars-d-learn wrote:
>> Either way, it shouldn't be too hard to implement. Base it off
>> "splitter!pred", which is actually quite trivial. AFAIK, your
>
> What do you mean by basing it off splitter!pred - should I start with some
> existing splitter algori
On 06/10/14 02:28, Byron via Digitalmars-d-learn wrote:
> Should this work? It seems like the short circuit booleans are not
> working:
>
> enum isPrimitive(T) = isBasicType!T || (isArray!T && isBasicType!
> (ForeachType!T));
[...]
> But this style works:
>
> template isPrimitive(T)
> {
>
> On 06/05/14 08:58, Timothee Cour via Digitalmars-d-learn wrote:
>> //none of those work:
>> //alias fun2=a=>fun(a);
alias fun2=ALIAS!(a=>fun(a));
That 'ALIAS' template will need to be in module scope.
alias ALIAS(alias A) = A;
artur
On 06/05/14 08:58, Timothee Cour via Digitalmars-d-learn wrote:
> Is there a way to do this?
>
> auto fun(T)(T a){return a;}
>
> template fun2(T){auto fun2(T a){return fun(a);}}//OK but heavy syntax and
> cannot be nested inside test()
alias fun2(T) = fun!T;
But this will prevent IFTI, so
On 05/16/14 17:20, bearophile via Digitalmars-d-learn wrote:
> Artur Skawina:
>
>> Ugh. So how does it perform wrt the D version that I wrote for
>> you last time? [1]
>
> I have done a benchmark with the various version (the first 3 are the ones on
> the Rosettacod
On 05/16/14 11:47, bearophile via Digitalmars-d-learn wrote:
>> There are of course ways to implement a really efficient ZLW compressor in
>> D, and such implementation could be added as third D entry if it manages to
>> be not too much long,
>
> Third version added:
> http://rosettacode.org/wik
On 05/10/14 22:24, MarisaLovesUsAll via Digitalmars-d-learn wrote:
> I sometimes got a useless messages in stdout from SDL_Image
> library, and I want to temporary silence it. How do I do?
One way would be something like:
import std.stdio;
void writeOutput () {
static c = 1;
pr
On 05/06/14 16:45, via Digitalmars-d-learn wrote:
> On Tuesday, 6 May 2014 at 14:25:01 UTC, Artur Skawina via Digitalmars-d-learn
> wrote:
>> I'm not sure why you'd want to wrap the .offsetof expression in
>> a template, but it can easily be done like this:
>>
&
I'm not sure why you'd want to wrap the .offsetof expression in
a template, but it can easily be done like this:
enum offsetOf(alias A, string S) = mixin("A."~S~".offsetof");
Keep in mind that D's offsetof is flawed - if the object does not
contain the requested member, but implicitly convert
On 05/03/14 01:05, Mark Isaacson via Digitalmars-d-learn wrote:
> 2) I ran into this issue while attempting to leverage the postblit for
> code-reuse. In particular, I have a setup that is similar to:
>
> struct A {
> this(B b) { /* Stuff */ }
> }
>
> struct B {
> }
>
> void foo(T)(T param) {
On 05/02/14 17:27, Meta via Digitalmars-d-learn wrote:
> On Friday, 2 May 2014 at 15:18:06 UTC, Artur Skawina via Digitalmars-d-learn
> wrote:
>> On 05/02/14 15:38, "Nordlöw" via Digitalmars-d-learn wrote:
>>>
>>> template MemberNamesUnion(E...) if (al
On 05/02/14 15:38, "Nordlöw" via Digitalmars-d-learn wrote:
>
> template MemberNamesUnion(E...) if (allSatisfy!(isEnum, E))
> {
> bool[string] allMembers; // used to detect member collisions
> mixin({
> string r = "enum MemberNamesUnion { ";
> foreach (T; E) {
>
On 05/02/14 00:24, "Nordlöw" via Digitalmars-d-learn wrote:
> How can I make `join` variadic (by filling in njoin) in the following code?
import std.array, std.range, std.algorithm;
import std.stdio;
template Njoin(ES...) {
mixin({
string r = "enum Njoin { ";
fore
On 04/29/14 11:57, ketmar via Digitalmars-d-learn wrote:
> On Monday, 28 April 2014 at 15:57:16 UTC, anonymous wrote:
>> `zmod.symbol` works, too.
> no, it's not. at least on latest GDC.
It certainly works here; if it didn't it would be a frontend problem.
>> I don't think so. The point of the re
On 04/15/14 22:15, Jeroen Bollen wrote:
> exten(C) {
> testFunction(int function(int));
> }
>
> testFunction now requires an external function as parameter. It can't be
> called with a pointer to a D function.
>
> Logical Solution:
>
> extern(C) {
> testFunction(extern(D) int function(i
On 04/15/14 13:33, Dicebot wrote:
> On Tuesday, 15 April 2014 at 11:25:14 UTC, Artur Skawina wrote:
>>void iterate(T)()
>>{
>>foreach (index, member; typeof(T.tupleof))
>>{
>>pragma(msg, __traits(identifier, T.tupleof[inde
On 04/15/14 13:30, Andrej Mitrovic wrote:
> On 4/15/14, Artur Skawina wrote:
>> It *is* true. Classes are /reference types/, not references to classes.
>
> I meant the part where he said you can't cast a reference to a pointer. You
> can.
He obviously meant that you can
On 04/14/14 19:51, Andrej Mitrovic wrote:
> On Monday, 14 April 2014 at 17:48:31 UTC, Adam D. Ruppe wrote:
>> On Monday, 14 April 2014 at 17:45:52 UTC, Ryan Voots wrote:
>>> src/yage/core/misc.d(164): Error: e2ir: cannot cast this of type S to type
>>> void*
>>
>>
>> Try taking the address of this
On 04/15/14 12:45, Dicebot wrote:
> void iterate(T)()
> {
> foreach (index, member; T.init.tupleof)
> {
> pragma(msg, __traits(identifier, T.tupleof[index]));
> }
> }
>
> struct A
> {
> int a, b, c;
> }
>
> void main()
> {
> iterate!A();
> }
>
> Reason why you can't n
On 04/08/14 14:35, Mike wrote:
> On Tuesday, 8 April 2014 at 11:56:43 UTC, ketmar wrote:
>>> I understand that. But why is dest[] = src[] not good enough for run-time?
>> 'cause some compilers (gcc, for example) has memcpy() as 'intrinsic' and
>> generates better inline code for it sometimes. it'
On 04/07/14 22:58, Joseph Rushton Wakeling wrote:
> On 05/04/14 02:18, Artur Skawina wrote:
>> Not portably, as it will be libc and/or allocator specific.
>
> I think that's fine. I would be using it in circumstances where it's nice to
> have if I can get it, not a
On 04/05/14 21:51, Timon Gehr wrote:
> On 04/05/2014 11:53 AM, bearophile wrote:
>> John Colvin:
>>
>>> I think there's an argument that this should work, on the grounds that
>>> the context pointer is just another argument and therefore the lambda
>>> can be weakly pure.
>>
>> Was this discussed i
On 04/05/14 00:54, Joseph Rushton Wakeling wrote:
> Hello all,
>
> If we change the length of a dynamic array using the normal GC-based methods,
> e.g. by setting the array's .length property, we find that the array's
> capacity typically does not simply equal the length, but some greater value;
On 03/30/14 15:36, Jack Applegame wrote:
> Wraper structure again. Is there solution without it?
No. D only allows op overloading in structs/unions/classes, so
one of those will be necessary. The simpliest solution would be
something like:
class C {
int elementsAccessor(size_t index) { .
On 03/29/14 20:01, CJS wrote:
> I've been using a medium-sized C library. Most of the library calls look
> something like
>
> action(context, arg1, arg2)
>
> Where is the name of the library, action is the action to take, and
> context is an opaque pointer defined by the library to kee
On 03/29/14 18:30, Timon Gehr wrote:
>
> I'm stuck with 2.060 myself, but there's always http://dpaste.dzfl.pl/.
For the examples, I used a gdc that claims __VERSION__==2062L.
(for /real/ code I'm still using a 2.057 based one...)
artur
On 03/29/14 16:31, Timon Gehr wrote:
> On 03/29/2014 01:37 AM, Artur Skawina wrote:
>> You can wrap the range in a common one. When the above approach isn't
>> enough, there's always the next level:
>
> (Note that your code does not actually compile.)
Of course i
On 03/28/14 23:10, H. S. Teoh wrote:
> On Fri, Mar 28, 2014 at 10:44:11PM +0100, Artur Skawina wrote:
>> On 03/28/14 20:00, H. S. Teoh wrote:
>>> Today I ran into an interesting situation where I have a function f
>>> that needs to return ranges of different types (but
On 03/28/14 20:00, H. S. Teoh wrote:
> Today I ran into an interesting situation where I have a function f that
> needs to return ranges of different types (but identical element types):
>
> auto f(A...)(A args) {
> ...
> if (someCondition)
>
On 02/22/14 18:22, andrea9940 wrote:
> I was trying to get my vector struct to use extensively references for
> passing parameters and I found a subtle bug which make me lose a few hour.
>
> A sample code that shows the bug is here http://pastebin.com/rvcNdjAE (fails
> with dmd 2.064 on linux)
>
On 02/21/14 18:57, Uranuz wrote:
> 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 variad
On 01/25/14 16:38, Johannes Pfau wrote:
> Is it possible to generate a enum from a tuple of types without string
> mixins?
>
> struct S(Types...)
> {
> enum Tag
> {
> //?
> }
> }
>
>
> where the tag enum should have Types.length members. The exact name
On 01/05/14 15:36, TheFlyingFiddle wrote:
> Another simple example that have helped me tremendously when debugging OpenGL
> calls. A simple dispatcher that checks glGetError after every call.
>
> struct GL
> {
> auto opDispatch(string name, Args...)(Args args)
> {
> enum glName =
On 12/27/13 15:13, Artur Skawina wrote:
>struct MyInotifyEvent(size_t BS) {
> inotify_event event;
> char[BS] buffer;
> alias event this;
>}
>[...]
>enum bufsiz = inotify_event.sizeof + PATH_MAX + 1;
>auto event = cast(MyInotifyEve
On 12/27/13 14:28, David Eagen wrote:
> I had trouble getting the file name from the event. I think it's because the
> inotify module has name defined as char[0]. So I did this, which prints the
> name by using the extra data beyond the inotify_event struct itself:
>
>
> void* buf = GC.mall
On 12/27/13 04:23, David Eagen wrote:
> void main()
> {
> string filename="aaa";
>
> int inotfd = inotify_init();
> int watch_desc = inotify_add_watch(inotfd, toStringz(filename),
> IN_MODIFY);
>
> size_t bufsiz = inotify_event.sizeof + PATH_MAX + 1;
> inotify_event* event =
On 12/25/13 15:07, Dejan Lekic wrote:
>> You could also do some neat stuff with opDispatch. Someone
>> actually
>> wrote an article about using it with roman numerals:
>> http://idorobots.org/2012/03/04/romans-rubies-and-the-d/
>
> The idea is actually brilliant. :)
> I think I may use it in the
On 12/23/13 19:30, Mike Wey wrote:
> On 12/22/2013 10:00 PM, Artur Skawina wrote:
>> On 12/22/13 20:21, Mike Wey wrote:
>>> On 12/22/2013 03:36 PM, Russel Winder wrote:
>>>>
>>>> Python now uses the reflection approach to providing a Python binding to
>
On 12/22/13 20:21, Mike Wey wrote:
> On 12/22/2013 03:36 PM, Russel Winder wrote:
>>
>> Python now uses the reflection approach to providing a Python binding to
>> the API: PyGTK has given way to PyGobject. Has the PyGobject approach
>> been rejected for GtkD staying with the PyGtk approach?
>
> I
On 10/15/13 10:03, DoctorCaptain wrote:
> If what I am asking is unclear, I will be more than happy to
> explain in a different way. I tried to be simultaneously as
> succinct and as comprehensive as possible with what the issue is.
I'm not sure what exactly you're trying to do, but...
The issue
On 10/13/13 16:43, Benjamin Thaut wrote:
> Am 10.10.2013 17:45, schrieb Namespace:
>> On Thursday, 10 October 2013 at 15:15:45 UTC, bearophile wrote:
>>> Namespace:
>>>
You mean like this?
void foo(T)(extern(C) void function(T*) func) {
}
That print
On 10/13/13 02:25, luminousone wrote:
> On Saturday, 12 October 2013 at 23:48:56 UTC, Artur Skawina wrote:
>>template isBaseOf(BASE, C) {
>> enum isBaseOf = {
>> static if (is(C S == super))
>> foreach (A; S)
>>
1 - 100 of 297 matches
Mail list logo