template <class T>
class container
{
typedef list<T> ObjectList;
public:
~container ()
{
for (typename ObjectList::iterator item = _Container.begin(); item != _Container.end(); item++)
{
if (*item)
delete (*item)
}
}
}
how can i free the container items by ...
I am trying to use boost threads in a project having common language runtime support. I get the following linker error. error LNK2022: metadata operation failed (8013119F) : A TypeRef exists which should, but does not, have a corresponding TypeDef: (dummy): (0x01000073).
If i comment the line instantiating the boost thread, i do not get...
I know this is a valid c++ program.
What is the point of the throw in the function declarement? AFAIK it does nothing and isnt used for anything.
#include <exception>
void func() throw(std::exception) { }
int main() { return 0; }
...
I am trying to get some C++ code originally written in Microsoft Visual Studio (VS) 2003 to compile under VS 2008 and I am having trouble finding an efficient solution to assigning a vector::iterator to the beginning of a char array. I know that iterators went from being a defined as a simple pointer type (T*) to a class type between VS...
I have a Linux System V IPC shared memory segment that is populated by one process and read by many others. All the processes use interface to the shared memory segment in the form of a class which takes care of looking up, attaching, and detaching to the segment as part of its constructor/destructor methods.
The problem here is that...
I have a VC++ project (2005) that generates both 32-bit and 64-bit dlls. The 32-bit dll is 1044 KB whereas the 64-bit version is 1620 KB. I'm curious why the size is so large. Is it just because of the larger address size, or is there a compiler option that I'm missing?
...
Hello,
I am currently implementing a timer/callback system using Don Clugston's fastdelegates. (see http://www.codeproject.com/KB/cpp/FastDelegate.aspx)
Here is the starting code:
struct TimerContext
{
};
void free_func( TimerContext* )
{
}
struct Foo
{
void member_func( TimerContext* )
{
}
};
Foo f;
MulticastDelegate< ...
So, the C++ standard requires that class members be initialized in the order in which they are declared in the class, rather than the order that they're mentioned in any constructor's initializer list. However, this doesn't imply anything about the order in which the arguments to those initializations are evaluated. I'm working with a sy...
I have a network client with a request method that takes a std::streambuf*. This method is implemented by boost::iostreams::copy-ing it to a custom std::streambuf-derived class that knows how to write the data to a network API, which works great. This means I can stream a file into the request without any need to read it all into memor...
I want to pass a big char* from cpp to .Net (preferably using COM).
What is the best way (in terms of memory)?
If I use CComBSTR it takes a lot of memory both when creating the BSTR in CPP and especially when moving it to .Net inside the COM call.
...
I am including a complicated project as a library in C++ using Visual Studio 2008.
I have a set of include files that are scattered throughout a very complicated directory tree structure. The root of the tree has around ten directories, and then each directory could have multiple subdirectories, subsubdirectories, etc.
I know that a...
Hey All,
I asked this question on the Google Group but I think I will get a faster response on here.
I'm trying to use Google's Mocking framework to test my code. I am also utilizing their test framework as well. I'm compiling in VC9.
I'm having issues matching arguments that are MFC\ATL CStrings. GMock
says the objects are not equal ...
There are several resources out there that explain how the sandbox in Chrome works and what it does to protect users from malicious code.
Chromium Blog
Chromium Developer Documentation
Sandbox FAQ
That's great, and I like the OS-centric design that they have in place (somewhat of a "The OS probably knows how to secure itself better t...
I am writting a small piece of code exercising policy-based template programming. In this program, a CDecayer class is defined and it uses DecayerPolicy as its policy class. However the compiler complained that " expected `;' before ‘it’ " about the CDecayer part . Any suggestions?
#include <iostream>
#include <vector>
#include <map>
#...
What is the best way to detect if a computer on a network is a netapp filer? I have tried some general querying of the computers attributes, but nothing has stuck out.
...
What does this error mean?
Generic.h:25: error: 'Generic' is not a template type
Here's Generic.
template <class T>
class Generic: public QObject, public CFG, public virtual Evaluator {
Q_OBJECT
std::string key_;
std::vector<std::string> layouts_;
std::vector<std::string> static_widgets_;
std::map<std::string, std...
I know its possible to do something like this with Windows:
MessageBox(hWnd, "Yes, No, or Cancel?", "YNCB_YESNOCANCEL);
But how do I react to what the user pressed (like closing the window if they clicked "yes")?
...
I ran into the following problem and cannot decide how to proceed:
I have a class, Reader, getting a chunk of data every 1/T seconds (actually the data is from video frames, 30 frames per second). The chunks are to be passed to several objects, Detectors that process the chunks and output a decision. However, the number of chunks that ...
Hi! I am writing a GUI wrapper for windows api right now ( i can't use qt or mfc ). The library itself is extremely basic. After subclassing windows common controls ( and wrapping them into the classes ) i have faced a problem. As far as i know (and i hope i am wrong), only parent control can handle a message like WM_CTLCOLOREDIT and the...
Hi,
A while ago I read the Debugging Windows Programs book, and one of the tricks that it talked about extensively was calling functions from the Visual C++ debugger (quick)watch window.
As luck would have it, I don't have a copy on hand and the little documentation that I could find about this is really really poor.
So how DO you call ...