I asked this question earlier. I am intrigued by std::set but I have another confusing scenario.
Namely, is the following code legal, portable c++ for T=std::vector and T=std::set:
template <typename T>
void remove_elements(T& collection, int removal_value)
{
typename T::iterator new_end =
std::remove(collection.begin(), c...
I have a C++ DLL with code like this:
LogMessage( "Hello world" );
try {
throw new int;
} catch( int* e ) {
LogMessage( "Caught exception" );
delete e;
}
LogMessage( "Done" );
This DLL is loaded by some third-party application and the code above is invoked. The problem is only the first LogMessage is invoked - even though ...
Do you know any good resources/articles/examples of boost::fusion library usage?
Boost Fusion looks extremely interesting, I think I understand how it works and how to use the basics, but I'm looking for some resources that show any interesting usage/practices e.g. articles or blogs (apart from boost.org itself).
...
Dears,
I'm developing a Mahjong-solitaire solver and so far, I'm doing pretty good. However,
it is not so fast as I would like it to be so I'm asking for any additional optimization
techniques you guys might know of.
All the tiles are known from the layouts, but the solution isn't. At the moment, I have few
rules which guarantee safe r...
Hello all,
For a program of mine I made a small function to clear the various std::vectors of pointers that I have.
template <class S>
void clearPtrVector(std::vector<S*> &a,int size)
{
for(size_t i = 0; i < size; i++)
delete a[i];
a.clear();
}
I must have done something wrong here though since when calling this fun...
I need to remove the sorting arrow from a column header. This can be done by calling set_sort_indicator(false) on the column.
The arrow isn't displayed, but the space for it seems to still be reserved. If the title of the column is big enough to fill all the header, the last part is clipped (where the arrow should be).
Is there a way ...
Static code analysis tool in MSVS (for C++) has plenty of false positives, and some of them are in Windows SDK files. Is there a way to configure it in order to improve quality and ignore stable SDK files?
...
Hey Stack Overflow folks,
I am about to start a project for university to build a procedural city for a pre existing project.
I was wondering if any of you have had any experience coding L-Systems before and know a good place for me to start out. I have done a bit of work before using procedural methods and Perlin Noise and fBm so i get ...
Is it possible to handle this event in some way?
What happens in terms of stack unwinding and deallocation of static/global objects?
...
Firstly: I am totally a newbie for this kind of work.
I have a USB rndis device driver for some hardware only working in XP/2000/Vista. But I want to port this to CE or Linux, and vendor also says that developer should do that.
In summary, I have XP drivers and Interface/End point configurations the driver has. And I have two questions...
Hello, I have linux c++ multithreaded application. Now it's tested on production servers and have segfault. Problem is that I cannot reproduce that error on any of my test servers and have no access to production servers. I have no dump or any other useful information. Only line:
segfault at 0000000046bf0fb8 rip 000000000048ac6b rsp 0000...
While debugging crash in a multithreaded application I finally located the problem in this statement:
CSingleLock(&m_criticalSection, TRUE);
Notice that it is creating an unnamed object of CSingleLock class and hence the critical section object gets unlocked immediately after this statement. This is obviously not what the coder wanted...
I'm in the need of monitoring IIs (v6) events.
More specifically the application pool and Web Site events. Is there some API or WMI instrumentation to do this? This is not from an application perpective, but from an adminsitration perspective.
I am not interested in starting, stopping or recycling programmatically. I'm interested in ...
I'm trying to access a member structs variables, but I can't seem to get the syntax right.
The two compile errors pr. access are:
error C2274: 'function-style cast' : illegal as right side of '.' operator
error C2228: left of '.otherdata' must have class/struct/union
I have tried various changes, but none successful.
#include <iostream...
I'm trying to use templates to get std:list of items, where each item has a pointer to the list which contains it, but I keep hitting a compiler message.
Here's a very stripped down version of the code.
template <class E> class Item
{
public:
E* owner; // pointer to list that owns us.
};
template <class E> class BaseList: p...
Besides just the CDT what do you find essential for c development using eclipse?
...
There are various ways of exiting a process:
e.g.: ExitProcess, ExitThread (from the main thread), exit, abort, return from main, terminate.
I'd like to know the effects each method has on static/global/automatic object destruction.
For example, I have a project that crashes (probably due to some deallocation error) when ExitProcess i...
I want to create a structure which contains a list of same structure like this.
#include <list>
struct Url
{
CString strUrl;
std::list<Url> children;
};
void main()
{
Url u1, u2;
u1.children.push_back(u2);
}
This code is not compiling. But when I replace std::list with std::vector it is working fine. How can I make th...
I have a GUI application, which listens to a network port from a second thread. I was looking at OpenMP and I was wondering if there are easy ways to create threads like this. I was searching for documentation, but the OpenMP site is not very convenient to navigate. Could someone help?
...
I found an interesting article from HP website. They wrote a TouchSmart Shell application, and it allows other applications to embed in that shell, and run as a separate process. Of course, HP defined some restrictions with the embedded application. I don’t know if C++ and Win32 can do similar thing?
http://www.touchsmartcommunity.com/ar...