I'm trying to write a class which contains several std::vectors as data members, and provides a subset of vector's interface to access them:
class Mesh
{
public:
private:
std::vector<Vector3> positions;
std::vector<Vector3> normals;
// Several other members along the same lines
};
The main thing you can do with a mesh is add pos...
Hi,
I'm trying to code the following situation:
I have a base class providing a framework for handling events. I'm trying to use an array of pointer-to-member-functions for that. It goes as following:
class EH { // EventHandler
virtual void something(); // just to make sure we get RTTI
public:
typedef void (EH::*func_t)();
protect...
I've recent been reading about immutable strings, here and here as well some stuff about why D chose immutable strings. There seem to be many advantages.
trivially thread safe
more secure
more memory efficient in most use cases.
cheap substrings (tokenizing and slicing)
Not to mention most new languages have immutable strings, D2.0,...
I am using boost::program_options like this:
namespace po = boost::program_options;
po::options_description desc("Options");
desc.add_options()
("help,?", "Show Options")
("capture-file,I", po::value<string>(), "Capture File")
("capture-format,F", po::value<string>()->default_value("pcap"), "Capture File Format")
("output-fil...
Hi,
I am new to linux and unaware of how to change the version of g++ to 4.5 . I need to do that in order to execute c++0x programs.
Thanks.
...
At my work we recently finished the system architecture for a control application which has a maximum latency of roughly one to two seconds. It is distributed on small ARM on-chip boxes communicating via an IP LAN.
We initially foresee that we would use C or C++, since it is a classical control system language. After discussing how to ...
Hi all,
I am trying to compile the latest version of Qt for the mac (from Gitorius). When I try to compile this (by doing ./configure and then make), I get the following error while running make:
../../include/QtCore/../../src/corelib/kernel/qvariant.h: In function ‘T qvariant_cast(const QVariant&) [with T = QVariant]’:
../../include/Q...
Using C++, I would like to obtain the DNS servers being used by a host for three operating systems: OS X, FreeBSD, and Windows. I'd like confirmation that the approaches below are indeed best practice, and if not, a superior alternative.
OS X: already answered; updated link at developer.apple.com
Windows: GetNetworkParms
FreeBSD: /etc...
The code of Game.h:
#ifndef GAME_H
#define GAME_H
class Game
{
public:
const static string QUIT_GAME; // line 8
virtual void playGame() = 0;
};
#endif
The error:
game.h(8): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
game.h(8): error C2146: syntax error : missing ';'...
Hi. I have this class that has a static member. it is also a base class for several other classes in my program. Here's its header file:
#ifndef YARL_OBJECT_HPP
#define YARL_OBJECT_HPP
namespace yarlObject
{
class YarlObject
{
// Member Variables
private:
static int nextID; // keeps track of the next I...
Why won't this compile?
#include <functional>
#include <boost/function.hpp>
class A {
A() {
typedef boost::function<void ()> FunctionCall;
FunctionCall f = std::bind1st(std::mem_fun(&A::process), this);
}
void process() {}
};
Errors:
In file included from /opt/local/include/gcc44/c++/bits/stl_func...
I'm trying to get the frames (properly decoded) and the frames delay times from an animated gif. I've opened up the code to gifsicle and have also tried lungif but I'm not accustomed to c code and I'm having a difficult time following the logic. I've also tried other examples and I've gotten one to work but it didn't do the proper LZW ...
Given a class like this:
class Foo
{
const int a;
};
Is it possible to put that class in a vector? When I try, my compiler tells me it can't use the default assignment operator. I try to write my own, but googling around tells me that it's impossible to write an assignment operator for a class with const data members. One post I...
Hi, I am looking for some basic information regarding makefile structure. Any pointers will be highly appreciated. Thanks.
...
Arrays, functions, pointers, references, classes, unions, enumerations and pointers to members are compound types.
My understanding of a compound type is that is based on other type(s). For example, T[n], T* and T& are all based on T. Then what other type(s) is an enumeration based on?
Or if my understanding of compound types is incorr...
edit
Clafification: The intention is not to remove the node from the original list. But to create an identical node (data and children wise) to the original and insert that into the new list. In other words, a "move" does not imply a "remove" from the original.
endedit
The requirements:
Each Node in the list must contain a reference...
hello, i need some help with haar transformation, i have to apply it on an image.
My math is bad, my english not all that awesome and i find it hard to understand from articles on the internet. I found this page http://www.cs.ucf.edu/~mali/haar/haar.cpp where the haar transformation is applied on 2d matrix. I suppose if i give image pixe...
Wanting to dive in to some FOSS contributions using C++ .
Any recommendations? If possible, I would like to keep using Visual Studio if possible. :P
Thanks SO!
...
This is my first multi-threaded implementation, so it's probably a beginners mistake. The threads handle the rendering of every second row of pixels (so all rendering is handled within each thread). The problem persists if the threads render the upper and lower parts of the screen respectively.
Both threads read from the same variables,...
Hello everyone :)
This is a revised/better written version of the question I asked earlier today -- that question is deleted now.
I have a project where I'm getting started with Google Mock. I have created a class, and that class calls functions whithin the Windows API. I've also created a wrapper class with virtual functions wrapping ...