Consider the following code:
template<int* a>
class base {};
int main()
{
base<(int*)0> test;
return 0;
}
Both Comeau and MSVC compile this without issues (except for Comeau warning about an unused variable), while GCC fails on the base<(int*)0> test; line, stating
In function `int main()':
a casts to a type other than...
Will c++ implicit function calls be a feature of C++0x ? It is an interesting feature, but I haven't seen any progress on this and the GCC C++0x page didn't even mention it.
See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1611.pdf
...
What are all operations supported by function pointer differs from raw pointer?
Is > , < , <= , >=operators supported by raw pointers if so what is the use?
...
Is there a way (either via the UI, or in config files) to change the names of the C++ getters/setters generated by Eclipse CDT from the Java-style getSomething() to the more C++ like something() ?
...
when I try to open a file for reading in my console application i get this error message: "Unhandled exception at 0x1048766d (msvcp90d.dll) in homework1.exe: 0xC0000005: Access violation writing location 0x00000000." It works fine when I compile and run the program on my macbook but when I run it on my desktop using VS 2008 it gives me ...
Hello!
I am looking for a couple of patterns or design ideas for implementation in C++ that would allow the following.
1.
pool of similar objects
objects requested and relinquished by client
pool grows when exhausted, does not shrink
there will be multiple clients (one pool per client to avoid mutexing)
An Object Pool seems most ap...
I was debugging a C++ program in VS 2003, and a boost variable showed up as having the value {null=???}. What does that mean?
...
In c#, you can use drawing2d.lineargradientbrush, but in c++ right now I only found the CreateSolidBrush function. Is there a function in the native gdi dll to create a gradient brush? I couldn't find anything like this at msdn.
Thanks
...
Basically I want to develop a BHO that validates certain fields on a form and auto-places disposable e-mails in the appropriate fields (more for my own knowledge). So in the DOCUMENTCOMPLETE event I have this:
for(long i = 0; i < *len; i++)
{
VARIANT* name = new VARIANT();
name->vt = VT_I4;
name->intVal = i;
VARIANT* id ...
Hello,
I'm working on a C++ client/server project where XML strings are passed over a TCP/IP connection. My question is about the proper way to indicate the complete string has been received. I was thinking of null terminated strings or sending the length of the XML string first, so the client/server can tell when a complete string is ...
Any links to code to get the control tree? Thanks.
...
Hi,
I would like to learn how to use binding functions.
Here is the idea:
I have this function which takes to parameters:
void print_i(int t, std::string separator)
{
std::cout << t << separator;
}
And I would like to do:
std::vector<int> elements;
// ...
for_each(elements.begin(), elements.end(), std::bind2nd(print_i, '\n')...
I've got some convex polygons stored as an stl vector of points (more or less). I want to tessellate them really quickly. The pieces don't have to be perfectly evenly sized, but they should still be bits and pieces... and preferably no slivers -- I'm just going to use it to explode some objects into little pieces. Does anyone know of a n...
Recently I have asked a question about what I should use to create self-contained executables that would be deployed under a number of Linux distribution. I got very scared at first, but after reading about C++ a little, I managed to get the first version of my executable going.
After a day full of joy, I just hit the wall again with an...
Is there such a thing as dangerous knowledge when just starting out learning C or C++? In other words what is the likelihood that I could "accidently" write and compile a code snippet that formats the hard drive, renders the OS unusable, or worse case scenario silently deletes random files on the computer?
Stuff like the veritable
fo...
I am thinking about changing my formatting style. I have been doing this:
char *foo(IULabel *label, char *buffer) {
UITextView *tv;
int i;
int *j;
...
}
and I am thinking that it might be easier to understand if I were to write:
char * foo(IULabel * label, char * buffer) {
UITextView * tv;
in...
I think I can write a QObject like this by taking advantage of the Q_PROPERTYs:
QDataStream &operator<<(QDataStream &ds, const Object &obj) {
for(int i=0; i<obj.metaObject()->propertyCount(); ++i) {
if(obj.metaObject()->property(i).isStored(&obj)) {
ds << obj.metaObject()->property(i).read(&obj);
}
}
...
The situation:
I have a std::vector that contains strings at specific offsets. Here's a shortened dump:
...
@128 00 00 00 00 00 00 00 00 73 6F 6D 65 74 68 69 33 ........somethin
@144 38 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ng..............
@160 00 00 00 00 00 00 00 00 31 2E 32 2E 33 00 00 00 ........1.2.3...
@176 00...
Hi,
I'll try to explain shortly what I want to do:
A project using a static library which have another one as depandency.
It produce a project called MyProject linking on MyLib1 linking on MyLib2.
Here is the compile order:
MyLib2
MyLib1 (linking to MyLib2)
MyProject (linking to MyLib1)
I'm using Visual Studio 2008 and I have some ...
I feel pretty stupid, but I'm just starting to learn c++ after coming from other languagues, and I cannot for the life of me comprehend statements that use "<<" and ">>". I know it is simple, but it confuses me every time.
The book I'm using made a really good recommendation to read const declarations from right to left. Is there an...