c++

Variable Argument lists with boost?

Hello I wanted to write a function with a variable argument list. I want to explore my options. I'm pretty sure I came accross a boost template class that was designed for this purpose, but I can't think of the name of it? Can anyone tell me? or did I dream this up! Thanks ...

Detecting C++0x mode on Intel C++?

Does Intel C++ predefine some macro when compiling with Qstd=c++0x? Something like __GXX_EXPERIMENTAL_CXX0X__ in GCC? __cplusplus is still 199711. Any way to detect C++0x compilation? ...

Python: Passing unicode string to C++ module

I'm working with an existing module at the moment that provides a C++ interface and does a few operations with strings. I needed to use Unicode strings and the module unfortunately didn't have any support for a Unicode interface, so I wrote an extra function to add to the interface: void SomeUnicodeFunction(const wchar_t* string) How...

decltype with a variadic template function

I want to write a simple adder (for giggles) that adds up every argument and returns a sum with appropriate type. Currently, I've got this: #include <iostream> using namespace std; template <class T> T sum(const T& in) { return in; } template <class T, class... P> auto sum(const T& t, const P&... p) -> decltype(t + sum(p...)) { ...

Find common sequence that is out of order

What algorithm finds a common sequence that is out of order between two strings? I need to implement or use one in C++. ...

the role of #ifdef and #ifndef

#define one 0 #ifdef one printf("one is defined "); #ifndef one printf("one is not defined "); In this what is the role of #ifdef and #ifndef, and what's the output? ...

[C++] Is it a good idea to always return references for member variable getters?

If I have a class that has many int, float, and enum member variables, is it considered efficient and/or good practice to return them as references rather than copies, and return constant references where no changes should be made? Or is there a reason I should return them as copies? ...

Size of references in 64bit environments

Came across this one while browsing the response to another question on SO (References Vs Variable Gets). My question is that for all 64bit environments is it guaranteed that a reference to a variable will be of 64 bits even if the original had a lesser size? As in char references in 64bit environment would be >sizeof(char)? Is there any...

How to profile the time of calling initializer functions when dyld loads an image?

I am now trying to optimize the launch time of an application, and currently want to reduce the time spent by the OS image loader. From dyld(1), I found two environment variables: DYLD_PRINT_STATISTICS and DYLD_PRINT_INITIALIZERS. DYLD_PRINT_STATISTICS causes dyld to print statistics about how dyld spent its time. This is its output wh...

Undefined reference to ClassName::ClassName

Hi all! I'm using Code::Blocks to build my project, which contains three files: main.cpp, TimeSeries.cpp, TimeSeries.h. TimeSeries.h provides declarations for the TimeSeries class as follows: template<class XType, class YType> class TimeSeries { public: TimeSeries(void); ~TimeSeries(void); }; Then TimeSeries.cpp contains: ...

how to make pointer to non-member-function?

if i have for example class A which contains the functions: //this is in A.h friend const A operator+ (const A& a,const A& b); friend const A operator* (const A& a,const A& b); which is a global (for my understanding). this function implemented in A.cpp. now, i have class B which also contains the functions, and the member: //this ...

C++ static variable

I am trying to design header only library, which unfortunately needs to have global static variable (either in class or in namespace). Is there any way or preferred solution to have global static variable while maintaining header only design? The code is here ...

Performance when exceptions are not thrown (C++)

Hello! I have already read a lot about C++ exceptions and what i see, that especially exceptions performance is a hard topic. I even tried to look under the g++'s hood to see how exceptions are represented in assembly. I'm a C programmer, because I prefer low level languages. Some time ago I decided to use C++ over C because with small...

Visual C++ Express 2008 error with MSVCP90D.dll

When i Try to Build My source code ,it says MSVCP90D.dll missing. I'd like to know how to correct this Thanks ...

Splitting classes out into DLLs using VS2008 C++

I've got a VS2008 C++ solution containing one project which is a Win32 console application. I have developed a few classes that I want to re-use in another project. Apart from copying the source files into new projects, what's the correct way to turn my classes into some sort of reusable component? Should I be using a standard DLL, or a...

wstring conversion showing error. IDL to java

I have an idl file containing the bellow string const wstring ROOT_DOMAIN = L"S_ROOT" I was using open orb 1.3.1 to convert this idl file to java. But it shows bellow error Undefined identifier : L But When I removed L from idl file , it was working fine. Why this error is happening ? What should I do to avoid this error ? ...

How to show web page

Hi, I wanna show web page in my program. I using Dev-C++ and I'm new. How I can do this? Best regards ...

how to implement minheap using template

I need to create a minheap template which includes nodes in it. The problem I have is that I don't know if I need to create a node template class as well, or should it be included inside the heap template class as a struct? ...

msi.h for mingw

I have a C++/Qt/mingw app and would like to use msi.h (Microsoft Installer interface), but mingw does not seem to provide this header. How can I do this? ...

Opencv Kalman filter

Hi, I have three gyroscope values, pitch, roll and yaw. I would like to add Kalman filter to get more accurate values. I found the opencv library, which implements a Kalman filter, but I can't understand it how is it really work. Could you give me any help which can help me? I didn't find any related topics on the internet. I tried to ...