Consider the following class definition:
class StrToTokens {
StrToTokens(const char* str, const char* delimiters = "\t\r\n"); //constructor
string getNextToken();
void reset();
bool empty();
}
Can someone list some good testcases to test the above class.
A few I could think of are:
empty string, empty delimiters, repeated del...
Guys in one of excersises (ch.5,e.8) from TC++PL Bjarne asks to do following:
'"Run some tests to see if your compiler really generates equivalent code for iteration using pointers and iteration using indexing. If different degrees of optimization can be requested, see if and how that affects the quality of the generated code"'
Any ...
I am developing window application in that I am having 2 child windows on left and right side.
I want to handle input events for both windows separately.
How to achieve it?
My code:
class EditorWindow : public DxWindow
{
public:
CSplitterWindow m_vSplit;
CPaneContainer m_lPane;
CPaneContainer m_rPane;
PropertyDialog m...
When we use SEH with __finally block,
if we do return in __try block, it causes a local unwind.
To Local unwind, the system need to approximately 1000 instructions.
The local unwind causes a warning C6242. MSDN suggests using __leave keyword(with saving a return value).
But I don't think it's a good idea.
If we use __leave keyword, the...
This problem is exercising our minds very much at the moment.
XULRunner https://developer.mozilla.org/en/XULRunner
Trixul Cross-Platform GUI Toolkit http://www.trixul.com/
...
Hey all!
I show my code first, then I explain my problem:
...
// somewhere in the constructor
progressBar = new QProgressBar(this);
progressBar->setMinimum(0);
progressBar->setMaximum(100);
...
connect(
...
void MainWindow::updateProgressBar(int bytesSent, int total)
{
progressBar->setMaximum(total);
pr...
Say I have an object:
struct Foo
{
int bar_;
Foo(int bar) bar_(bar) {}
};
and I have an STL container that contains Foos, perhaps a vector, and I take
// Elsewhere...
vector<Foo> vec;
vec.push_back(Foo(4));
int *p = &(vec[0].bar_)
This is a terrible idea, right?
The reason is that vector is going to be storing its el...
I have a custom class that uses boost mutexes and locks like this (only relevant parts):
template<class T> class FFTBuf
{
public:
FFTBuf();
[...]
void lock();
void unlock();
private:
T *_dst;
int _siglen;
int _processed_sums;
int _expected_sums;
int _assign...
explicit list(
const A& Al = A( )
);
explicit list(
size_type n,
const T& v = T( ),
const A& Al = A( )
);
list(
const list& x
);
list(
const_iterator First,
const_iterator Last,
const A& Al = A( )
);
...
Hello everyone,
I'm currently developing a simple application that displays map and draws some markers on it. I'm developing for Windows Mobile, so I decided to use DirectDraw and Imaging interfaces to make the application fast and pretty. The map moves when user moves finger on the touchscreen, so the whole map moving/scrolling animati...
hi
I want to execute an exe file which is written in VC++.net 2008 in a computer which has windows xp and has not .net framework and none of c++ libraries.
but when i run the file i get this error:
This application has failed to start because the application configuration is incorrect....
I want a way to put all dependency together to...
Into a class constructor, I need to create some objects on the fly and add them to a vector. Here is my code:
ContainerClass::ContainerClass() {
for (int i = 0; i < limit; i++)
elements.push_back(SubElement());
}
Is this the same thing with new SubElement()? Do I still need to free those SubElement() objects into the Containe...
I am a big fan of GCC, but recently I noticed a vague anomaly. Using __gnu_cxx::__normal_iterator (ie, the most common iterator type used in libstdc++, the C++ STL) it is possible to refer to an arbitrary memory location and even change its value without causing an exception! Is this expected behavior? If so, isn't a security loophole?
...
I have a program that implements several heuristic search algorithms and several domains, designed to experimentally evaluate the various algorithms. The program is written in C++, built using the GNU toolchain, and run on a 64-bit Ubuntu system. When I run my experiments, I use bash's ulimit command to limit the amount of virtual memo...
hello everyone, total newbie is here :)
i have this header file, zeeheader.h, and i wrote some classes in it, i'm having problems giving a string as a parameter to one of the functions:
class DeliTest
{
public:
void DeliCheck(Stack*,string);
void ComCheck (unsigned,string);
bool EofCheck (unsigned,string);
};
as i was i...
so I have this executable which takes values from a joystick and outputs those values (i have the code). I want to pass those values to a dll, which is read in a program (i have the code for the dll). how can I pass those values from the exe to the dll?
...
Hi,
I'm tearing my hair out trying to solve this one, any insights will be much appreciated:
I have a C++ exe which acquires data from some hardware in the main thread and processes it in another thread (thread 2).
I use a c++ dll to supply some data processing functions which are called from thread 2.
I have a requirement to make ano...
I am currently in a collage second level programing course... We are working on operator overloading... to do this we are to rebuild the vector class...
I was building the class and found that most of it is based on the [] operator. When I was trying to implement the + operator I run into a weird error that my professor has not seen bef...
I'm coming to C++ from a .Net background. Knowing how to use the Standard C++ Libraries, and all the syntax, I've never ventured further. Now I'm looking learning a bit more, such as what libraries are commonly used? I want to start getting into Threading but have no idea to start. Is there a library (similar to how .net has System.Th...
Is this the right way to return an object from a function?
Car getCar(string model, int year) {
Car c(model, year);
return c;
}
void displayCar(Car &car) {
cout << car.getModel() << ", " << car.getYear() << endl;
}
displayCar(getCar("Honda", 1999));
I'm getting an error, "taking address of temporary". Should I use this way:...