c++

Set dirty dot in mac window using Qt

Is there a way to set the dirty dot (as shown in the screenshot) using Qt 4.5/4.6? ...

CoCreateInstance returning E_NOINTERFACE even though interface is found

I have a COM class CMyCOMServer implementing IMyInterface in one application, both with correct GUIDs. CMyCOMServer::QueryInterface will return S_OK (and cast itself to the right type) if IUnknown or IMyInterface is requested, otherwise it returns E_NOINTERFACE. In another app on the same PC, I call: HRESULT hr = ::CoCreateInstance(__u...

Easiest way to make a cyclic iterator?

I have an object that I want to travel in a continuous loop in a game. I have a series of coordinates in a std::vector that I want to use as waypoints. Is there anyway to make an std::vector::iterator cyclic? The best I can come up with is to have two iterators and then whenever the first iterator is exhausted assign to it the value of...

Can I have a compile time constant instance of a class (as a member) in C++?

In C++, say I have a class Thing, I'd like it to include a const member of that type, something like: class Thing { public: Thing(); private: static const Thing THING; }; But I don't think this works as above. How can I do this? ...

Compile Combination of qtwinmigrate + qtpropertybrowser Under VC++ 2008

I need to display a property browser under a MFC app. I try to combine and compile the solution for the two http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Windows/qtwinmigrate/ http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Widgets/qtpropertybrowser/ I am using VC2009, QT 2009.04 with Visual Studio Add-On...

MSN Messenger/Growl Style Alerts in Windows C++

Does anyone know of any C++ Libraries which I can easily integrate in a project to allow me to show MSN Messenger/Outlook/Growl style toast popups? Tried having a look and found lots of Visual Basic controls etc but nothing for C++ so far. ...

A template question: Can compiler deduce template type in static method

I have the following setup: A templated class SpecialModel: template<typename A, typename B> class SpecialModel<A, B> { }; A templated Worker, working on some kind of Model: template<typename M> class Worker<M> { Worker(M& model); void work(); }; And a specialization of Worker for SpecialModel: template<typename A, typ...

Doxygen comments on declarations or on definitions?

Just started using Doxygen for documenting my code here and can't decide where to put them. At first look it seems better to put them in the declaration files as it is there where you actually declare what you receive, what you are going to return and stuff like that, apart from that things like data members that are only in the decla...

Implementing and inheriting from C++ classes in Lua using SWIG

Would it be possible using Lua and SWIG and say an IInterface class, to implement that interface and instantiate it all within Lua? If so how would it be done? ...

C++ Netbeans debugging issues

hi all ,I installed netbeans6.7.1 ide for c/c++ also i have mingw/msys cygwin installed and i have given C:\Msys\bin as environment variable path.It has gdb7 version.However wheni run dbugging thru netbeans it prompts that GDB version 0 not supported on this platform.Pls help I have made the project from existing files by giving netbeans...

can anyone tell me how to create the object of c++class in android through ndk

my activity is:: package com.soft; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class TestNdk extends Activity { TextView txtHello; private int m_cAddValue; private TestNdk m_cTestNDK; private int m_cObj; public TestNdk(int i, int j) { getSum(); } ...

Is there any standard way to load parameters from a file in C++ on Linux?

Imaging that a program needs to know quite a lot of parameters to do its tasks properly, such as 'Port = 2323' this kind of things. now I want to save these parameters in a plain text file, similar to Unix' system variables such as users and groups. Is there any standard way/libraries that can help me to do this? Does anyone ever used ...

OCCI: Querying for metadata of a stored procedure within a package

I am trying to get metadata about parameters of a stored procedure that is defined in a package using C++ Oracle OCCI. Getting parameter metadata of a standalone proc is straightforward: MetaData meta = connection->getMetaData("MY_PROC"); vector<MetaData> params = meta.getVector(MetaData::ATTR_LIST_ARGUMENTS); However, if I try to que...

How do I decide whether having more that one VC++ CRT state is a problem for my application?

This MSDN article says that if my application loads VC++ runtime multiple times because either it or some DLLs it depends on are statically linked against VC++ runtime then the application will have multiple CRT states and this can lead to undefined behaviour. How exactly do I decide if this is a problem for me? For example in this MSDN...

C++ copy constructor invocation

Hi, As far as i know, a copy constructor is invoked in the following scenarios : 1) Pass by value 2) Return by value 3) When you create and initialize a new object with an existing object Here's the program : #include <iostream> using namespace std; class Example { public: Example() { cout << "De...

Why must I put a semicolon at the end of class declaration in C++?

In a C++ class declaration: class Thing { ... }; why must I include the semicolon? ...

What is the best autocomplete/suggest algorithm,datastructure [C++/C]

We see Google, Firefox some AJAX pages shows up list of probable items while user types characters. Can someone give good algorithm,datastructure for implementing autocomplete ? ...

typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;

What does exactly this mean? typedef _W64 unsigned int UINT_PTR, *PUINT_PTR; Does this mean that *PUINT_PTR is a pointer (obviously) and UINT_PTR is NOT a pointer? If so, why is it called UINT_PTR ? (which I would read as unsigned int pointer, or pointer to unsigned int) Thanks ...

format of for loops

Hi, i'd just like to get some thoughts on the best way to do for loops (in c based languages). all over the web code samples have for loops which look like this for(int i = 0; i < 5; i++) while i used the following format for(int i = 0; i != 5; ++i) i do this because i believe it to be more efficent but does this really matter in m...

What are the advantages and disadvantages of implementing classes in header files?

I love the concept of DRY (don't repeat yourself [oops]), yet C++'s concept of header files goes against this rule of programming. Is there any drawback to defining a class member entirely in the header? If it's right to do for templates, why not for normal classes? I have some ideas for drawbacks and benefits, but what are yours? ...