Hello everyone,
I am using MacBook Pro Mac OS 10.5 with related version of XCode. I am new to this development environment. I am developing C++ console/terminal applications (File->New project, then from the list on the left "Command line utility", and on the right "C++ tool".).
When statement like std::cout executes, I think the outpu...
I need to allow the user to change members of two data structures of the same type at the same time. For example:
struct Foo { int a, b; }
Foo a1 = {1,2}, a2 = {3,4};
dual(a1,a2)->a = 5;
// Now a1 = {5,2} and a2 = {5,2}
I have a class that works and that change first a1 and then copy a1 into a2. This is fine as long as:
the class ...
Let's say I create 5 objects, all from the same class. Would the byte offset of the first object be 0? How would I find out the byte offset of the other objects?
...
I have to parse a xml file in C++. I was researching and found rapidxml library for this.
I have doubt about "doc.parse<0>(xml)"
can xml be .xml file or it needs to be a string or char *?
If can take only string or char * then I guess I need to read the whole file and store it in a char array and pass the pointer of it to the functio...
If i have a pointer to an object that has an overloaded subscript operator ( [] ) why cant i do this:
MyClass *a = new MyClass();
a[1];
but have to do this instead:
MyClass *a = new MyClass();
(*a)[1];
...
hi,
Within a class, I am trying to sort a vector, by passing a method of the same class. But it gives errors at the time of compilation. Can anyone tell what the problem is? Thank you!
it gives the following error:
argument of type bool (Sorter::)(D&, D&)' does not matchbool (Sorter::*)(D&, D&)'
I have also tried using sortBynumb...
In the Java Generic Book, while contrasting the difference between C++ Templates and Java Generic says:
In C++, a problem arises because >>
without the space denotes the
right-shift operator. Java fixes the
problem by a trick in the grammar.)
What is this trick?
...
I am trying to use time() to measure various points of my program.
What I don't understand is why the values in the before and after are the same? I understand this is not the best way to profile my program, I just want to see how long something take.
printf("**MyProgram::before time= %ld\n", time(NULL));
doSomthing();
doSomthingLo...
Two years ago, I used the conio.h (actually conio2.h for Dev-C++) to create a console form interface. Now I want to make the same thing, but C++ std lib does not provide the needed functions and I don't want to use the old C conio lib.
I found some websites which highlights the constream lib, but I have no idea to use it on VS!
I trie...
I am implementing a templated sparse_vector class. It's like a vector, but it only stores elements that are different from their default constructed value.
So, sparse_vector would store the lazily-sorted index-value pairs for all indices whose value is not T().
I am basing my implementation on existing sparse vectors in numeric librar...
I understand it should cover threading primitives (mutex, semaphore, condition variables etc.) plus design patterns (such as those specified in POSA2). But what's more? Every project has its own multithreading scenarios and one may have not dealt with those that the job is expecting?. So how does one build their knowledge and prove that ...
There is an existing question regarding difference between Mutex and Critical section but it does not deal with Locks also.
So i want to know whether Critical sections can be used for thread synchronisation between processes.
Also what is meant by signalled states and non-signalled states
...
Say that you are several levels deep into a recursive function. The function was originally called in main. Is there a way for you to break out of the recursion and go straight back to main without having to go through all the other functions above?
...
Hi,
How to implement the ls "filename_[0-5][3-4]?" like class? The result I would like to store in the vector.
Currently I am using system() which is calling ls, but this is not portable under MS.
thanks,
Arman.
...
Hi,
In my application I have two object type. One is field item, other is composite item.
Composite items may contain two or more field items.
Here is my composite item implementation.
#include "compositeitem.h"
CompositeItem::CompositeItem(QString id,QList<FieldItem *> _children)
{
children = _children;
}
CompositeItem::~Composit...
#include <iostream>
using namespace std;
int recur(int x) {
1 and recur(--x);
cout << x;
return x;
}
int main() {
recur(10);
return 0;
}
...
Hi,
I asked this question earlier as well:
http://stackoverflow.com/questions/2773168/lnk2005-delete-already-defined-error-in-vc
The answer I got was that I should be using dynamic version of DLLs. I did that and it compiled fine.
Now, but when I gave the exe to one of my colleagues to run, they told me - they can't run it as it requi...
My CGameStateLogo which inherit from CGameState:
CGameState.h
#pragma once
#include "GameMain.h"
#include "MyBitmap.h"
class CGameMain;
class CMyBitmap;
class CGameState
{
public:
CMyBitmap* pbmCurrent;
CGameMain* pGM;
int GameStateID;
virtual void MessageEnter () = 0;
virtual void MessageUpdate( int iKey ) = 0;...
Hi all,
I am writing a Songbird addon, with three parts: XUL (javascript), a GStreamer filter and an XPCOM addon.
I am interested in accessing the GStreamer layer from my XPCOM component. If anyone knows any resources on how to do that I'd be grateful.
Specifically, I need documentation or examples on accessing the GStreamer functiona...
I want to have a simple class i can call to get a unique number whilst the program is running - i can do the below with a dynamic allocation, and then just delete when not needed, but i still wanted to get a static version too.
Strangely, the code below (which is seemingly straightforward) throws some strange comiple errors (appended bel...