Re: Containers and arrays with custom memory allocators

2017-10-19 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 14:14:19 UTC, Ivan wrote: Hi, I am a C/C++ programmer interested in using D as a replacement for C/C++. I do care a lot about performance and memory management, so I want to use my own (or from std.experimental) memory allocators. Are there any good tutorials o

Re: Containers and arrays with custom memory allocators

2017-10-19 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 19 October 2017 at 08:47:09 UTC, Per Nordlöw wrote: explicit via .dup member and when you want to copy or pass by should be: explicit via .dup member and when you want to _move_ from one l-value to another l-value or pass by move

Re: Containers and arrays with custom memory allocators

2017-10-19 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 19 October 2017 at 08:47:09 UTC, Per Nordlöw wrote: The file hashmap.d provides both a HashSet and HashMap implementation in one go using D's compile-time-code-branching-mechanism `static if`. Correction: I've now broken it up into - https://github.com/nordlow/phobos-next/blob/

Re: Containers and arrays with custom memory allocators

2017-10-19 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 19 October 2017 at 08:47:09 UTC, Per Nordlöw wrote: These are all very performant containers, but currently lack support for std.experimental.allocator. Support for std.experimental.allocator is planned but currently not a priority. EMSI-containers have an elegant integration and

Re: How do I convert a LPVOID (void*) to string?

2017-10-19 Thread Igor via Digitalmars-d-learn
On Monday, 16 October 2017 at 22:54:32 UTC, Adam D. Ruppe wrote: On Monday, 16 October 2017 at 21:48:35 UTC, Nieto wrote: How do I convert/create a D string from LPVOID (void*)? There is no one answer to this, but for the specific function are are looking at, the ALLOCATE_BUFFER argument mean

Re: How do I convert a LPVOID (void*) to string?

2017-10-19 Thread Kagamin via Digitalmars-d-learn
string GetLastErrorMessage() { wchar* lpMsgBuf; DWORD errorMessageID = GetLastError(); uint len=FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NUL

Re: How do I convert a LPVOID (void*) to string?

2017-10-19 Thread Mike Parker via Digitalmars-d-learn
On Monday, 16 October 2017 at 21:48:35 UTC, Nieto wrote: How do I convert/create a D string from LPVOID (void*)? string GetLastErrorMessage() { LPVOID lpMsgBuf; DWORD errorMessageID = GetLastError(); FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER |

Static if on release build

2017-10-19 Thread Fra Mecca via Digitalmars-d-learn
I can't find any documentation regarding conditional compilation in release and debug mode. I have read the page regarding the topicon dlang.org but adding the snippet below makes no difference when compiling with dub -b release { version(full) { //do something } else { //do something else }

Re: Static if on release build

2017-10-19 Thread bauss via Digitalmars-d-learn
On Friday, 20 October 2017 at 02:36:37 UTC, Fra Mecca wrote: I can't find any documentation regarding conditional compilation in release and debug mode. I have read the page regarding the topicon dlang.org but adding the snippet below makes no difference when compiling with dub -b release {

Re: Static if on release build

2017-10-19 Thread rikki cattermole via Digitalmars-d-learn
On 20/10/2017 3:36 AM, Fra Mecca wrote: I can't find any documentation regarding conditional compilation in release and debug mode. I have read the page regarding the topicon dlang.org but adding the snippet below makes no difference when compiling with dub -b release { version(full) {  //do

Re: Static if on release build

2017-10-19 Thread b4s1l3 via Digitalmars-d-learn
On Friday, 20 October 2017 at 02:36:37 UTC, Fra Mecca wrote: I can't find any documentation regarding conditional compilation in release and debug mode. I have read the page regarding the topicon dlang.org but adding the snippet below makes no difference when compiling with dub -b release {