c++

What is it in MVVM that makes it particularly appealing for managed WPF and Silverlight but not native C++?

What is it in WPF and Silverlight that makes MVVM suit them so well? What is it in C++, or what does C++ lack, that makes MVVM and C++ never be mentioned together? ...

CComModule::Unlock();

I've been trying to determine what this function does, however I cannot seem to find it anywhere under the MSDN documentation of the CComModule class. Could anyone tell me what it is used for? ...

Override number of parameters of pure virtual functions

I have implemented the following interface: template <typename T> class Variable { public: Variable (T v) : m_value (v) {} virtual void Callback () = 0; private: T m_value; }; A proper derived class would be defined like this: class Derived : public Variable<int> { public: Derived (int v) : Variable<int> (v) {} void Callbac...

Mac OS X linker error in Qt; CoreGraphics & CGWindowListCreate

Here is my .mm file #include "windowmanagerutils.h" #ifdef Q_OS_MAC #import </System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Headers/CGWindow.h> QRect WindowManagerUtils::getWindowRect(WId windowId) { CFArrayRef windows = CGWindowListCreate(kCGWindowListOptionOnScreenOnly, kCGNullWindowID...

Is there such a thing as a C# style extension method in C++ ?

I'm currently learning C++ and i run into the simple problem of converting an int to a string. I've worked around it using: string IntToString(int Number) { stringstream Stream; Stream << Number; return Stream.str(); } but though it would be more elegant to use something like: int x = 5; string y = x.toString(); but how...

Insert MANY key value pairs fast into berkeley db with hash access

Hi, i'm trying to build a hash with berkeley db, which shall contain many tuples (approx 18GB of key value pairs), but in all my tests the performance of the insert operations degrades drastically over time. I've written this script to test the performance: #include<iostream> #include<db_cxx.h> #include<ctime> #define MILLION 1000000 ...

c++ container allowing you to sort items by when they where last accessed?

Does such a thing exist? or could anyone please recommend how I could implement such a container? basically I have a std::map which uses a 64bit integer as its key and a custom datatype as the containing item. I need to be able to periodically remove items that havent been accessed in a while in the most optimal way. does anyone have a...

Hiding instantiated templates in shared library created with g++

I have a file that contains the following: #include <map> class A {}; void doSomething() { std::map<int, A> m; } When compiled into a shared library with g++, the library contains dynamic symbols for all the methods of std::map<int, A>. Since A is private to this file, there is no possibility that std::map will be instantiated i...

Why my linux signal handler run only once

#include <iostream> #include <signal.h> #include <fenv.h> #include <string.h> void signal_handler(int sig, siginfo_t *siginfo, void* context) { std::cout << " signal_handler " << fetestexcept(FE_ALL_EXCEPT) << std::endl; throw "exception"; } void divide() { float a = 1000., b = 0., c, f = 1e-300; c = a / b; std::cout << ...

Aero Snap not working for my application

I have a problem with Aero Snap not working with the application I'm working on (Windows desktop, native C++ application), and I'm a bit confused as to what's happening, as it seems like it should just work, out of the box. I've used Spy++ on a mininal win32 application, and get the following messages when I press Win-Left: <00070> 000...

Best and shortest books on C++/STL/C#/J2SE to prepare for job inteview/tests

I am a software developer with 10+ years commercial experience, I am comfortable with nearly all of imperative languages. But I realized that most of employers prefer not candidates who is able to deliver good software but those who is trained to answer questions like "what are ten differences between pointers and references in C++" or "...

Thread-safty of boost RNG

I have a loop which should be nicely pararellized by insering one openmp pragma: boost::normal_distribution<double> ddist(0, pow(retention, i - 1)); boost::variate_generator<gen &, BOOST_TYPEOF(ddist)> dgen(rng, ddist); // Diamond const std::uint_fast32_t dno = 1 <<...

rect in c or c++ language

Hi, Is there a type called rect in C or class Rect in C++ language. ...

Strange Template error : error C2783: could not deduce template argument

Hi, I have created a simple function with 2 diffrernt template arguments t1, t2 and return type t3. So far no compilation error. But when Itry to call the function from main, I encounter error C2783. I needed to know If the following code is legally ok? If not how is it fixed? please help! template <typename t1, typename t2, typena...

What exactly is a variable in C++?

The standard says A variable is introduced by the declaration of an object. The variable's name denotes the object. But what does this definition actually mean? Does a variable give a name to an object, i.e. are variables just a naming mechanism for otherwise anonymous objects? Or is a variable the name itself? Or is a variab...

How do I create a create and execute an SQL command using OleDB directly?

I want to use the OleDB interfaces directly to open a connection to a DB, create a command and executing it (for example using the ICommandText interface). The main thing I can't find is how to create the connection and the command object and how to connect the object that implements the ICommandText to the connection. In ADO I would ju...

Cannot press QPushButton in a simple program

Basically, I want a simple pushButton with a colorful text which when pressed exits the application. Why cant I press PushButton in this simple program. I am using QT 4.6 on Arch x86_64. #include <QtGui/QApplication> #include <QLabel> #include <QPushButton> #include<QtGui> int main(int argc, char *argv[]) { QApplication a(argc, a...

Multi-monitor application in C++ and Opengl

hi, I'm developing an application in C++ on Windows and i don't know in Openlg how to initialize several devices or screens for an multi-monitor application. Thanks Paul ...

priority_queue with dynamic priorities

Hey, I have a server application which accepts incomming queries and executes them. If there are too many queries they should be queued and if some of the other queries got executed the queued queries should be executed as well. Since I want to pass queries with different priorities I think using a priority_queue would be the best choice...

need a library to get performance counters data under Win CE, c++ code

Under WindowsCE, C++ project, I'd like to get CPU utilization and memory allocation data real time - for logging and troubleshooting. Is there a library or activeX available that i could include in my code and use [without bringing my process to a halt, preferably], anyone knows? thanks much for any insight! O. ...