c++

C++ include file browser

I have a very large project with tons of convoluted header files that all include each other. There's also a massive number of third-party libraries that it depends on. I'm trying to straighten out the mess, but I'm having some trouble, since a lot of the time I'll remove one #include directive only to find that the stuff it was includ...

OCILogon during Grace Period - ORA-28002

Hi, when I use SQL*Plus, connecting to a user whose password entered the grace period (Oracle 11g, Oracle 8i), I get an error message but the connect is still successful: SQL*Plus: ===================================== SQL> connect gumiplesku Enter password: ERROR: ORA-28002: the password will expire within 7 days Connected. SQL> se...

How Do I Serialize and Deserialize an Object Containing a container of abstract objects in c++?

Im trying to text serialize and deserialize an object containing a container of abstract objects in c++,does somebody know of a code example of the above? ...

Optimisation of division in gcc

Here's some code (full program follows later in the question): template <typename T> T fizzbuzz(T n) { T count(0); #if CONST const T div(3); #else T div(3); #endif for (T i(0); i <= n; ++i) { if (i % div == T(0)) count += i; } return count; } Now, if I call this template function wit...

What is the purpose of the ## operator in C++, and what is it called?

I was looking through the DXUTCore project that comes with the DirectX March 2009 SDK, and noticed that instead of making normal accessor methods, they used macros to create the generic accessors, similar to the following: #define GET_ACCESSOR( x, y ) inline x Get##y() { DXUTLock l; return m_state.m_##y;}; ... GET_ACCESSOR( WCHAR*, W...

What is the underlying type of a c++ enum?

This may have been answered elsewhere but I could not find a suitable response. I have this code: enum enumWizardPage { WP_NONE = 0x00, WP_CMDID = 0x01, WP_LEAGUES = 0x02, WP_TEAMS = 0x04, WP_COMP = 0x08, WP_DIVISIONS = 0x10, WP_FORMULAS = 0x20, WP_FINISHED = 0x40, }; Which is legacy and I have...

c++ templatized interface

This is best described in pseudo-code: class Thing {}; interface ThingGetter<T extends Thing> { T getThing(); } class Product extends Thing {}; class ProductGetter<Product> { Product getThing() { // Some product code } } class SpecialProductGetter extends ProductGetter { Product getThing() { p = Produ...

How do I get all the shader constants (uniforms) from a ID3DXEffect?

I'm creating an effect using hr = D3DXCreateEffectFromFile( g_D3D_Device, shaderPath.c_str(), macros, NULL, 0, NULL, &pEffect, &pBufferErrors ); I would like to get all the uniforms that this shader is using. In OpenGL I used glGetActiveUniform and glGetUniformLocation to...

How to construct a static global variable in C++

I'm having some trouble compiling/linking a set of classes, several of them dealing with a common global variable. Basically, I declare and define a extern variable foo in class A and access/update it in classes B and C. The relevant code looks like this: A.h extern string foo; // declare it <=== compiler error "storage class sp...

Unit testing for compiler errors

How do you test for wanted raised compiler errors in unit testing? Consider the code: class ErrorTest { OtherClass& read_write() { return other; } const OtherClass& read_only() const { return other; } private: OtherClass other; }; How can I test for read_only() assignment? It's really imp...

How to get the most current IHTMLDocument2 object from IE DOM

Currently, I use MSAA to get an IHTMLDocument2 object from a IE HWND. However, with some complicated web applications, this IHTMLDocument2 object may contain serveral IHTMLDocument2 objects, some of them are not belong to the current displaying page, but the previous page. It seems to me, IE sometimes doesn't refesh its DOM object, but...

Implementing drag and drop with QT 4.5 using QT Creator environment

We're about to commit to Qt and C++ (sigh) to do some cross-platform development. The latest version of Qt 4.5 seems very nice as does the QT Creator IDE, which although simple compared to other IDEs, is a good way to get started. I'm trying to understand how to do drag and drop into QT widgets from the "outside" world. As far as I can ...

How to force Visual Studio preprocessor case sensitivity with #includes?

If you have a header file named ThisIsAHeaderFile.h, the following will still locate the file in Visual Studio: #include <ThisIsAheaderFile.h> Is there a way to enforce case sensitivity so that the #include will result in an error? ...

Is This a C++ Unit Test?

Hi, I am trying to formalize my programming practices in preparation to do it professionally (I have been doing it as a hobby for 18 years). Unfortunately they didn’t really teach us useful stuff in school, so I am trying to learn these things on my own. One aspect that I am trying to learn is unit-testing. I have read various things a...

Suggested C++ books?

Possible Duplicate: The Definitive C++ Book Guide and List Ok, I've had one semester of C++ and will be taking a second semester in it after I have taken a Data Structure class this fall. In the first class, we dealt mainly with C++ syntax and the textbook we used was ok, but now I'm wanting to go ahead and purchase a great C+...

Undefined reference - C++ linker error

I'm getting an Undefined reference error message, on this statement: GlobalClass *GlobalClass::s_instance = 0; Any ideas? Code is shown below: ================================================ #ifndef GLOBALCLASS_H_ #define GLOBALCLASS_H_ #include <string> class GlobalClass { public: std::string get_value(); void set_valu...

Undefined reference error message - C++

Possible Duplicate: Undefined reference - C++ linker error Now, I'm getting an "Undefined reference error message to 'GlobalClass::s_instance', and 'GlobalClass::instance()', respectively on these statements: GlobalClass *GlobalClass::s_instance = 0; GlobalClass::instance()->set_value(myAddress); \\ <== undefined reference ...

When should your destructor be virtual?

When should your C++ object's destructor be virtual? ...

Why do we need typename here?

template<class T> class Set { public: void insert(const T& item); void remove(const T& item); private: std::list<T> rep; } template<typename T> void Set<T>::remove(const T& item) { typename std::list<T>::iterator it = // question here std::find(rep.begin(),rep.end(),itme); if(it!=rep.end()) rep.erase(it); } Why t...

Boost Graph Library and Visitors

I'm writing a library for manipulating bond graphs, and I'm using the Boost Graph Library to store the data for me. Unfortunately, I can't seem to figure out how to implement a proper visitor pattern using it, as you can't subclass out vertices - you must rely on 'properties' instead. The visitor framework provided in the library seems...