Could anyone please tell me how to check what number I've got from a * b? Which is I would like to know every part of this number so for example if the result from this expression would be 25 I would like to know that first digit is two and second digit is five.
...
Hi there dear gurus and expert coders.
i am not gonna start with im a newbie and don't know much about image programming but unfortunately those are the facts :(
I am trying to display an image from a bitmap pointer *ImageData which is of resolution
1392x1032. I am trying to draw that at an area of resolution or size 627x474.
However,...
Is there in the STL or in Boost a set of generic simple comparison functions?
The one I found are always requiring template parameters, and/or instantiation of a
struct template.
I'm looking for something with a syntax like :
if ( is_equal(x,y) )
{
...
}
Which could be implemented as :
template <typename T>
bool is_equal(const ...
Does wx provide a handy way to get anything like this in a platform-independent way? I don't think C++ libs themselves provide anything.
I don't have a definite idea what should be used for the unique ID... MAC address is common but what else could be used?
If we were doing it Windows-specific, is there a way to get the actual Windows ...
Hi!
How do I call a method of an object which is stored within a vector? The following code fails...
ClassA* class_derived_a = new ClassDerivedA;
ClassA* class_another_a = new ClassAnotherDerivedA;
vector<ClassA*> test_vector;
test_vector.push_back(class_derived_a);
test_vector.push_back(class_another_a);
for (vecto...
I have to write a program in C++ and I haven't used this laugauge before.
I know how to write it in Java or C#, but I should write it in C++!
The code should read a text file (I do this step) and then print the output in a specific format using the array (I don't now how to do this step)
For example:
The file has the following:
Task ...
I have to maintain some legacy codes,parts of it look like the following:
/* this class reads a ini file which looks like this:
key = value
*/
class Config{
// ..
public:
string conf(const char* key)
{
vector<string> v;
//..
v = func(); //this function returns a vector<string>
return v[...
How can I compile poppler 0.13.3 using Visual Studio 2008, and with QT4 support? I want to use poppler as a static lib.
Can anyone help, or has anyone done this?
Thanks
...
Hi,
if I have a function template with typename T, where the compiler can set the type by itself, I do not have to write the type explicitely when I call the function like:
template < typename T >
T min( T v1, T v2 ) {
return ( v1 < v2 ) ? v1: v2;
}
int i1 = 1, i2 = 2; int i3 = min( i1, i2 ); //no explicit <type>
but if I have a ...
To implement reference counting we use an IUnknown-like interface and a smart pointer template class. The interface has implementation for all the reference-count methods, including Release():
void IUnknownLike::Release()
{
if( --refCount == 0 ) {
delete this;
}
}
The smart pointer template class has a copy constructor an...
Hi,
What does address operator mean.
say in the method below.
what should be passed in the method as parameter value of integer or the address of an integer variable.
void func1(int&)// method declaration
void func1(int& inNumber)//method definition
{
//some code
}
...
Is there a tool, macro or plugin that can generate a method or function body automatically from a declaration in a header file?
I have tried Intellisense and Refactor! 3.0.5 which both only seem to work with C#.
...
I want to be able to do the following:
I have an array of strings that contain data types:
string DataTypeValues[20] = {"char", "unsigned char", "short", "int"};
Then later, I would like to create a variable of one of the data types at runtime. I won't know at compile time what the correct data type should be.
So for example, if at...
Hello,
I have constructed a map and loaded it with data. If I iterate over all the elements I see they are all valid. However, the find method doesn't find my item. I'm sure it's something stupid I am doing. Here is snippet:
// definitions
// I am inserting a person class and using the firstname as the key
typedef std::map<char*,Per...
Hi,
Lets say I have the following class:
class BritneySpears
{
public:
int getValue() { return m_value; };
private:
int m_value;
};
Which is an external library (that I can't change). I obviously can't change the value of m_value, only read it. Even subclassing BritneySpears won't work.
What if I define the following ...
Hi,
When push_back method of vector is called the previous object in the vector is getting destroyed what might be the reason for this.
template<typename type> void SomeList<type>::AddElement(type &inObject)
{
pList.push_back(inObject);// pList is member of my class Vector SomeList
}
...
Hello everyone!
I am writing a high-score sub-routine for a text-based game. Here's what I have so far.
void Game::loadHiScores(string filename)
{
fstream hiscores(filename.c_str()); // what flags are needed?
int score;
string name;
Score temp;
if (hiscores.is_open())
{
for (size_t i = 0; i < TOTAL_HISC...
I have a C++ program that takes user input for fopen in order to initiate a file write. Could someone help me find a function which will return a FILE* and use the Windows specific version of mkdir in order to create the folder structure for fopen to never fail to open a new file in the specified location because one of the folders does ...
Hi!
I'm currently coding a small API to project thing onto a dome. To play video i use ffmpeg inside my display class (the core of the API).
When i compile a project ( I'm using kdevelop) with the .cpp and .h containing my class, the project work perfectly.
But i would like to made my class a .so for easy sharing and use.
I compile e...
Hi,
according to this question:
http://stackoverflow.com/questions/2833730/calling-template-function-without-type-inference
the round function I will use in the future now looks like:
template < typename TOut, typename TIn >
TOut roundTo( TIn value ) {
return static_cast<TOut>( value + 0.5 );
}
double d = 1.54;
int i = rountTo<...