I'm having difficulty understanding how templates operate as
function parameters.
Say I have this:
struct ArrayTest {
void arrayTest(T) (T arrayT) {
writeln(arrayT);
}
}
unittest {
ArrayTest test;
float farray[] = [
0.5f, 0.5f,
On Sunday, 16 August 2015 at 01:51:36 UTC, Adam D. Ruppe wrote:
On Sunday, 16 August 2015 at 01:39:54 UTC, DarthCthulhu wrote:
How would one store the Property objects in the
PropertyCollection?
You don't, not like that anyway. The attach call is the ruin of
it. If it was all one definition,
Say I want to do something like:
Propertery!int pi = 42;
PropertyCollection pc;
pc.attach(Life_and_Everything, pi);
assert(pc.Life_and_Everything == 42);
Property!string ps = Hello World;
pc.attach(text, ps);
assert(pc.text == Hello World);
How would one store the Property objects in the
This is more a theoretical exercise than specific code nitty
gritty, but...
Let's say I have some code like this:
class World {
// Bunch of members and other functions
void happyDay () {
if (bCthulhuRises) {
debug(logging) {
On Friday, 14 August 2015 at 12:40:08 UTC, Steven Schveighoffer
wrote:
I would do it this way:
// at module level
debug(logging) {
Logger logger;
static this() { logger = new Logger;}
}
If you want to have the logger be global, add 'shared' to both
the logger and the static this.
On Friday, 14 August 2015 at 23:17:44 UTC, Tofu Ninja wrote:
On Friday, 14 August 2015 at 22:25:15 UTC, DarthCthulhu wrote:
Ahh, that is a much cleaner way to do it rather than using a
singleton.
By 'module level', I assume you mean in the module that
defines the Logger class? An 'import
On Wednesday, 12 August 2015 at 05:26:33 UTC, JN wrote:
You need a vertex and a fragment shader. You can't render
anything in OGL3 without shaders.
I thought that was the case, but the tutorial I was looking at
didn't have any shaders at that point. I added a shader program.
Also, you
So I decided to try some OGL3 stuff in D utilizing the Derelict
bindings and SDL. Creating an SDL-OGL window worked fine, but I'm
having trouble with doing the most basic thing of rendering a
triangle. I get the window just fine and the screen is being
properly cleared and buffered, but no
On Saturday, 8 August 2015 at 15:57:15 UTC, Binarydepth wrote:
Here's what happens :
How many elements need to be used? 5
Input the element : 1 1
Input the element : 1 2
Input the element : 1 3
Input the element : 1 4
Input the element : 1 5
How many positions do you wish to rotate ? 3
The
Okay, so, I decided to scrap the BinaryHeap version of the
priority queue, going back to basics and utilizing a simple
array. It works, huzzah!
Code:
module data_structures.priority_queue;
import std.array;
import std.range: assumeSorted;
import std.typecons: Tuple;
/*
Templated
On Wednesday, 5 August 2015 at 09:04:54 UTC, Nordlöw wrote:
On Wednesday, 5 August 2015 at 01:02:56 UTC, DarthCthulhu wrote:
I must be doing something really stupid here, but I have no
clue what it is. Anyone know?
For functional behaviour I prefer a postblit that duplicates
the underlying
So I've just gotten into D and decided to have a go at creating
something relatively simple to get my feet wet: a priority queue.
Seemed like a simple enough thing, right? It's a pretty basic
data structure, it can't possibly be THAT difficult, right?
First, I tried using associative arrays
On Wednesday, 5 August 2015 at 01:27:53 UTC, Steven Schveighoffer
wrote:
On 8/4/15 9:02 PM, DarthCthulhu wrote:
writefln(PQ: %s, pq.queue); - prints PQ: [Tuple!(int,
string)(3,
HELLO3), Tuple!(int, string)(10, HELLO10), Tuple!(int,
string)(11,
HELLO11)]
This is probably consuming your
On Wednesday, 5 August 2015 at 02:26:48 UTC, Meta wrote:
On Wednesday, 5 August 2015 at 01:27:53 UTC, Steven
Schveighoffer wrote:
On 8/4/15 9:02 PM, DarthCthulhu wrote:
writefln(PQ: %s, pq.queue); - prints PQ: [Tuple!(int,
string)(3,
HELLO3), Tuple!(int, string)(10, HELLO10), Tuple!(int,
14 matches
Mail list logo