If I create a std::vector with the default allocator like this:
vector<int> myVec = vector<int>();
myVec.push_back(3);
myVec.push_back(5);
myVec.push_back(8);
Does the vector then store the actual data internally into an array of int? Is it possible to get a pointer to this array and iterate directly over it using this pointer?
...
I have some boolean expressions to evaluate and process. Maybe this would have all been better with Boost, but I'm still learning STL and didn't go that way. I'm now learning about iterator validation, or INvalidation as the case may be. Is there a way to insert a new element into this nested vector below safely? If you don't want t...
I talked to my instructor the other day and asked him this question. He told me that I could go for smaller projects, but I'm starting a chess program and I was wondering what Stack Overflow thinks about this issue. Should I include all headers into one file, or separate them?
...
I'm trying to make a pointer point to a 2D array of pointers. what is the syntax and how would i access elements.
...
The project I work on has recently been switched from a horribly antiquated revision control system to Subversion. I felt like I had a fairly good understanding of Subversion a few years ago, but once I learned about Mercurial, I forgot about Subversion quickly.
My question is targeted at those who work with a sizable number (15+) deve...
The code below deletes the symbol associated with the stock object just fine. Its just bad object oriented design.
The way that i am searching for each stock symbol is by using a != or == test for NULL.
bool hashmap::remove(char const * const symbol, stock &s,
int& symbolHash, int& hashIndex, int& usedIndex)
{
if ( isAdded == 0 ) ...
Is it good to define a new macro that craters my need of showing failed assertion to user and with just enough information for developers to debug the issue.
Message for user, what the
user should do with this message at last information for the developer
#define ASSERT(f) \
do \
{ \
if (!(f) && AfxAssertFailedLine(T...
May I know is there any way to determine parent class from boost::any?
#include <iostream>
#include <boost/any.hpp>
class a {
public:
virtual ~a() {}
};
class b : public a {
};
bool is_class_a(const boost::any& any)
{
return boost::any_cast<a>(&any) != 0;
}
bool is_class_a_v2(const boost::any& any)
{
try
{
bo...
I'm using boost::filesystem for cross-platform path manipulation, but this breaks down when calls need to be made down into interfaces I don't control that won't accept UTF-8. For example when using the Windows API, I need to convert to UTF-16, and then call the wide-string version of whatever function I was about to call, and then conve...
My Questions is
Is there any regular expression engine which do Just-In-Time compiling during regex pattern parsing and use when matching/replacing the texts? or where can I learn JIT for i386 or x64 architecture?
Why I need that is,
I recently trying to benchmark python's built-in regex engine with normal C codes with around 10M da...
Hello! So my goal is to make a function that has a partially filled array of characters as a formal parameter and deletes all repeated letters from the array. So I just need to read a .txt file with it's contents as something like "11 A B C a b c a A g g t " and have the program spit back out "A B C a b c g t"
As of now my program spits...
I have a dll that i created using C++ and for a reason my dll should be placed in the GAC.
for all other dll's created with managed code, i sign them and drop them in the GAC, how can i do the same with the c++ dll?
Thanks for your quick help.
...
Hi,I want to write a server using a pool of worker threads and an IO completion port. The server should processes and forwards messages between multiple clients. The 'per client' data is in a class ClientContext. Data between instances of this class are exchanged using the worker threads. I think this is a typical scenario.
However, I h...
My boss asks me to create a dll file using C++. The dll file needs to do the following:
create a blank area in Window
create some simple shapes (for an
example, a rectangle) on the blank
area
control the locations of the shapes
in the blank area
I am new to C++, so please correct me if my understand is incorrect
Dll is a binary file,...
Hi,
I'd like to use the autorepeat feature of the QToolButton class.
The problem is that the instances are created automatically when using QToolBar::addAction() and I can't find a way to reach them: QToolBar::widgetForAction() doesn't seem to work in that case (always returns NULL).
Any ideas?
Thanks
...
I'm trying to make a bowling game simulation for college. Any ideas where to find a decent tutorial in DirectX9, using ode-0.9 and c++?
...
Everywhere I look there are people who argue vociferously that uninitialised variables are bad and I certainly agree and understand why - however; my question is, are there occasions when you would not want to do this?
For example, take the code:
char arrBuffer[1024] = { '\0' };
Does NULLing the entire array create a performance impa...
In my early days of programming, before I started working professionally, I wrote a fair share of trinket/exercise apps in C++ and felt fairly confident that I know the language. Then, as opportunity came, I went to do real work and left the C/C++ world. For the past 5 years I've written tons of code in C# and have had scarcely any encou...
Hi,
I used a ActiveXControl in a C# Forms application and had the possibility to implement a PreviewKeyDown event handler for that ActiveXControl. That was needed to specify that, e.g. the [ALT] key, is an input key.
For some reasons or other I have to reimplement the application in native C++/MFC and don't know how to specify that th...