I'm having some problems on returning the parameter of a method as a template, look:
// CTestClass.h
template<class T>
class CTestClass
{
public:
T getNewValue();
};
// CTestClass.cpp
template<class T>
T CTestClass<T>::getNewValue()
{
return 10; // just for tests I'm returning hard coded 10
}
// main.cpp
int _tmain(int argc...
What software do you suggest to check spelling of comments contained in c/c++ source code (especially doxygen comments)? I'm looking something that will parse only comments so I can easily find mistakes and correct them.
The question is general but to be more specific - I'm using CodeLite IDE.
...
I am looking to revive some old C++ code, developed in Turbo C++ for DOS. It's a console-based text game.
This app makes heavy use of conio.h - the Turbo C-specific functions (I think) gotoxy(), window() and the like.
I find that Turbo C++ compiler is no longer available for download. Embarcardero/CodeGear/Borland seem to have removed...
Hi
I'm a cpp newbie and i have a little question:
this is my header:
#ifndef TIMING_H
#define TIMING_H
#define MAX_MESSAGES 1000
typedef Message* MessageP; //inside the class?
class Timing {
public:
Timing();
private:
struct Message {
Agent *_agent;
double _val;
};
MessageP* _msgArr;
int _waitingMsgs;
};
my questio...
Why in this code (this is just working code and not fully exception safe) I'm getting an assertion error:
HEAP_CORRUPTION_DETECTED ...
class Allocator
{
public:
explicit Allocator()
{
std::cout << "Allocator()" << '\n';
}
virtual ~Allocator()
{
std::cout << "~Allocator()" << '\n';
}
tem...
I'm working on a little project that uses DirectShow/COM for capture, and DShow makes callbacks using its own threads when my application gets imaging data.
I'm also using Qt in my project, and I'm wanting to use Qt for synchronisation and thread-safety. I'm wondering how I can use Qt Threads in this case.
I understand I can also use W...
Updated question to reflect answers and my research
Thanks casablanca and wallyk for answering. Success!! I ended up having to edit my strcpy and strcat as well as changing my Displayname(char c_fullname) function and researching some more about the additional errors (both complier and runtime) I was getting, but now I have working code...
#include "stdio.h"
#include "conio.h"
void swap(int *x,int *y);
void main()
{
int a=10,b=20;
swap(a,b);
printf("value of a=%d and b=%d");
getch();
}
void swap(int *x,int *y)
{
if(x!=y)
{
*x ^= *y;
*y ^= *x;
*x ^= *y;
}
}
// I'm getting .. cann't convert int to int * ...
can anybody tell me why ...
I just started programming yesterday, I'm using the C++ language and i was wondering if anyone here could help me get off on the right foot, thanks!
...
Hey everyone,
I'm going to my second year of Computer Science at a local University, in which C++ is a large part of the education, but as they only give an introductory course in the first year (basics, pointers, creating a linked list and an implementation of a game like Mastermind), I'd like to program a bit in my free time to crank ...
Hi folks I am planning on recording audio, and later play it back, for on of my projects. The requirement is that it should be c++ ( Visual studio 2008 ) compatible. Rest of our application is mostly in silverlight/ VC++. I have worked with NAudio before in C#, but nothing on vc++.
I would like to know what is best suited for my needs...
Is the Linker part of the Operating System or the Compiler/IDE?
...
code snippet:
// some code
SDL_Surface* t = Display->render_text(text);
int z=100;
Display->blit_image(t,z,100);
// some more code
does not compile because z magically changes to an int&,
file.cpp:48: error: no matching function for call to ‘display::blit_image(SDL_Surface*&, int&, int)
how can this happen?
post scriptum:
the follow...
This was prompted by some experimenting with C/C++; neither the statement
printf("\a");
nor the statement
cout << "\a";
produce an audible bell sound. How is the \a supposed to function . . .
...
I'm making a 3D FPS with OpenGL and here is the basics of how it works. The game is a 3D array of cubes. I know the location of the player's current cube, aswell as the camera x,y,z and I know the x, y, z rotation of the camera too. Right now I just make a square around the player and render this and then add distant fog. The problem tho...
std::string str = "string":
const char* cstr = str.c_str();
str.clear();
//here, check if cstr points to a string literal.
How do i check if cstr still points to a string when running the program in debug or release mode?
Would there be a way to determine this using exception handling in C++?
...
I've been experimenting with embedding different scripting languages in a C++ application, currently I'm trying Stackless Python 3.1. I've tried several tutorials and examples, what few I can find, to try and run a simple script from an application.
Py_Initialize();
FILE* PythonScriptFile = fopen("Python Scripts/Test.py", "r");
if(Pyth...
Is there a structure in Python which supports similar operations to C++ STL map and complexity of operations correspond to C++ STL map?
...
Hi,
I'd like to place the last three values of vector v_2 in three variables (one value per variable).
Is there a faster or simpler way to do this?
struct Desempenho {
double maximo;
};
double ultimo, penultimo, antepenultimo;
Desempenho d;
int n (0);
vector<Desempenho> v_2;
d.maximo=1.1;
v_2.push_back(d);
d.maximo=2.2;
...
Hi, I am trying to implement the codebook foreground detection algorithm outlined here in the book Learning OpenCV.
The algorithm only describes a codebook based approach for each pixel of the picture. So I took the simplest approach that came to mind - to have a array of codebooks, one for each pixel, much like the matrix structure und...