What packages do you use to handle command line options, settings and config files?
I'm looking for something that reads user-defined options from the command line and/or from config files.
The options (settings) should be dividable into different groups, so that I can pass different (subsets of) options to different objects in my co...
I've edited original text to save potential readers some time and health. Maybe someone will actually use this.
I know it's basic stuff. Probably like very, very basic.
How to get all possible combinations of given set.
E.g.
string set = "abc";
I expect to get:
a b c aa ab ac aaa aab aac aba abb abc aca acb acc baa bab ...
and the lis...
Hi all,
I am developing a small app under Linux using the CodeBlocks IDE.
I have defined a class with the following code:
class CRenderContext
{
public: /*instance methods*/
CRenderContext() :
m_iWidth(0), m_iHeight(0),
m_iX(0), m_iY(0),
m_bFullScreen(false), m_bShowPointer(false)...
class Foo {
public:
Foo() { do_something = &Foo::func_x; }
int (Foo::*do_something)(int); // function pointer to class member function
void setFunc(bool e) { do_something = e ? &Foo::func_x : &Foo::func_y; }
private:
int func_x(int m) { return m *= 5; }
int func_y(int n) { return n *= 6; }
};
int
main()
{
Fo...
How do I pass this instance as a parameter into a function?
class
{
public:
void foo();
} bar;
Do I have to name the class?
It is copyable since I haven't made the class's copy ctor private.
So how is it possible if at all?
...
I know that pointers store the address of the value that they point to, but if you display the value of a pointer directly to the screen, you get a hexadecimal number. If the number is exactly what the pointer stores, then when saying
pA = pB; //both are pointers
you're copying the address. Then wouldn't there be a bigger overhead t...
I have a vector that stores pointers to many objects instantiated dynamically, and I'm trying to iterate through the vector and remove certain elements (remove from vector and destroy object), but I'm having trouble. Here's what it looks like:
vector<Entity*> Entities;
/* Fill vector here */
vector<Entity*>::iterator it;
...
Hi,
I have 2 C++ DLLs. One of them contains the following function:
void init(const unsigned char* initData, const unsigned char* key)
The other one contains this function:
BYTE* encrypt(BYTE *inOut, UINT inputSize, BYTE *secretKey, UINT secretKeySize).
Is there a way to call these 2 functions from C#? I know you can use [DllImpor...
Hello,
I'm currently working on a TCP socket server in C++; and I'm trying to figure out how I can ignore all browser connections made to my server. Any idea's?
Thanks.
...
hi guys please help me with this function
i got this example from my book, but i have no idea how to actually call the ticket function
this is the code:
#include <iostream>
class Manager {
public:
template<typename T>
friend int ticket() {
return ++Manager::counter;
}
...
I've got a c++ application with certain items in a queue, those items then are going to be processed by a python script. I want it so that at maximum 10 instances of the python script are running. I plan on using execl() to launch the python process, Is there a way to tell that the process has quit without having to pass a message back t...
I want to be able to templatize a class on a member function without needing to repeat the arguments of the member function -- i e, derive them automatically.
I know how to do this if I name the class based on how many arguments the function takes, but I want to derive that as well.
Something like this, although this doesn't work (at le...
I read in a book that C++ provides additional operators to the usual &,|, and ! which are "and","or" and "not" respectively, plus they come with automatic short circuiting properties where applicable. I would like to use these operators in my code but for some reason the compiler interprets them as identifiers whenever i use them and thr...
My VC++ solution includes two projects, an application (exe) and a static library.
Both compile fine, but fail to link. I'm getting an "unresolved external symbol" error for each function from the static lib I use. They look like this:
MyApplication.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl MySt...
I'm getting an undefined reference to one private methods in a class. Here is a short snippet of the code (but the whole thing currently is in one source file and not separated into header and source files).
#include <iostream>
using namespace std;
struct node
{
int key_value;
node *left;
node *right;
};
class btree
{
...
I have learned c++ about three years and I have not used c++ in an actual project. I only used it to write some small program and example, I have read many books about c++ and algorithm, "c++ primer", "effective c++" "exceptional c++" "c++ common knowledge" " introduction to algorithm" ..., so I want to use it in an open source project t...
I am working on making an expression class:
template<typename T, typename U>
class expression
{
public:
expression(T vala, U valb, oper o){val1 = vala; val2 = valb; op = o;}
operator bool{return(val1 op val2);}
private:
T val1;
U val2;
oper op;
};
as you can see, this is somewhat pseudocode, because I need an opera...
I have been working with the Boost libraries for quite some time. I absolutely love boost asio library for network programming. However I was introduced to two other libraries: POCO and ACE framework. I would like to know the good and bad of each.
...
Hi,
I'm trying to learn myself some C++ from scratch at the moment.
I'm well-versed in python, perl, javascript but have only encountered C++ briefly, in a
classroom setting in the past. Please excuse the naivete of my question.
I would like to split a string using a regular expression but have not had much luck finding
a cle...
Is there any way of creating a function that accepts any version of a given
template class?
e.g. this works:
ostream& operator << (ostream &out,const Vector<int>& vec);
but this doesn't:
ostream& operator << (ostream &out,const Vector& vec);
Is it possible to get the second line to work somehow for any version of vector?
e.g. vec...