Well, I posted it on Monday, so there goes that theorem ;)
I will finish the program in a simple way first, but I was also asking out of curiosity.
Also, the program is a memory latch-up test...
Type: Posts; User: Marksman
Well, I posted it on Monday, so there goes that theorem ;)
I will finish the program in a simple way first, but I was also asking out of curiosity.
Also, the program is a memory latch-up test...
I have a large chunk of memory that I want to bit-wise complement. Since I want it to be fast, I don't really want to go byte by byte. What's the best way to do this?
Here's a first implementation...
Hi,
I'm looking for an algorithm to find the longest prefix of a certain string. This is not longest common substring (not directly anyways).
For example, for the strings
string1 = "01234567"...
Argh! I forgot the braces around the switch statement in all of my examples...
switch (val)
{
case 0:
e1;
e2;
...
Ah, Ok. I think I get it now.
The actual code I was working on looked like this:
switch (val)
case 0:
e1;
e2;
...
en;
Ok, but why does it allow me to declare a variable if it's the second statement? seems like an arbirary rule, but I'm sure there's some explanation
int main() {
switch (0)
case 0:
;...
Just wondering why exactly this produces an error in gcc:
int main() {
switch (0)
case 0:
int a;
return 0;
}
hmm,... actually I didn't expect funcB( &s ) to work
but I guess it does!
I thought since s was already a reference, that taking the address of s would be some kind of a double pointer. But I...
Hi,
I have a function that gives me a string reference:
int funcA (string &s)
{ ...}
and within there I need to call a function that takes a void pointer:
int funcB(void *v) { ...}
Yeah you're right. I put the array outside of the class definition and made it static.
Hi,
Thanks for your reply.
Yes I should be more clear. ch_map will be constant and the size will not change. Also there should be only 3 characters in the initialization strings (I actually was...
Hi,
I have a header file with a declaration like this:
class MyClass
{
char ch_map[][4];
}
then in the cpp file I want to have something like this:
Yeah that's true. In my actual program I only had 4 variables, so it was manageable.
Otherwise the vector/list approach would definitely be better.
sorry I must have had a brain fart ...
a < b && b < c && c < d
etc...
my post probably wasn't clear, I was just looking for that
Oh sorry, by 'order' I meant just numerical order. For example
3 < 4 < 5 < 6
should be true and
3 < 5 < 4 < 6 should be false
I want to check the ordering of numbers in an if statement, for example, in pseudo-code:
if a < b < c < ... < z
then do something magical
else quit
Is there an easy way to do this?...
Thanks,
Yeah, the GUI needs to be part of the system. But I would still need event-driven programming even without the GUI.
After reading some other threads, like...
I'm look for advice or references to help me code a multi-layer event driven system.
The software is broken up into several layers:
The bottom layer is in an infinite loop. It takes input from a...
Great, thanks. I'll just switch them to pointers and keep it simple for now.
Could someone remind me why this doesn't work? I don't know much about constructors and such.
typedef struct
{
int a;
// etc... all primitive types
} Blob;
Hmm... I've just realized that I need to add a third parameter to each vector element - a double: the "score" of each pair. Then I want to sort the vector based on the score.
Is there such a thing...
How would I use a reference? Do you mean in the parameters of the function?
Would it be:
void f ( std::vector<Blob> &blobsPtr )?
And would calling the function be different? Right now I...
Well, std:: pair seemed to help out. Here's what I came up with, which seems to work.
void filterPairwise(const IplImage *im, vector<Blob> *blobsPtr)
{
// create the vector to store every...
Cool, thanks. I'll look up std:: pair and hack around for a bit. That should simplify things.
Hi,
I have a function as below:
void f ( std::vector<Blob> *blobsPtr )
{
// create the vector to store every pair of pointers to Blobs
vector<Blob*[2]> pairs;