I made a post about this yesterday, but it is a fairly different question. Not sure if I should make a new question or just reply to the old one but here goes.
Basically I am setting up my vector array of structs as follows..
class Debugger : public Ogre::SimpleRenderable
{
struct DebugVertex
{
Ogre::Vector3 v;
...
Given 2 classes:
...
class Grades{
public:
Grades(int numExams) : _numExams(numExams){
_grdArr = new double[numExams];
}
double GetAverage() const;
...
private: // The only data members of the class
int _numExams;
double *_grdArr;
};
class Student{
public:
Student(Grades g) : _g(g){
}
......
Can I have a project that has some parts written in c and other parts written in c++ ?
Is this possible ?
...
e.g.
int a=3;//-----------------------(1)
and
int a_long_variable_name_used_instead_of_small_one=3;//-------------(2)
out of (1) and (2) which will acquire more memory space or equal space would be aquire?
...
While compiling
#include "windows.h"
#include "stdafx.h"
#include "resource.h"
#include "ProgressDlg.h"
....
...
rItem.lParam = (LPARAM)(DWORD_PTR) m_lsStatusMessages.back().c_str();
I am getting the error C2065: 'DWORD_PTR' : undeclared identifier
Am I missing any Includes.
...
I have a range of memory to parse. If I find a certain sequence of bytes before the end, I interrupt the iteration. I wonder which loop I should prefer here:
while(i < end && !sequenceFound ) {
// parse
i++;
}
Or
for( i; i < end && !sequenceFound; i++ ) {
// parse
}
This is used in a method of a class that derives from ...
Is this even possible?
...
For my very own little parser framework, I am trying to define (something like) the following function:
template <class T>
// with operator>>( std::istream&, T& )
void tryParse( std::istream& is, T& tgt )
{
is >> tgt /* , *BUT* store every character that is consumed by this operation
in some string. If afterwards, is.fail() (whi...
I have a solution which contains both C# and C++/CLI projects. My problem is that the C++ projects are always out of date, and the IDE keeps asking if I want to build them.
There are some custom build steps, which copy some files here and there, and I suspect that might cause the issue (?). I'd be fine with disabling up-to-date check f...
I want to know if I have a static variable within a class member function if that variable will only have an instance for that class or for each object of that class. Here's an example of what I want to do.
class CTest
{
public:
testFunc();
};
CTest::testFunc()
{
static list<string> listStatic;
}
Is listStatic per instance or p...
I hav a a shared library lib.so containing a class Foo. I'm dynamically loading (with dlopen on UNIX) lib.so. After loading I want to create an instance of Foo.
Can I simply use new operator to create an object of Foo, or I would have to create an exported factory method placed in lib.so that will create that object for me?
Actually t...
I'm currently having fun trying to learn some of the Boost libary. I'm currently doing what I guess will be a future homework project (semester hasn't started yet). However, this question is not about the homework problem, but about Boost.
Code:
/* AuctionApplication.h */
class AuctionApplication : boost::noncopyable
{
private:
boo...
We have a lot of native C++ static libs and DLL's that make up our application. In VS2010 it is possible to use references for native C++ projects between the dependend projects to force the correct build order. We used to do this with project dependencies but they were stored at the solution level.
We do not share solutions, only the p...
This is my code:
typedef std::hash_multimap<Vertice<VerticeType, WeightType>*, Edge<VerticeType, WeightType>*> ght;
std::pair<ght::iterator, ght::iterator> getEdgesFromVertice(Vertice<VerticeType, WeightType>*);
When I try to compile it, it gives me an error saying:
error: type/value mismatch at argument 1 in template parameter list ...
Direct Question: How do I create a simple hello world CUDA project within visual studio 2010?
Background: I've written CUDA kernels. I'm intimately familiar with the .vcproj files from Visual Studio 2005 -- tweaked several by hand. In VS 2005, if I want to build a CUDA kernel, I add a custom build rule and then explicitly define the...
i'm having truble with deleting my template
my template and distructor :
template<class S, class T>
class Consortium
{
private :
map<const S, Node<T>*> m_consortiumMap;
Heap<T>m_consortiumHeap;
public :
~Consortium();
void Insert(const S key, T toAdd);
void Update(const S key);
void Remove(const S key);
...
Hello, we have a funny problem with try catch and std::runtime_error.
Can someone explain to me why this is returning "Unknown error" as output ?
Thanks very much for helping me !
#include "stdafx.h"
#include <iostream>
#include <stdexcept>
int magicCode()
{
throw std::runtime_error("FunnyError");
}
int funnyCatch()
{
try{
...
Hello
I am using expat to read an xml file. I want to populate some of my class member variables from the configruation specified in thexml file. I have defined my startelement handler,
void Start(void *data,const XML_Char *el, const XML_Char **attr)
and this will be referenced as following:
XML_SetElementHandler(parser,Start, NULL...
I'm trying to count the number of chars in a char array including the space until the end of the string.
The following compiles but doesn't return the correct value, I'm trying to use pointer arithmetic to interate through my array.
int numberOfCharsInArray(char* array) {
int numberOfChars = 0;
while (array++ != '\0')...
This is a repost of a question that went unanswered
basically I am trying to model a map that has the following format:
Each brush defines a solid region. Brushes define this region as the intersection of four or more planes. Each plane is defined by three noncolinear points. These points must go in a clockwise orientation:
1--2-----...