phobos Questions
2
A really interesting conference was given about D-Specific Design Patterns and in the D community, some people thought it could be a starting point for a book dealing about effective coding techniq...
1
Solved
Here's simple code:
import std.algorithm;
import std.array;
import std.file;
void main(string[] args)
{
auto t = args[1].readText()
.splitter('\n')
.split("---")
;
}
Looks like it should wo...
2
Solved
How to construct easily a raw byte-by-byte InputRange/ForwardRange/RandomAccessRange from a file?
1
Solved
I'm about to write a parser to read a text file line by line into structs of different types and giving these structs to a callback (observer or visitor - not sure yet).
The text file contains MT-...
2
Solved
I've just begun looking at the phobos source, and it's littered with several different styles and commented out code.
The style guide on the web side is very small, and I only found broken links f...
Monicamonie asked 13/8, 2010 at 20:12
1
Solved
1
Solved
I repeadetly need to concatenate of format strings, and is wondering what is the shortest (or easiest to read) way to concatenate strings outside of the writefln() function, in D?
That is, I like ...
8
Solved
I've decided to learn D, and I'm wondering which standard library I should use. Should I use Phobos or Tango? What are the pros and cons of each?
1
Solved
I'm trying to use the slice operator to obtain a slice of the return value of the take function from std.range. My code:
auto tempChunk = ['a', 'b', 'c', 'd'];
auto a = tempChunk.take(3);
writeln(...
1
Solved
I try to compile following code:
import std.algorithm;
void main()
{
string[] x = ["ab", "cd", "ef"]; // 'string' is same as 'immutable(char)[]'
string space = " ";
char z = joiner( x, space )....
4
Solved
Whenever I try to use ranges in D, I fail miserably.
What is the proper way to use ranges in D? (See inline comments for my confusion.)
void print(R)(/* ref? auto ref? neither? */ R r)
{
foreach...
3
Solved
If I import the std.c libaries instead of including the libraries in C, would C code compile with a D compiler, or are there other backwords compatibility issues?
Linkwork asked 2/6, 2012 at 16:21
3
Solved
How in D would I cast integer to string?
Something like
int i = 15
string message = "Value of 'i' is " ~ toString(i); // cast(string) i - also does not work
Google brought me the answer on how ...
1
Solved
I am trying to make a pure function that embeds a number in a string. The obvious concatenation methods do not work:
pure string foo(immutable int bar)
{
return "Number: " ~ bar; // Error: string...
Olli asked 4/2, 2012 at 21:39
4
Solved
I was fishing around in D's standard library looking for a Set implementation, and I only found these:
BinaryHeap
RedBlackTree
These both would work fine, if I could only figure out how to use th...
Calumnious asked 11/12, 2011 at 1:41
1
Solved
I'm making my own little library of handy functions and I'm trying to follow Phobos's naming convention but I'm getting really confused. How do I know where things would fit?
Example:
If there was ...
2
Solved
The D documentation seems to be a bit messy, and I'm not able to find this information anywhere on the official site. I'm needing some common exception types (e.g. NotFiniteNumberException, FileIOE...
2
Solved
Is there a simple, cross-platform way to get a single keystroke in D2 using Phobos?
For instance, a "Press any key to continue..." prompt, or a Brainfuck interpreter.
All the methods I've tried...
2
Solved
Is there any one-size-fits-all (more or less) way to read a text file in D?
The requirement is that the function would auto-detect the encoding and give me the entire data of the file in a consist...
1
Solved
Is it just me, or is there no binary search function in Phobos? I have a pre-sorted array that I want to search with my own comparator function, but I can't find anything in std.algorithms or std.c...
Oloughlin asked 7/1, 2011 at 3:54
3
Solved
I'm learning D, and am confused by an error I'm getting.
Consider the following:
module helloworld;
import std.stdio;
import std.perf;
ptrdiff_t main( string[] args )
{
auto t = new Performanc...
Plausible asked 23/10, 2010 at 22:2
2
Solved
Why does Phobos use enum to define constants? For example, in std.math:
enum real E = 2.7182818284590452354L;
Why not use a global immutable? What are the advantages/disadvantages of enum over i...
6
Solved
I'm wondering how mature and stable D is, and if it might be a good replacement for C/C++.
I know that there are currently two standard libraries (Phobos and Tango). Is it still the case that ther...
4
Solved
There are two of them Phobos and Tango.
As far as I know they are redundant and incompatible.
Are there any plans to join them?
If so, when will it happen?
Holbein asked 21/4, 2009 at 15:25
1
© 2022 - 2024 — McMap. All rights reserved.