Hi, i have code like below.
Base is the base class and D1, D2, D3 are derived classes.
D1, D2 and D3 class objects can hold int, float and double values respectively.
I have a vector of base class pointers. Each one of them can point to any of the derived class objects.
Through Base class pointer i should be able to get the data present ...
Hi, I have a UTF-8 string (created an std::string from a byte array)
I understand that the encoding means that the size()/length() won't give me the actual number of glyphs if the text is chinese for instance...
I understand that in order to get the unicode character code of each glyph I need to convert it to wstring (or any UTF>8 repres...
I just started programming in C++, and I've tried to create 2 classes where one will contain the other.
File A.h:
#ifndef _A_h
#define _A_h
class A{
public:
A(int id);
private:
int _id;
B _b; // HERE I GET A COMPILATION ERROR: B does not name a type
};
#endif
File A.cpp:
#include "A.h"
#include "B.h...
Okay, so long weekend away with Macbook I started making an asset loader for 2D game platforms, its working fine in xcode, but when I got home and tried and load it up on Windows I get a debug error.
Essentially what is happening is that the first call to the iterator works? the second doesn't, but only on the second attempt at calling ...
In a complex library that uses templated expressions, and the Curiously Recursive Template Pattern (CRTP), I need some overloaded operators to be specialized with base classes, but operations involving their derived classes are not finding the base-class specialization.
Ie:
if an operator is defined for BaseA< T > + BaseA< T >, then c...
The problem with SAPI 5 is that I can't find any free Portuguese (Brazilian) voices; plus, I need to distribute the speech engine along with my program, so the paid alternatives would be way too much expensive.
Is there any way that I can use and distribute the SAPI 4 engine and voices and make it work in Windows Vista and Windows 7?
...
First of all, I know there are excellent implementations (Qt, Boost, cpp-event, etc.), but I ask the question because I want to know how it works !
If I understand correctly, the "event system" uses the Observer pattern : some objects are observing, waiting for something to happen... and some others send signals. All right.
So, let's s...
I'm initially building an index-like mechanism, read each line of the textfile using getline, checking if it matches a known header declaration (string.compare) and saving the tellg position as an index to that point.
My intention is then to use seekg(index,ios::beg) to seek to the place in the file where the header is.
After reading th...
My server and client are running on the same machine so I dont have endian issues etc. I need something that works on both vc++ and g++ and possibly the simplest way. What can I send the struct with?
Edit
struct Info
{
int** fields;
char** field_names;
};
...
Hi,
I want to place some widgets in a parent widget in some random places, like one button at Point (10,10) and another at (15,40),etc. How to achieve this. QGridLayout is pushing everything into row column style. But I want to put the widgets whereever I want,Can anybody help me?
...
Hi all,
I have a C\C++ code that receives a structure over the network, from this form:
struct DataStruct
{
int DataLen;
BYTE* Data;
}
The code I have runs over Data in a loop of DataLen times and processes the data.
...The problem:
After the code came to security experts for penetration tests, they prepared a fake application whic...
Question: Is there a more effective way to compare data bytewise than using the comparison
operator of the c++ list container?
I have to compare [large? 10kByte < size < 500kByte] amounts of data bytewise, to verify the integrity of external storage devices.
Therefore I read files bytewise and store the values in a list of unsigned cha...
i'm looking for a ready-made grammar and parser for php (at least 5.2), ideally an utility/library that can parse php code into a readable AST, e.g. xml. The parser itself doesn't have to be written in php, the source language doesn't matter much.
...
My supposedly deterministic program produces one of a few slightly different outputs on different runs. The input, compiler and computer are unchanging. I'm not sure which output is right because it always looks reasonable.
Besides a stray call to rand(), how could this be possible?
...
Possible Duplicates:
Program/algorithm to find the time complexity of any given program.
Programmatically obtaining Big-O efficiency of code
Hi, i am eager to develop a function(say computeComplexity()) which can determine the time complexity and space complexity of any algorithm(say bubbleSort()).
Usage of computeComplexit...
Hi,
Is it safe to use one standard compliant STL in a library, and another in a project that uses that library? For example:
//library.h
#include <string> //let's say here it uses minGW STL
void Foo(std::string& str_mingw);
//library.cpp
void Foo(std::string& str_mingw) { /*do something*/ }
//application.cpp
#include "library.h...
i am creating a software using C++ and QT,and i have two widget one of type QRadioButon and one QTabWidget. My need is that i want to send signal from a radio button and i want that whenever the button is checked the content of tab get changed.
Can anyone suggest how to do that? I tried creating a slot of my widget class and in that slot...
So my question is how to send some comands or input from one (c++) program to another if hi is on hidden mode? For example I want to open some text file in notepad with function WinExec("notepad", 0); and than want to print conetent of file, I make handle to that file, make sendinput with CTRL+P, and the window of printig show up,.... I ...
I am using the Qt script engine in my application as an alternative way for the user to access its functionality. As such, I export some C++ classes to the Qt ScriptEngine, that will serve as the interface to the application. The problem is, these C++ classes can throw exceptions.
I have a "ScriptInterface" class running on its own thr...
I have some code that looks like this:
std::set<int> s1, s2, out;
// ... s1 and s2 are populated ...
std::set_intersection(s1.begin(), s1.end(),
s2.begin(), s2.end(),
std::inserter(out, out.end()));
I've read inserts can be done in amortized constant time if the value being inserted to the...