c++

Why this is causing C2102: '&' requires l-value

I was wondering, why the following way of code (Already commented out) will cause C2102: '&' requires l-value Is there a better way to avoid using tmp variable? class a { private: int *dummy; public: int* get_dummy() const { return dummy; } }; int main() { a aa; // error C2102: '&' requires l-value //i...

Call C++ APIs from Javafx UI for a desktop application

I am interested in using Javafx for my visual content for a desktop application and call native,unmanaged C++ functions ( on events from the Javafx views). Is this possible? Can someone explain with an example? ...

Converting a lambda to a std::tr1::function

Using visual studio 2008 with the tr1 service pack and Intel C++ Compiler 11.1.071 [IA-32], this is related to my other question I'm attempting to write a functional map for c++ which would work somewhat like the ruby version strings = [2,4].map { |e| e.to_s } So i've defined the following function in the VlcFunctional namespace te...

How to resolve pointer alias issues?

Careless use of templates can cause bloat. One way to avoid that bloat is to have a thin typesafe template that wraps non-typesafe non-template code. To do this, the wrapper needs to provide some way for the non-template code to access things it knows nothing about. For example, in a data structure, the wrapper defines the node structs....

angle in iphone sdk?

hi, how to calculate angle between two points in iphone sdk...? ...

Why is this not allowed in C++?

Here is my code - #include<iostream> using namespace std; class base { private: public: void sid() { cout<<"base"; } }; class derived : private base { private: public: void sid() { cout<<"derived"; }...

C++ v-table: Part of the language or compiler dependent?

Is the v-table (virtual method table) a part of the C++ specification, or is it up to the compiler to solve the virtual method lookups? In case it's part of the spec: Why? (I'd guess that it's compiler dependent, but someone said to me that it's part of the spec.) (References are very welcome!) ...

How to display a notification even when a full-screen application is currently running?

My program needs to display a notification once in a predetermined interval. Under Windows, Shell_NotifyIcon does the job well except that when the user is running a full-screen application, the notification isn't shown. Though that may be the right thing in most of the cases, in my case I need to ensure the notification can be seen even...

nested STL structure

Hi, I am wondering about the performance of nested STL structure related to compile and run time. So if want to implement something a nested structure e.g. that way vector<vector<map<int, vector<> > > > How could the access to each container effect on the whole execution time? Thanks for any help. Giving some specific links consider...

QT Plugin , VTK QT Widget , Multi-thread and Linking question?

Greetings all, This is going to be a long question,skip the [Background] if its not that neccasary ;) [Background] I am developing a modular QT based application.Application is extentible via QT based plugins. As shown in the figure, there are mainly 3 parts .(numbers in red) 1) libAppCore - the core of the application,which defin...

How could I sensibly overload placement operator new?

C++ allows overloading operator new - both global and per-class - usual operator new, operator new[] used with new[] statement and placement operator new separately. The former two of those three are usually overloaded for using customized allocators and adding tracing. But placement operator new seems pretty straightforward - it actual...

WinAPI File In-/Output with std::strings instead of char arrays?

Hi, due to performance reasons I didn't feel like using fstream for just one time. Seems like a very bad idea to use WinAPI functions with a std::string instead of a plain char array. All in all I would like you to tell me why the following snippet just won't work (empty stBuffer stays empty) and what I'd need to do to get it fixed. Th...

170 MB Hello World -> Deploying apps with Qt.

I'm new to Qt but no problem in the C++. I used Qt Creator and made a simple program with a button (like a hello world) then I built the project. I was not able to run the executable file in windows itself (outside the creator) because it needed these DLL files: libgcc_s_dw2-1.dll mingwm10.dll QtGuid4.dll QtCored4.dll I found these fi...

Undefined reference while using g++ for compilation

Hi, I am getting following error p.c uses some of the function implemented in md4.c. p.c , when compiled with gcc works but it does not work with g++, gives undefined method error. Am I missing something obivious ? [prafulla@ps7374 sample] $g++ -c -o md4.o md4.c [prafulla@ps7374 sample] $gcc -c -o md4.o md4.c [prafulla@ps7374 sample] $...

Can I use global operator new for a class having operator new overloaded?

Suppose I have a class with overloaded operator new. class Class { public: void* operator new( size_t ); void operator delete( void* ); }; Will objects of that class always be allocated with the overloaded operator new when I use new Class() or is it possible that the default operator new is used when new Class() construct appea...

How to get __FILE__ as absolute path on Intel C++ compiler

I've tried using the /Fc flag which works with visual studio but get a message that it isn't recognized by the intel compiler. I'm trying to write a test which uses data from a directory relative to the cpp test file, however the executable will be deployed elsewhere so it's hard to get it relative to the exe... hence i'd like an absol...

Ambiguous call to templated function due to ADL

I've been bitten by this problem a couple of times and so have my colleagues. When compiling #include <deque> #include <boost/algorithm/string/find.hpp> #include <boost/operators.hpp> template< class Rng, class T > typename boost::range_iterator<Rng>::type find( Rng& rng, T const& t ) { return std::find( boost::begin(rng), bo...

How to find out which Win API functions are called from a compiled c/c++ dll

Hi I have a compiled C/C++ Dll. I would like to know which external API function is called by this Dll. Do you know any tools which can provide these informations. Thanks. ...

Fast multiplication of values in an array

Is there a fast way to multiply values of a float array in C++, to optimize this function (where count is a multiple of 4): void multiply(float* values, float factor, int count) { for(int i=0; i < count; i++) { *value *= factor; value++; } } A solution must work on Mac OS X and Windows, Intel and non-Intel....

How to delete IE addressbar history on Vista/Win7?

I asked same question on stackoverflow. First, here is a picture of what I see http://img713.imageshack.us/img713/4797/iedrop.png I need an solution to clear addressbar dropdawn, but not using ClearMyTracksByProcess or IE dialogs. I need to delete only a specific URL and all his traces. I deleted manually all traces of that URL in: ...