General C++ Programming - July 2010

by Krahl
Error after long run time
 
hi, I have written a program where there are a number of sites around a circle and these sites may contain a particle or not. if site i has a particle and site...
[no replies]
Unexplainable Error
 
I have this program where I m trying to stimulate a queue. The program goes into an infinite loop, I dunno why. There's nothing wrong with any of my while loops...
[5 replies] Last: I revised the code & realise that allocation to the dynamic array tell... (by Suzanne)
stl priority queue sequence
 
Hello all, I have some stupid questions, but it would be great if some one helps. we know priority_queue of STL right ?? priority_queue<T, Sequence, Compare...
[4 replies] Last: Thanx. Thats exactly what i was looking for. U r cool. Thanx :D. (by dumbterminal)
by onako
Matrix transpose
 
I store matrix entries in std::vector<double>, such that the reading is row by row. This means, for matrix 1 3 4 8 9 3 3 6 8 1 1 2 2 0 9 8 ...
[15 replies] Last: I just ran a little benchmark. #include <iostream> #include <vect... (by helios)
by declan
How can I declare a derived class when declaring an array of its base class?
 
Hey guys, I have a class called Plane, with a few subclasses, roughly like this: class Plane{ public: //blahblah }; class Adiabatic : public P...
[3 replies] Last: A regular vector would not conform to RAII (in this case), so it is be... (by Athar)
Template Overloading
 
Hi there, I'm not sure the above is the correct term but is there anyway to overload a template class? For example I want to do the below but it doesn't s...
[3 replies] Last: something like this? template <typename T1, typename T2 = int, t... (by bigearsbilly)
boost::unordered_map / boost::multi_index_container
 
I was writing an abstraction for an ICU resource bundle (UTF-8 text file containing composite data). I would like to preserve the order of the elements found i...
[13 replies] Last: Yes, Boost.Variant is an option. The data is relatively simple and co... (by moorecm)
Converting inline assembler to .asm file
 
Hi all, I'm having a problem converting an inline assembler function to .asm file. I need seperate inline assembler code because in x64 architecture doesn't ...
[no replies]
by ibwood
Conversion type error
 
Hi everyone, In lines 126-129 of my code, I have this error: "expected constructor, destructor, or type conversion before "=" token" Please tell me wha...
[4 replies] Last: Thanks :) (by ibwood)
using nested struct slot as a type specifier?
 
a timespec from time.h looks like this on BSD: struct timespec { time_t tv_sec; long tv_nsec; }; I want to base a template on these types fro...
[5 replies] Last: They think of everything! Thanks for the info. (by kbw)
by pccX
STL set_intersection() and set container
 
I try to do a set intersection of two STL set containers and output into an STL set contrainer. I have tried to look around, but STL set data type does not hav...
[4 replies] Last: Tried to use a set<int>::iterator for what? The last parameter to set... (by jsmith)
bit-based swaping operation
 
I recently read a function that swaps two variable based on bit operation void swap(int &i, int &j) { i = i ^ j; j = j ^ i; i = i ^ j; }...
[4 replies] Last: (and anything that supports a bit-wise XOR operation). Duoas is ans... (by jsmith)
Generate 32 bits random PRIME number
 
Hello, may I know how to generate 32-bit random prime number? Pls reply asap. thanks
[3 replies] Last: http://cplusplus.com/forum/general/3551/ http://cplusplus.com/forum/b... (by Skillless)
is this static legal?
 
I understood this to be illegal, but it works on my gcc 4.2.1 struct seconds { static const int scale = 0; ... }; struct milliseconds : publi...
[4 replies] Last: it works ok with: -std=c++98 that's good enough for me. t... (by bigearsbilly)
Reading file into structre
 
I am trying to read in a file with the follwing data structure: typedef struct tld_msg { char* header; uint16_t type; uint16_t length; uint8_t data ; }...
[5 replies] Last: The data doesn't match the file format. And the string end ends with ... (by kbw)
position of automatic variables declaration wrt loops
 
In some code I'm looking over, I'm seeing a fair bit of this sort of thing : 1. Type *ptr; for( int i=0; i<count(); ++i ) { ptr = new Type; dosome...
[12 replies] Last: FWIW, I compile and run that exact code on my Ubuntu Linux system with... (by davidmaxwaterman)
by Colby
Calculate the displacement vector, velocity vector and total frames
 
I'm not even sure where to start, i had a horrible professor my last programming class, and i am struggling with the current one. here is what i need to do. ...
[no replies]
RSA in openSSL
 
Hello again, I've been looking on google on how to use openSSL's RSA functions but I can't seem to find any good examples, does anyone have a code snippet of...
[4 replies] Last: Not to sound rude, but that comment is extremely arrogant. I'm simp... (by Phantom139)
by ozair
VC++ 2010 graphics library
 
hello, I am trying to get started with openGL graphics library.. I do not have any knowledge about computer graphics so I searched the internet for some ...
[5 replies] Last: CWnd wraps the HWND parameter, so the 3 parameters of the CWnd method ... (by kbw)
Function callbacks
 
I wanted some help trying to create a callback function with C++. Below is a header file and I would like to make test_callback () a callback function, but do n...
[2 replies] Last: read through http://www.newty.de/fpt/callback.html (by Skillless)
July 2010 Pages: 123... 20
  Archived months: [jun2010] [aug2010]

This is an archived page. To post a new message, go to the current page.