On Wednesday, 29 July 2015 at 19:10:36 UTC, Adam D. Ruppe wrote:
On Sunday, 26 July 2015 at 12:16:30 UTC, Joseph Rushton
Wakeling wrote:
My aim by contrast is to _allow_ that kind of use, but render
the original handle empty when it's done.
I don't think D offers any way to do that. With the d
On Wednesday, 15 July 2015 at 21:57:50 UTC, badlink wrote:
Hello, I can't figure how to write a template function that
accept either strings or array of strings.
This is my current code:
bool hasItemParent(T)(const(char)[] itemId, const(T)[] parentId)
if (is(typeof(T) == char) || (isArray!T &&
On Tuesday, 7 July 2015 at 03:30:40 UTC, Rikki Cattermole wrote:
On 7/07/2015 1:05 p.m., Vlad Levenfeld wrote:
How do I ddoc an enum constant? Putting ddoc comments above
functions
and structs woorks fine but ddocing an enum constant doesn't
generate
any documentation.
If:
///
enum MyValue
How do I ddoc an enum constant? Putting ddoc comments above
functions and structs woorks fine but ddocing an enum constant
doesn't generate any documentation.
On Sunday, 5 July 2015 at 00:07:59 UTC, Laeeth Isharc wrote:
Posted short write-up here. Please make it better...
http://wiki.dlang.org/Transforming_slice_of_structs_into_struct_of_slices
In John Colvin's solution, should
alias TransformMembers(alias TypeTransform, alias
NameTransform,
Justin Whear pretty much nailed it, I think. What I would really
like to see is some benchmarks.
On Friday, 22 May 2015 at 10:54:36 UTC, Stefan Frijters wrote:
I have a code which does a lot of work on 2D/3D arrays, for
which I use the 2.066 multidimensional slicing syntax through a
fork of the Unstandard package [1].
Many times the order of operations doesn't matter and I thought
I would
On Saturday, 16 May 2015 at 02:08:09 UTC, weaselcat wrote:
On Saturday, 16 May 2015 at 02:06:45 UTC, weaselcat wrote:
very long standing compiler bug
https://issues.dlang.org/show_bug.cgi?id=3051
see also
https://issues.dlang.org/show_bug.cgi?id=5710
unsure if they're duplicate bugs, never re
I think this code should be allowed, but it isn't:
struct Functor (T)
{
T a;
auto ref fmap (alias f)()
{
return Functor (f(a));
}
}
auto ref identity (T)(auto ref T a)
I was wondering if there's a mechanism to make anonymous
templates, e.g.
given:
enum Policy {A, B}
alias List = TypeTuple!(...);
instead of this:
enum has_policy_A (T) = T.policy == Policy.A;
alias Result = Filter!(has_policy_A, List);
use something like this:
Filter!(T => T.policy
On Saturday, 25 April 2015 at 23:51:05 UTC, rcorre wrote:
I ran into this infuriatingly confusing situation just now:
static assert(is(typeof(Parent.init.new Child) ==
Parent.Child)); // fine
alias P = Parent;
alias T = Parent.Child;
static assert(is(typeof(P.init.new T) == T)); // nope!
Wa
On Wednesday, 22 April 2015 at 21:22:43 UTC, Meta wrote:
That makes sense. It seems to me that D has very... special
but effective syntax. I'm having a hard time remembering all
the keywords and expression forms (especially of IsExpression)
but it's definitely a vast improvement over C++'s half
template dimensionality (S) {
template count_dim (uint i = 0) {
static if (is (typeof(S.init.opSlice!i (0,0
enum count_dim = count_dim!(i+1);
else static if (i == 0 && (isInputRange!S || is
(typeof(S.init[0])))
enum count_dim = 1;
else enum count_dim = i;
}
ali
On Tuesday, 21 April 2015 at 19:46:03 UTC, Nordlöw wrote:
On Tuesday, 21 April 2015 at 07:46:03 UTC, Vlad Levenfeld wrote:
Then you throw in some more stuff to detect 1-dimensional
cases.
Could you please elaborate a bit?
Well assuming the type is not multidimensional (does not define
opSli
As an aside, I've put a bit of work into the generic
multidimensional containers problem lately and have an interface
generating library as a result.
https://github.com/evenex/autodata
It's still in the nascent stages but contains a lot of tools for
working with multidimensional structures.
On Tuesday, 21 April 2015 at 08:09:38 UTC, Per Nordlöw wrote:
On Tuesday, 21 April 2015 at 07:46:03 UTC, Vlad Levenfeld wrote:
template dimensionality (S) {
template count_dim (uint i = 0) {
static if (is (typeof(S.init.opSlice!i (0,0
enum count_dim = count_dim!(i+1);
else enum c
On Tuesday, 21 April 2015 at 07:01:27 UTC, Per Nordlöw wrote:
On Tuesday, 21 April 2015 at 06:56:33 UTC, Per Nordlöw wrote:
On Monday, 20 April 2015 at 13:49:41 UTC, John Colvin wrote:
On Thursday, 16 April 2015 at 18:12:35 UTC, Nordlöw wrote:
Is there a way to CT-query the arity of all opIndex
On Wednesday, 15 April 2015 at 16:59:12 UTC, ketmar wrote:
or make "safe" and company "context keywords". along with
"body" (oh, how
i hate the unabilily to declare "body" member!")
Ugh, yeah. Makes physics code awkward.
On Tuesday, 7 April 2015 at 19:17:41 UTC, Márcio Martins wrote:>
Proxy doesn't really help here :(
Nothing will help you get around this. You have to expose a
public member and alias to that. Try wrapping the access in a
public zero-parameter member function.
On Thursday, 2 April 2015 at 19:27:21 UTC, John Colvin wrote:
On Wednesday, 1 April 2015 at 23:29:00 UTC, Vlad Levenfeld
wrote:
On Tuesday, 31 March 2015 at 13:25:47 UTC, John Colvin wrote:
On Tuesday, 31 March 2015 at 12:49:36 UTC, Vlad Levenfeld
wrote:
Is there any way (or could there be any
On Tuesday, 31 March 2015 at 13:25:47 UTC, John Colvin wrote:
On Tuesday, 31 March 2015 at 12:49:36 UTC, Vlad Levenfeld wrote:
Is there any way (or could there be any way, in the future) of
getting the code from lambda expressions as a string?
I've noticed that if I have an error with a lambda
Is there any way (or could there be any way, in the future) of
getting the code from lambda expressions as a string?
I've noticed that if I have an error with a lambda that looks
like, say
x=>x+a
the error message will come up referring to it as
(x) => x + a
so some level of processing h
On Friday, 20 February 2015 at 22:44:35 UTC, ketmar wrote:
can you go with `relationImpl` and mixin/template that generates
`relation` with contract then? something like:
@reflexive @transitive bool relationImpl (T)(T a, T b) { ... }
alias relation = buildWithContracts!relationImpl;
then yo
I'd like to do something like this:
@reflexive @transitive bool relation (T)(T a, T b)
out (result) {
mixin(property_verification!result);
}
body {
...
}
which becomes
out (result) {
// generated from @reflexive
assert (result == skip_contract!relation (b,a));
On Tuesday, 17 February 2015 at 13:55:15 UTC, Dominikus Dittes
Scherkl wrote:
We have rational (two bigint, one for the numerator and one for
the denominator), which I like better than floatingpoint (it's
more expressive).
Yeah, this is probably the best that can be done, since any
arbitrary-
On Tuesday, 17 February 2015 at 14:03:45 UTC, Kagamin wrote:
On Tuesday, 17 February 2015 at 09:08:17 UTC, Vlad Levenfeld
wrote:
For my use case I'm less concerned with absolute resolution
than with preserving the information in the smaller operand
when dealing with large magnitude differences.
On Tuesday, 17 February 2015 at 08:05:49 UTC, Kagamin wrote:
Periodic fractions.
Or transcendental numbers, for that matter, but arbitrary !=
infinite. A max_expansion template parameter could be useful here.
For my use case I'm less concerned with absolute resolution than
with preserving t
We've got arbitrary precision integers, why not arbitrary
precision floating point?
On Tuesday, 10 February 2015 at 04:20:27 UTC, Fyodor Ustinov
wrote:
IMHO even if "it is not a bug, it is a feature" - it should not
be compiled without notice.
WBR,
Fyodor.
Agreed, should be a warning at least.
On Tuesday, 10 February 2015 at 03:59:22 UTC, Rikki Cattermole
wrote:
That's a bug. It should be using the function pointer.
UFCS call should abide by the same scoping rules as anything
else.
https://issues.dlang.org/show_bug.cgi?id=14161
I thought that's how UFCS was explicitly designed? Gl
I'm expecting in this code http://dpaste.dzfl.pl/ee0d3cd31734
either line 8 should not compile, or lines 12 and 14 should have
a totally different output. What's going on?
On Friday, 30 January 2015 at 07:13:09 UTC, Jeremy DeHaan wrote:
That seems strange. I figured that it would be smart enough to
deduce the parameter type based on the type that it was trying
to
be assigned to.
It seems sensible to me, as changing string to auto would leave
the type of the ex
On Friday, 30 January 2015 at 06:35:31 UTC, Jeremy DeHaan wrote:
I have a template fuction that looks like this:
immutable(T)[] getString(T)() const
if (is(T == dchar)||is(T == wchar)||is(T == char))
Basically, I was hoping that the type would be deduced based on
the prameter that was being as
you can always write your own iota replacement, which will do
"[]" and
use ubytes, for example. writing that things is way easier than
in C++.
something like "myIota!ubyte(0, 255)", for example -- to make
it visible
that it emits ubytes.
I think closedInterval!T (T left, T right) would be a
On Thursday, 22 January 2015 at 05:56:40 UTC, tcak wrote:
I want to define alphanumeric characters in an easy way.
Something like that:
char[] arr = ['a'..'z', 'A'..'Z', '0'..'9'];
Though above example doesn't work. Is there any easy way to do
this?
I am trying to do something like EBNF def
I get this all the time with std.array.array (I use my own array
implementations, but phobos' array seems to secretly creep in
everywhere). I think its got to do with that private import
visibility bug (https://issues.dlang.org/show_bug.cgi?id=314 or
https://issues.dlang.org/show_bug.cgi?id=130
That's real weird.
In D:\D\dmd2\src\phobos\std\concurrency.d(13,13)
13,13 isn't a line number
and static assertions should go off during compilation, not
runtime.
On Sunday, 4 January 2015 at 01:02:07 UTC, Matt wrote:
What I mean is that I don't understand what atomicStore,
atomicLoad, etc. actually DO, although in the case of the two
mentioned, I can hazard a pretty good guess. The documentation
doesn't exist to tell me how to use the functions found in
On Saturday, 3 January 2015 at 15:44:16 UTC, Matt wrote:
Right, I've been looking at core.atomic, but it has very little
documentation, and it's territory I haven't explored, yet. Any
chance of some pointers along the way?
Could you be more specific about what you need help
understanding? You
On Friday, 2 January 2015 at 17:39:19 UTC, Matt wrote:
I'm trying to write a small 3D engine, and wanted to place the
physics in a separate thread to the graphics, using events,
possibly std.concurrency, to communicate between them.
How, then, do I pass large amounts of data between threads? I
Laeeth - I am not sure exactly what your needs are but I have a
fairly complete solution for generic multidimensional interfaces
(template-based, bounds checked, RAII-ready, non-integer indices,
the whole shebang) that I have been building. Anyway I don't want
to spam the forum if I've missed the
No luck, unfortunately.
I'm trying to reduce a bug with dub dustmite feature and I must
be doing it wrong somehow, my regular dub output looks like this:
source/experimental.d(2403): Error: struct
experimental.Product!(int[], int[]).Product no size yet for
forward reference
ulong[2]
source/experimental.d(2454):
On Wednesday, 26 November 2014 at 01:35:20 UTC, Joakim wrote:
On Tuesday, 25 November 2014 at 23:08:07 UTC, Vlad Levenfeld
wrote:
On Tuesday, 25 November 2014 at 21:22:24 UTC, Vlad Levenfeld
wrote:
On Windows 7 I have built dmd (using the vcxproj), druntime
(win64.mak) and phobos (win64.mak).
On Tuesday, 25 November 2014 at 21:22:24 UTC, Vlad Levenfeld
wrote:
On Windows 7 I have built dmd (using the vcxproj), druntime
(win64.mak) and phobos (win64.mak).
I went into sc.ini and set the LINKCMD to point to Visual
Studio 12.0's linker.
When I try to compile anything with dmd, I get
On Windows 7 I have built dmd (using the vcxproj), druntime
(win64.mak) and phobos (win64.mak).
I went into sc.ini and set the LINKCMD to point to Visual Studio
12.0's linker.
When I try to compile anything with dmd, I get
LINK : fatal error LNK1181: cannot open input file
'test,,nul,us
Update: I just did a manual cast. Still getting there error.
Here's the new argument lists:
(void**, const(PaStreamParameters*), const(PaStreamParameters*),
double, uint, uint, extern (C) int function(const(void)*, void*,
uint, const(PaStreamCallbackTimeInfo)*, uint, void*), void*)
(void**,
I'm trying to use the portaudio bindings and can't seem to call
Pa_OpenStream, I get this error:
source/pa_test.d(156): Error: function
deimos.portaudio.Pa_OpenStream (void** stream,
const(PaStreamParameters*) inputParameters,
const(PaStreamParameters*) outputParameters, double s
Awesome! These are exactly what I was looking for. Thanks!
I've got a library I've been building up over a few projects, and
I've only ever run it under "debug" "unittest" and "release"
(with dub "buildOptions").
Lately I've needed to control the performance more carefully, but
unfortunately trying to compile with dub --profile gives me some
strange er
On Thursday, 4 September 2014 at 11:43:28 UTC, monarch_dodra
wrote:
*Should* cycle be negatively index-able? Personally, I don't
think so. And even if it could, it has been proven non-size_t
indexing is not well supported at all. It was de-facto chosen
after the "iota-map fiasco" that all range
Thanks for the reply.
And indeed, I recently found that ByLine.empty can't be const
because it writes and removes a character from the stream or
something... and when I compile with optimizations, const empty
gets totally wrecked.
I suppose that making empty const doesn't really gain me
any
I notice that some of the range adapters in std.range (iota,
takeExactly) have a const empty property, while others (take,
retro) don't. This makes maintaining const-correctness downstream
(with my own range adapters atop phobos') more difficult. I'm
wondering if there is a rationale for this,
On Friday, 15 August 2014 at 16:54:54 UTC, Philippe Sigaud wrote:
So I'm trying to use @safe, pure and nothrow.
If I understand correctly Adam Ruppe's Cookbook, by putting
@safe:
pure:
nothrow:
at the beginning of a module, I distribute it on all
definitions, right? Even methods, inner classe
Ok, I've gotten to the bottom of this issue but I'm not totally
sure how to submit a bug report for this (no SSCCE: can't get
dustmite to work on it, and the problem won't show itself when I
use the offending module in isolation) so I will try to sum up
the issue and maybe I can provide some us
I'm compiling with DMD 2.065 using dub, and I've gotten some
undefined reference errors for symbols inside my own project.
Trying to run dustmite doesn't help, it keeps reporting that its
done in one iteration, and gives me an empty results folder. I've
used it before, its pretty straightforwa
On Saturday, 9 August 2014 at 19:26:46 UTC, Meta wrote:
(which is why z[] gives you a type of (int, int, int) instead
of Tuple!(int, int, int)).
That makes sense, and on second thought it wouldn't make sense to
use a tuple as a range because it's not guaranteed to have only
one element type.
I may be misunderstanding the intended semantics of the []
operator but I've come to interpret x[] to mean "give me x as a
range" and this is the meaning I intend when I overload it in my
own structs.
But -
auto z = tuple (1,1,1);
pragma (msg, typeof(z)); // Tuple!(int, int, int)
pragma (msg,
On Saturday, 9 August 2014 at 05:42:09 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
Why would having opDispatch actually generate compile errors
cause
problems for __traits(compiles,...)? __traits(compiles...)
already works
fine with a whole bunch of other non-compiling stuff (by
gagging erro
On Saturday, 9 August 2014 at 10:36:55 UTC, Artur Skawina via
Digitalmars-d-learn wrote:
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
Yep, replacing @property with auto did the trick.
The lack of error messages in opDispatch is frustrating. I
realize that, due to tricks like __traits(compiles,
Foo.testing_for_some_function), having opDispatch stop
compilation if it fails is not going to work, but there's gotta
be some way t
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 Vector (uint length, Element = double)
{
ref @property component (s
Sure, but people keep using them at the module-level, which
really shouldn't be done until the bug is fixed. IMHO, we'd be
better off making it illegal to use selective imports at the
module-level rather than keeping it as-is.
- Jonathan M Davis
I'm curious, what's the problem with it anyway
On Wednesday, 6 August 2014 at 18:33:23 UTC, Dicebot wrote:
Most voted DMD bug :
https://issues.dlang.org/show_bug.cgi?id=314
+1 from me as well.
This is unfortunate. D otherwise has a very comfortable import
system.
Is there any way to make selective imports private? I've got a
name clash from importing an "all" module that has a bunch of
public imports, one of which is circular, it goes sort of like
this:
module math.all;
public:
import geometry;
import vectors;
---
module vectors;
struct Vector {}
On Wednesday, 6 August 2014 at 08:48:25 UTC, John Colvin wrote:
Is there anywhere that describes what Kenji (it was Kenji
wasn't it?) recently implemented for this?
I'm curious about this as well. I've just come across a case
where I need to work with a 2D array of channels*samples from an
an
On Sunday, 3 August 2014 at 21:47:06 UTC, Artur Skawina via
Digitalmars-d-learn wrote:
void sort (R, T = ElementType!R, alias compare = less_than)(R
range, T item)
[should work iff the sort implementation only calls the
predicate]
artur
This works! Thanks!
On Sunday, 3 August 2014 at 21:24:03 UTC, Vlad Levenfeld wrote:
certain data structures I use are not intended to be copied,
.
although these cases are probably better off being compared by
some kind of key rather than directly... so, auto ref isn't
necessary here, it was just something I
On Sunday, 3 August 2014 at 20:10:39 UTC, Martijn Pot wrote:
What is the benefit of 'auto ref' over 'in' as you are changing
a nor b?
Because
less_than (T)(T a, T b)
(or in, or const T) will copy a and b on their way into the
function. Usually this is ok but certain data structures I use
On Sunday, 3 August 2014 at 19:43:53 UTC, anonymous wrote:
If this exact code errors for you, it ... uhh ... could be
platform specific? Are you on Windows?
Debian, and your code works for me. I figured out the problem - I
made less_than to serve as a default sorting predicate, so in a
few pl
On Sunday, 3 August 2014 at 19:26:28 UTC, anonymous wrote:
Works for me with dmd versions back to 2.060. What compiler are
you using?
dmd 2.065
This would make the function always take its argument by
reference. I'm trying to use the feature here:
http://dlang.org/template.html
from the section Function Templates with Auto Ref Parameters
This doesn't work:
bool less_than (T)(auto ref T a, auto ref T b)
{
return a < b;
}
Error: auto can only be used for template function parameters
What am I doing wrong? Is this not a template function?
Yes, I see the problem now. I can't think of any reason why I'd
want to make save anything but a function (especially since
`save` is a verb) but I guess someone out there might have a good
one.
So, what is gained by (inout int = 0) over ()? I wasn't even
aware that giving a default value for
On Thursday, 31 July 2014 at 20:43:11 UTC, bearophile wrote:
Take a look at the asm!
Bye,
bearophile
I use DMD and Dub, how do I view the asm?
I've been having trouble propagating range traits for
range-wrapper structs.
Consider this sample code:
struct Wrapper (R)
{
R range;
static if (isInputRange!R)
{
/* input range stuff */
}
static if (isForwardRange!R)
{
On Tuesday, 29 July 2014 at 15:47:08 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
Maybe we should file an enhancement bug to improve error
reporting for
opDispatch.
I found this https://issues.dlang.org/show_bug.cgi?id=8387
and cast a vote for it.
I've cast a few votes in the bugtracker, do
I have some use cases where I am trying to iterate over a
collection in a pure function. The collection doesn't change, but
the foreach loop body updates a variable elsewhere in the
function body. (I'm reimplementing reduce as pure nothrow, and
the variable in question is the accumulator).
Si
opDispatch behaves as though it has SFINAE. When something fails
in the definition (like I am having now, some of the symbols I
used in it hadn't been imported) there won't ever be an error
message, I just get "Error: no property 'bar' for type 'Foo'"
In one case I had to use static ifs and pr
Yep, just checked in the debugger. So, that's actually a bad
thing, then. Good thing its being deprecated!
A weird thing happened:
I was building a dictionary struct which contains a custom array
of values and a differently-typed custom array of keys. Both of
them implicitly define "clear" by aliasing a backing array.
The dictionary type doesn't have clear, though. And it doesn't
alias anything.
Yes, though the loop unrolling is news to me. I'll have to keep
that in mind next time I'm trying to squeeze some extra
performance out of a loop.
btw, found a static switch enhancement request here:
https://issues.dlang.org/show_bug.cgi?id=6921
I'm just confused about how static while is supposed to work
because static foreach, to my understanding, would have to work
by making a new type for each iteration. I say this because, 1)
runtime foreach works like that (with type => range), and 2)
without ctfe foreach, the only way I know of
On Monday, 21 July 2014 at 19:02:59 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
functionality is desirable. Maybe we should rouse a racket on
the main D
forum to either make staticIota public, or implement static
foreach. ;-)
static switch would be so sick. I frequently find myself doing
s
On Monday, 21 July 2014 at 01:29:40 UTC, Daniel Gibson wrote:
Am 21.07.2014 03:05, schrieb Vlad Levenfeld:
Thats real weird that it would reject your "i" variable, given
that
T.length is known at compile time. I think this is a bug. I
can get your
code to compile if I change your foreach loop
Thats real weird that it would reject your "i" variable, given
that T.length is known at compile time. I think this is a bug. I
can get your code to compile if I change your foreach loop to
this:
foreach(i, U; T)
modTuple[i] = transTupleElem(argTuple[i]); // ok
On Sunday, 20 July 2014 at 15:45:37 UTC, Atila Neves wrote:
On Thursday, 17 July 2014 at 22:52:37 UTC, Justin Whear wrote:
On Thu, 17 Jul 2014 22:49:30 +, Nordlöw wrote:
AFAIK there is no compile-time variant of interfaces right?
Why is that?
Wouldn't it be nice to say something like
On Sunday, 20 July 2014 at 08:29:55 UTC, Jonathan M Davis wrote:
What you will probably need to do is to not try and use the
same type as both shared and non-shared if it has a destructor.
Unfortunately this option would require an unrealistic lot of
refactoring for me. I'm basically using thi
I have a Resource struct that is supposed to free some memory
when it gets destroyed. Unfortunately, I can't define a
destructor. If I do, the compiler complains that it can't destroy
the shared versions. If I define a shared destructor, the
compiler complains that it can't disambiguate between
Recently I had a bug where the compiler got stuck in an infinite
loop or something. I managed to bracket it with static if (0) and
it turned out that I had intended to declare a template method
auto ref foo (Bar)() {...}
but accidentally left off the function parameters
auto ref foo (Bar) {..
Thanks! Between the -deps flag and duml I think this is exactly
what I need.
On Saturday, 5 July 2014 at 17:17:03 UTC, quakkels wrote:
try SomeClass (T): BaseClass
Not sure which line you want me to change. I don't want
SomeClass to inherit from BaseClass. Rather, I want T to be
restricted to classes that inherit from BaseClass.
When I change `class SomeClass(T : Ba
On Saturday, 5 July 2014 at 16:47:32 UTC, quakkels wrote:
I'm going through Adam Wilson's talk 'C# to D' and I've gotten
hung up by one of his examples regarding generic programming in
D. Specifically, I'm trying to implement the code example found
here: http://youtu.be/6_xdfSVRrKo?t=16m44s.
A colleague of mine had asked me if I could produce some kind of
object/module dependency type of graph for a D project I've got.
I'm not sure what these are called but I've seen them before for
inheritance hierarchies in C++ projects. (I don't tend to use
inheritance so I suspect something exa
The reason it worked one time and not the other was because the
other time was an exception, not an assertion. How do I break on
exceptions?
(ps. is there a guide anywhere to using GDB with D?)
Ah yes I never noticed that "in" was in the binary op table. In
my defense, searching for "in" usually yields too many results to
be useful. Thanks to everyone for your help!
On Wednesday, 2 July 2014 at 14:14:57 UTC, Dicebot wrote:
struct S
{
int opIn_r(int key)
{
return key*2;
}
}
void main()
{
assert((42 in S.init) == 84);
}
Thanks! I wonder, why the _r and lack of documentation?
Is this possible?
The documentation for std.container lists "in" as an operator in
the container API but only associative arrays actually seem to
support it.
How did you allocate your array? The GC has the APPENDABLE
attribute special for memory blocks that are going to be used
as slices:
I allocated with new T[n]. I've tried allocating with both the
APPENDABLE and NO_SCAN blocks but beyond a certain allocation
size this doesn't work, I get a repo
Thanks for your replies. The article was quite helpful in
clarifying some questions I had.
I decided to benchmark the different append methods (with
["releaseMode", "inline", "noBoundsCheck", "optimize"]) by
appending 10,000 elements to arrays with
~=,
Appender,
with and without first r
1 - 100 of 138 matches
Mail list logo