Hi everyone,
I am using CMake to manage a build of a collection of projects on Linux, not a single project but the principle is the same. Each project has its own collection of options, for example DEVEL switches and custom code to be included. These are added in the standard CMake way:
OPTION(NAME "Helpstring" VALUE)
I am looking fo...
Hai
I have a class A,B,C now i have member function in class A which needs the objects of
class B,C. Is it possible to achieve. If yes how?
class A
{
public:
void fun(B obj_b,C obj_c)
{
}
}
class B
{
//some work
}
class C
{
//some work
}
int main()
{
B obj_b;
C obj_c;
A obj_a;
obj_a.fun(obj_b,obj_c);...
Here is source code of my function:
bool FieldModel::updateNode(QDomNode &node,const QString &parent){
QDomElement rootOfTag;
rootOfTag=fieldState.firstChild().firstChildElement(parent);
qDebug()<<"Before"<<fieldState.toString();
QDomNodeList sameTags=rootOfTag.elementsByTagName(node.firstChild().toElement().tagName());
for...
A discussion recently ended laughing at the bad habits of programmers that have been too exposed to a language when they start programming in another language. The best example would be a Pascal programmer starting to #define begin { and #define end } when starting to write C.
Goal is to try to catch the bad habits of C programmers when...
This may seem relevant but it has some significance for me,may be few others like me.
I just want to know ,How Important is it to Learn C++ , COM and ATL while you are a .NET programmer?
I love programming with .NET and C# .Visual Studio just has it's own charm of intellisence ,Color Coding and other pretty features , which make us add...
$4.11/2 states -
An rvalue of type “pointer to member
of B of type cv T,” where B is a class
type, can be converted to an rvalue of
type “pointer to member of D of type
cv T,” where D is a derived class
(clause 10) of B. If B is an
inaccessible (clause 11), ambiguous
(10.2) or virtual (10.1) base class of
D, a progra...
Hello all,
I'm applying the Factory design pattern in my C++ project, and below you can see how I am doing it. I try to improve my code by following the "anti-if" campaign, thus want to remove the if statements that I am having. Any idea how can I do it?
typedef std::map<std::string, Chip*> ChipList;
Chip* ChipFactory::createChip(cons...
why default arguments in C++ are trailing ones ?
...
In my application, I want to execute logic at the very last moment. The later, the better.
The reason for this is that I keep track of certain elements in my application (data structures, resources, ...), and at the end of the application, a routine looks at these elements and reports if they were not correctly closed, freed, deleted, ...
int MFC_Tutorial_Window::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!myBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC))
{
MessageBox(L"Failed to create toolbar\n");
retur...
Hello!
Using the Openframeworks library in C++, I have the radius of a glow (max_distance) that is determined by the stretch of the mouse dragging across the screen (mouseDragX). It works fine.
But rather than every time I resize it (by dragging the mouse), I want it not to start at 0 and follow the mouse drag directly.
max_distance =...
I have always used Visual Studios built in GUI support for configuring my projects, often using property sheets so that several projects will use a common set.
One of my main gripes with this is managing multiple projects, configurations and platforms. If you just do everything with the main GUI (right click the project -> properties) i...
Hi All
I have a huge Windows C++ project that takes a lot of time to be compiled. Do you know if there is some FREE tool being able to build using multiple pc connected together?
Do you know if there is some free tool doing the same in Linux using GCC?
At least there is something that I can do to split the work myself?
Thanks
...
I was trying to create a custom Parser class in Boost.Spirit (2.3), but it didn't work out. The code is:
template <class Iter>
class crule : public boost::spirit::qi::parser<crule<Iter> >
{
rule<Iter> r_;
public:
crule(const rule<Iter>& r) : r_(r) {}
template <class T>
crule(const T& t) : r_(t) {}
template<class Ctx, class Ski...
I read it was based on Boost's version, but I wasn't quite sure what that meant when it came down to implementation. I know Boost does their own variadic template, but I would assume c++0x would use its own variadic templates for the new tuple.
...
Hello,
we've got a problem with one of our non dpi aware MFC applications.
If you change the system setting to high dpi (e.g. 120 or 144 dpi), the application icon on the taskbar looks screwed up. Unfortunately, we have to register our own WNDCLASS for the mainframe, and in the WNDCLASS.hIcon member you have to set an icon. This icon is...
I have just started C++ and have come across references and have not understood completely.
References , as i read is an alternative name for an object.Why use that instead of directly accessing the object as any operation on references is directly reflected on the object ...?
Why and when are they used ?
Is ist like a constant point...
I have one class which is implemented this way
.cpp
MyClass::~MyClass()
{
if(m_List)
{
delete m_List;
m_List = NULL;
}
}
MyClass* MyClass::Create()
{
MyClass* self = new MyClass(); // leak here as per Instrument
if(!self)
{
return NULL;
}
if(!self->Construct())
{
del...
I have the following situation (caused by a defect in the code):
There's a shared variable of primitive type (let it be int) that is initialized during program startup from strictly one thread to value N (let it be 0). Then (strictly after the variable is initialized) during the program runtime various threads are started and they in so...
I think virtual alone is generally sufficient.
Is there another reason to make it pure virtual than to force derived classes to implement their own destructor? I mean if you allocate something in your class' constructor you should impement your own destructor - if your class is derived or not.
Doesn't count as answer as I already know:...