I have a templated class named check and its partial specialization, now i am publically inheriting a class named childcheck from the partial specialization of the class check. but compiler gives following error message
no matching function for call to `check::check()'
candidates are: check::check(const check&)
check::check(t*) [with t...
hello, i use visual studi 2008. (c++)
in my switch case a wanted to create an object, but i doens't work.
is it right, that i can't create an object in a switch case?
if that's right,whats the best way to work around it,
a new method that's creates that object?
edit the code:
switch (causwahl){
case '1':
cAccount *oAccount = new cA...
I'm a bit confused about how to overload the stream operators for my class in C++, since it seems they are functions on the stream classes, not on my class. What's the normal way to do this? At the moment, for the "get from" operator, I have a definition
istream& operator>>(istream& is, Thing& thing) { // etc...
which works. It's n...
Hi,
as far as i know i can use C++ templates in CUDA device code. So if i'm using map to create a dictionary will the operation of inserting new values be atomic?
I want to count the number of appearances of a certain values, i.e. create a code-dictionary with probabilities of the codes.
Thanks
Macs
...
I am moving to C++ from Java and I am having a lot of trouble understanding the basics of how C++ classes work and best practices for designing them. Specifically I am wondering if I should be using a pointer to my class member in the following case.
I have a custom class Foo which which represents the state of a game on a specific turn...
I want to display a very simple html page from the web, using libgtkhtml. Can you give an example please? Or some documentation/resources? I found nothing. (C preferred, but C++ also acceptable). Thanks in advance.
...
Hey,
I want to write a browser-chat and write an own server in c++, because you can not send text between the different instances (chat user) in php and other languages.
I have apache running with port 80 and that's why I cant run the "chat http server" on port 80. Some browsers block connection to a http site if it does not use port 80....
I have till now mainly concentrated on web programming thus far and now want to enter application programming space. I use a mac, and wanted to know what sort of compilers, IDEs etc people generally use for c++ dev.
extremely n00b
One more thing immensely bothering me was the fact that c++ compilers generally output .exe which cant be ...
Hi
In my program in C++ ...
User types in program string "foo".
I need to compare this string to my strings, in txt files to write: this string is noun! (or adjective...)
I got few TXT files - one file with nouns, 2-nd file with adjectives... but in each file is about 200.000 words.
How I can effectively compare this string "foo" wi...
I am working on a piece of code where I need to deal with uvs (2D texture coordinates) that are not necessarily in the 0 to 1 range. As an example, sometimes I will get a uv with a u component that is 1.2. In order to handle this I am implementing a wrapping which causes tiling by doing the following:
u -= floor(u)
v -= floor(v)
Doing...
I am trying to use boost's asio library, but I keep getting undefined references. I'm on Dev-Cpp on Windows, which is using the G++ compiler.
I installed boost using the installer from boostpro computing for Boost 1.42.0 [link]. Here is the code of the test program I am trying to make:
#include <boost/asio.hpp>
#include <iostream>
i...
I have a question related to understanding of how python dictionaries work.
I remember reading somewhere strings in python are immutable to allow hashing, and it is the same reason why one cannot directly use lists as keys, i.e. the lists are mutable (by supporting .append) and hence they cannot be used as dictionary keys.
I wanted to...
Let's say we already have a hierarchy of classes, e.g.
class Shape { virtual void get_area() = 0; };
class Square : Shape { ... };
class Circle : Shape { ... };
etc.
Now let's say that I want to (effectively) add a virtual draw() = 0 method to Shape with appropriate definitions in each sub-class. However, let's say I want to do this w...
I have following array, that I need to operate by hand on bitmaps.
const unsigned int BITS[32] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024,
2048, 4096, 8192, 16384, 32768, 65536, 131072,
262144, 524288, 1048576, 2097152, 4194304,
8388608, ...
Hi, consider the following code:
const QString& MyClass::getID(int index) const
{
if (i < myArraySize && myArray[i]) {
return myArray[i]->id; // id is a QString
} else {
return my_global_empty_qstring; // is a global empty QString
}
}
How can I avoid to have an empty QString without changing the return type...
I'm studying "The C++ Programming Language" from Bjarne Stroustrup and he talks about logical and physical constness of a class.
The example of logical constness is something like:
class A {
int m;
void func() const { m++; } //forbidden
}
It's possible to bypass this with a cast, like:
class A {
int m;
void func() c...
Ok, so my assignment is to build on an existing code from the book. I have to add the 3rd box and then calculate the total for all 3 boxes. Here is what I've written so far, but it will not compile. Please help me find the problem. Thanks.
The program I'm using is MS Visual C++ and the complile error I get is "error C2447: '{' : missing...
I am working on an assignment for networking where we are supposed to create a networking library in C and then use it in our C++ program. My C++ isn't as strong as my C so I got started on that first so I could tackle any problems that came up, and I present you my first one. :D
I have a base class and an inherited class (there will ev...
Ok, I am working through a book and trying to learn C++ operator overloading. I created a BigInt class that takes a single int (initially set to 0) for the constructor. I overloaded the += method and it works just fine in the following code:
BigInt x = BigInt(2);
x += x;
x.print( cout );
The code will output 4. So, then I was working ...
I'm reading Introduction to 3D Game Programming with DirectX 10 to learn some DirectX, and I was trying to do the proposed exercises (chapter 4 for the ones who have the book).
One exercise asks to disable the Alt+Enter functionality (toggle full screen mode) using IDXGIFactory::MakeWindowAssociation.
However it toggles full screen mod...