Type: Posts; User: Richard.J
Search took 0.04 seconds.
November 19th, 2015, 02:29 AM
Well, I know a bit about virtual destructors. What I don't understand is how a class that wraps an iterator influences the destruction of the map. How are these things related?
November 18th, 2015, 05:50 AM
I am playing around with 'type erasure' (see these links: https://akrzemi1.wordpress.com/2013/11/18/type-erasure-part-i/, http://www.artima.com/cppsource/type_erasure2.html).
For this purpose, I...
October 30th, 2015, 03:25 AM
The first thing I can spot is that both of your for-loops only end when the loop variable overflows, i.e. primecount is alsways <= 8 until it wraps from -2147483648 to 2147483647 and vice versa for...
October 20th, 2015, 08:41 AM
Well, if you just use the pointer to store a reference to the 'parent' class, you must not delete it. Otherwise, in the CreateSessInfo destructor you would delete your object containing the...
October 20th, 2015, 08:16 AM
You don't show where pClassInstance1 and pClassInstance2 are created (using new).
If they are created inside CClass/DedBearerInfo, then you have to delete them in the destructor. You might be better...
June 29th, 2015, 04:28 AM
Do you mean
return boost::shared_ptr<AStarPath>(new AStarPath(from, transitions, totalCost));
June 24th, 2015, 02:41 AM
std::set expects operator< to be defined for AABB. Either provide that or create the std::set<AABB, customCompare>...
Lookup "relational operators" here:...
But most of all: you have started a question, got no replies, then edited your original post and replaced your question with a completely different one. You are here long enough to know that this is...
Why are you posting the same errorneous code you've presented to us here: http://forums.codeguru.com/showthread.php?549529-I-m-having-problems-configuring-my-template-class?
You should at least have...
April 9th, 2015, 02:33 AM
for (int i = h1.size() - 1; i < 0; i--)
is wrong. Your loop is never executed because "i < 0" is false. It should read
for (int i = h1.size() - 1; i >= 0; i--)
March 8th, 2015, 07:40 AM
Inside your add method, you are trying to do
but vec is a std::vector, which doesn't provide a has method.
March 7th, 2015, 01:35 PM
Use 'template' instead of 'Template'. C/C++ is case-sensitive.
January 23rd, 2015, 04:16 AM
What exception do you get?
And why do you use 'new' for the file_mapping and mapped_region?
January 13th, 2015, 09:19 AM
Thanks for correcting me, 2kaud.
I just did a quick google without further reading when I spotted conio.h.
January 13th, 2015, 02:20 AM
for clrscr/gotoxy, you need to
and for this:
file_ptr = fopen ( "C:\dict.anu", "r" );
January 10th, 2015, 11:35 AM
The online documentation of WSAStartup says
"An application must call the WSACleanup function for every successful time the WSAStartup function is called. "...
January 6th, 2015, 04:23 PM
I am not sure if I understand correctly.
Say you have
int *p = new int;
This leaves you with a default initialised array which may contain any value, depending on the compiler, doesn't...
January 6th, 2015, 02:47 PM
not called "value initialisation" as opposed to "default initialisation" which, for POD types, does nothing at all?
December 30th, 2014, 01:51 PM
Since the connect() call is done on the loopback address, the socket may seem to be connected immediately. I guess you would see a different behaviour using two different machines.
I googled this:...
November 27th, 2014, 05:29 AM
Disabling exception handling (if/where possible) may save you another 8-10%.
November 14th, 2014, 02:37 AM
if( (master_socket = socket(AF_INET , SOCK_STREAM , 0)) == 0)
creates a TCP socket, not an UDP one. Later on, you bind that socket to an address and listen on it.
UDP sockets work a...
September 29th, 2014, 02:30 AM
If position is > vector.size(), the vector will throw an out_of_range exception.
August 6th, 2014, 08:12 AM
It looks like your server is only listening on "127.0.0.1". You need to listen on any available address, or at least on a network address reachable from the outside.
This leaves you with a memory leak. The new Worker object is a temporary object you can never delete. Since you are not using it anyway, your method could be defined like this
template<class T> ...
Apart from what OReubens suggested, I recommend not to return a raw pointer to the object, but a smart pointer. This relieves the caller of createObject from the question of the ownership of the...
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!