Search:
Type: Posts; User: monarch_dodra
Search:
Search took 0.18 seconds.
-
August 3rd, 2016, 11:38 AM
That works, but the issue (I had) remains that we (I) can't extract "Args" back out from function_ptr (or signature).
I've been able to extract the "T", but how do you implement operator()?
...
-
August 2nd, 2016, 01:19 PM
So, have you had much luck on your end finding a better solution?
I'm pretty sure there could be ways for you to define the template in the form:
function<std::function<args>, actual_function>...
-
July 29th, 2016, 09:56 AM
Alternatively, you could use something such as function_traits to extract the arguments of your function pointer directly.
-
July 29th, 2016, 09:27 AM
The issue is that you can only use "(void)" at syntax level, for C compatibility. But inside templates, you are way past that phase, and the compiler will not accept passing the *actual* void type.
...
-
July 24th, 2016, 09:14 AM
Why not just use UUIDs?
The advantage of UUID is there is no need to try to track consistency. You don't have to worry about threads, races, or multiple machines generating ids.
Either that, or...
-
July 21st, 2016, 06:42 AM
As you wrote, you can read and write to a binary stream via the read and write functions.
Just iterate over the vector, and write all elements 1 by 1. Same thing for reading back: just insert the...
-
July 18th, 2016, 07:27 AM
Or alternatively, just return the pointer:
unsigned short *alloc_mem()
{
unsigned short *input = (unsigned short *)calloc(SIZE, sizeof(unsigned short));
input[0]=0xAABB;...
-
June 19th, 2016, 11:05 AM
If you don't store the height of a subtree in their corresponding root node, you are going to have catastrophic (insertion) performance. Right now, the calculation of the tree's height is O(n) where...
-
Typically, everything is "freed", but not necessarily "cleanly". Files may not be flushed, temporary lock files may not be deleted, termination signals may not be sent etc...
-
I wouldn't really agree. When an allocation fails, there isn't really anything you can do about it most of the time, and are usually better off just letting the exception propagate.
In particular,...
-
Not to rant or anything, but you are close to 900 threads here over a span of 6 years. Surely you should know how to use a map by now? It's a super basic question, and one you've already asked too:...
-
+1 for find
auto it = window.find(currentWindow);
if (it != window.end()) {
...
}
-
MPI is Message Passing Interface. It's a way of doing "multithreading" where threads communicate by sending messages to each other. Usually, these threads do not share any memory at all, which means...
-
FWIW, I've found that the issue with not using getline is that it often (wrongly) succeeds with badly structured files. You 'll sometimes end up reading data from multiple lines at once and/or...
-
I believe the original goal was to get this working for sparse matrix implementations?
-
April 20th, 2016, 05:31 AM
Debugger depends a lot on what IDE you are using. But most IDEs have debugging integrated and work pretty much the same way. You first click on a line number, which will set a little red dot there,...
-
April 5th, 2016, 12:11 PM
This is the correct way to do it. Your pointer indeed gets trashed, but that's OK, since you are also returning a copy, so your reference count does not drop to 0 (unless your compiler implements...
-
April 3rd, 2016, 01:28 PM
If the double free/delete don't get you first ;)
-
April 2nd, 2016, 07:25 AM
This approach creates binary bloat, and increases compile times. What you want to do is merely use the template interface to forward to a non-template interface.
But even then, things like c++17's...
-
April 2nd, 2016, 03:50 AM
you have non-matching signatures:
void rightShiftElements (int arr[], int N);
vs
void rightShiftElements (int arr[], int N, int M)
Also, you are calling it with the wrong name:
shiftright(...
-
March 28th, 2016, 03:13 PM
No, that's wrong. That's A's (copy) constructor's job. By the time B's copy constructor is running, A is fully built and initialized. B cannot initialize A's fields.
The only thing B's copy...
-
March 28th, 2016, 10:16 AM
Also, just looked at your code again: One of the main points of a doubly linked list is backwards iteration and being able to access the last element easily. You should NOT be walking your list to...
-
March 28th, 2016, 10:14 AM
I'd suggest you start by having a Node constructor that at the very least initializes your fields for you (especially the pointers). Better yet, use C++11's member initialiser.
Anyways, a "pro...
-
March 28th, 2016, 09:43 AM
hash_combine does hashing of whatever it is passed, so
hash_combine(seed, k.x); should be fine.
Regarding your original question: How exactly are you clearing the map, and how are you populating...
-
March 12th, 2016, 11:40 AM
This is not accurate. mem_ob is not a "member object". It is just a local object that will be destroyed at the end of the scope of the constructor. What you want is:
class MemTr {
private:...
|
Click Here to Expand Forum to Full Width
|