Thanks. It's working. Seems like either it was the drawing code
or the setting one of the setup conditions.
On Tuesday, 26 December 2017 at 20:21:11 UTC, Adam D. Ruppe wrote:
On Tuesday, 26 December 2017 at 19:41:47 UTC, rumbu wrote:
"Custom" is a templated struct. I cannot imagine all the
instantiations of Custom to write template specialisations for
each of them.
You can specialize on templated
Ah, so it's about lvalues an rvalues, not the type of the range.
Makes sense now.
On Tuesday, 26 December 2017 at 22:33:54 UTC, WebFreak001 wrote:
BigEndian is default btw, you don't need to specify that but
you can if you want.
Dealing with Endianness bugs has been such a pain, I like to be
On Tuesday, 26 December 2017 at 21:45:29 UTC, Dennis wrote:
I was trying to translate this kind of C code to D:
void calc(unsigned char *buf) {
(...)
res = read_u32_be([i]);
}
So I tried this:
import std.bitmanip : read, Endian;
void calc(ubyte[] buf) {
(...)
res = read!(uint,
I was trying to translate this kind of C code to D:
void calc(unsigned char *buf) {
(...)
res = read_u32_be([i]);
}
So I tried this:
import std.bitmanip : read, Endian;
void calc(ubyte[] buf) {
(...)
res = read!(uint, Endian.bigEndian)(buf[i..$]);
}
But then I get this error:
template
On Tuesday, 26 December 2017 at 19:41:47 UTC, rumbu wrote:
"Custom" is a templated struct. I cannot imagine all the
instantiations of Custom to write template specialisations for
each of them.
You can specialize on templated structs generically.
int foo(T : Bar!(X, Y), X, Y)
that kind of
On Tuesday, 26 December 2017 at 16:15:55 UTC, Adam D. Ruppe wrote:
The mistake you're making is using a constraint when you should
try a specialization:
int signbit(T:Custom)(T x)
{
return 0;
}
That means to use this specialized function when T is Custom.
Now, you just need to merge
On Tuesday, 26 December 2017 at 15:37:12 UTC, Marc wrote:
I do build a string by coping large parts of diffrent buffers,
all those buffers live after the functional call, so rather
than duplicate those string I'd like to copy only references to
those parts rather duplicate every string. I
On Tuesday, 26 December 2017 at 07:57:02 UTC, Amorphorious wrote:
I've played around with various settings but either I get
nothing or 2D. Any idea what I might be missing?
so i have barely actually done any 3d stuff myself but the one
time I did, the function I used was here actually,
The mistake you're making is using a constraint when you should
try a specialization:
int signbit(T:Custom)(T x)
{
return 0;
}
That means to use this specialized function when T is Custom.
Now, you just need to merge the overload sets:
import std.math;
alias signbit =
On Tuesday, 26 December 2017 at 15:56:19 UTC, Vino wrote:
Hi All,
What is the difference between std.algorithm.reduce and
mir.ndslice.algorithm.reduce.
From,
Vino.B
Mir's reduce works on Slices whereas Phobos's reduce works on
Arrays/Ranges.
See also:
Hi All,
What is the difference between std.algorithm.reduce and
mir.ndslice.algorithm.reduce.
From,
Vino.B
Is there anyway to extend an existing function to accept custom
data types?
Option 1 - global import of std.math
import std.math;
struct Custom {}
int signbit(T)(T x) if (is(T == Custom))
{
return 0;
}
Custom c;
assert(signbit(c) == 0);
assert(signbit(-1.0) == 1);
I do build a string by coping large parts of diffrent buffers,
all those buffers live after the functional call, so rather than
duplicate those string I'd like to copy only references to those
parts rather duplicate every string. I combined appender!string,
assumeUnique() and array slices.
of course a totally different approach to solve this is welcome,
I came from C/C++/C# worlds so I'm in the process of slowly
converting my thinking to the D way (which is new for me, since
I'm even unifamiliar with python and such, which got such
friendly syntax)
On Tuesday, 26 December 2017 at 00:17:33 UTC, Mike Franklin wrote:
After a few hours trying to figure out why the compiler didn't
catch this, I finally figured it out. You have to add `@safe`.
import std.stdio;
int[] x;
void func(scope int[] a) @safe
{
x = a;
}
void main() @safe {
On Friday, 22 December 2017 at 09:52:26 UTC, Chris Katko wrote:
DMD can use -profile and -profile=gc. But I tried for HOURS to
find the equivalent for LDC and came up with only
profile-guided optimization--which I don't believe I want. Yet,
if we can get PGO... where's the PROFILE itself it's
On Monday, 25 December 2017 at 22:58:50 UTC, David Nadlinger
wrote:
On Monday, 25 December 2017 at 20:39:52 UTC, Mengu wrote:
is partially applying templates possible?
Check out std.meta.Apply{Left, Right}.
— David
thanks a lot mr. smith & david.
On Tuesday, 26 December 2017 at 00:47:14 UTC, Marc wrote:
something like this:
struct S {
// variables...
string doGen(int n) { return ""; }
alias gen = memoize!doGen;
}
The error I got is:
Error: need 'this' for 'doGen' of type 'string(int n)'
I can't make doGen static because it
Hi Adam, I'm interested in using your simpledisplay for 3D in
openGL. I have worked with 2D fine but 3D is problemattic. I
cannot get any depth even though i have set up 3D mode by
modifying gamehelpers:
SimpleWindow create2dWindow(int width = 512, int height = 512,
int viewportWidth=512,
20 matches
Mail list logo