Is it possible in C++ for the compiler/language to automatically deduce unimplemented operators?
For example, if I have:
class X
{
public:
bool operator ==(const X &x) const;
};
Is there a way for != to be deduced implicitly?
And I'll exploit this questions for a semi-related one: How come map's only requirement from it's keys is...
Hello,
I would like to get the memory leaks information using _CRTDBG_MAP_ALLOC, and especially the files and line numbers, but I don't get them at the end. I only get something like this:
{130} normal block at 0x00695128, 16 bytes long.
Data: <\ E Pi > 5C A5 45 01 02 00 00 00 01 00 00 00 E8 50 69 00
I've seen that th...
Just for fun I'm developing a native Win32 port of Mozilla XUL. XUL allows to create complex nested structures of all kinds of layout boxes (hbox, vbox, grid, deck..). For my Windows implemenation it would be convenient to implement them as STATIC child windows. Because then I can position their child windows using x & y offsets independ...
Hello,
To start off, I don't know very much about network programming...
So given that, I have a program (process) which needs to listen on 3 ports... Two are TCP and the other UDP.
The two TCP ports are going to be receiving large amounts of data every so often (could be as little as every 5 minutes or as often as every 20 seconds...
When I use this
#include<time.h>
//...
int n = time(0);
//...
I get a warning about converting time to int. Is there a way to remove this warning?
...
Is there a way to manually increment and decrement the count of a shared_ptr in C++?
The problem that I am trying to solve is as follows. I am writing a library in C++ but the interface has to be in pure C. Internally, I would like to use shared_ptr to simplify memory management while preserving the ability to pass a raw pointer through...
Consider the following program
#include <iostream>
#include<cstdlib>
using namespace std;
class E {
public:
const char* error;
E(const char* arg) : error(arg) { }
};
void my_terminate() {
cout << "Call to my_terminate" << endl;
}
struct A {
A() { cout << "In constructor of A" << endl; }
~A(){
cout << "In dest...
I guess I've asked a few similar questions before, but I was beating around the bush. I think this is the real problem that I can't quite lay to rest.
I'm dealing with a third party library, and there's an object that can't create itself, b2Body. The b2World has to instantiate it. I personally don't like this design pattern very much; I...
The charset is Unicode. I want to write a string of CString type into a file, and then read it out from the file afterwards.
I write the string into a file with CFile::Write() method:
int nLen = strSample.GetLength()*sizeof(TCHAR);
file.Write(strSample.GetBuffer(), nLen);
Here is the question: I want to obtain the CString from the fil...
Dear All,
I am trying to create a C++ library with QT. However, when I launch the builder,
QT Creator asks me to provide an executable. I do not understand what it is really
asking for. Why would need an executable to make a library?
Thanks!!!
...
Let's say i have three control A, B, C. They are all inherited from CDialog,
A is a main dialog , A contains B, and B contains C.
and each time i use mouse mouse drag C, B and C will move together.
This is a image:http://img507.imageshack.us/img507/7039/31709956.jpg
We know this will cause B and C to redraw themselves. and it might cau...
I know that there is no concept of threads in current C++, but this article is saying:
A typesafe, threadsafe, portable
logging mechanism
.....
The fprintf() function is threadsafe,
so even if this log is used from
different threads, the output lines
won't be scrambled.
What about cout, cerr and clog?
I think thi...
This is probably really simple, but it's hindering me on my way down c++ road.
I am currently reading through accelerated c++ and I decided to overkill one of the exercises. It all worked well and my code ran fine until I split it into a header and separate source file. When I import my .cpp source file containing some functions I wrote,...
can someone give me a sample project in MFC?
Thanks in advance !
...
Hello, Under Windows XP, is it possible to execute a 3rd party application, so its main window will be a child/popup window of my VC++ MFC application?
I want to control it's Z-Order like any other window in my app
I don't want it be be visible in the taskbar
I want to catch its WM_CLOSE and handle it in my app
In general, I want my ...
could anyone explain function overriding in c++ please! also am confused about virtual function concept. some tutorials say without the keyword virtual, both the derived class and base class objects invoke the base class function. then how does overriding take place?
...
Just for fun I am working on a XUL implementation for Windows. In XUL, UI elements can be written in XML like this:
<window width="800" height="600"></window>
I am considering a system for getting and setting element attributes. It's working pretty well but I am not certain if the use of diamond inheritance is potentially hazardous he...
I'm currently trying to initialise a private istream variable in class.
The class definition looks like:
#define PARSER_H
class parser {
public:
parser();
parser(string predict_table_file_name);
private:
int getMaxRHS(string predict_table_file_name);
int getMaxPairs(string predict_table_file_name);
int getMax...
How would one pass a C# object via com? For example, say I have the following in a c# dll which is registered in the GAC and registry:
public int Add(int a, int b)
{
return a + b;
}
public int Add(NumberObject obj)
{
return obj.firstNumber + obj.SecondNumber;
}
How is it possible to make the NumberObj...
union LowLevelNumber
{
unsigned int n;
struct
{
unsigned int lowByte : 8;
unsigned int highByte : 8;
unsigned int upperLowByte : 8;
unsigned int upperHighByte : 8;
} bytes;
struct
{
unsigned int lowWord : 16;
unsigned int highWord : 16;
} words;
};
This union allows me to access the unsigned integer byte or word...