Iterating over a NULL terminated string using for_each is possible:
const char *name = "Bob";
void func(const char &arg)
{
cout << arg;
}
int main()
{
for_each(name, name + strlen(name), func);
}
Is something similar possible for a NULL terminated list of strings (without having to determine the total length of the list first...
We are getting these constraint errors wherver OSAF calls like m_NCS_SEL_OBJ_ZERO(&nSelObjSet) is called in our code. This is while cross compiling using tilera compiler - tile-g++. With g++ it always compiles fine. Any pointers would be helpful.
Note: m_NCS_SEL_OBJ_ZERO is a macro and replaced by FD_ZERO
Sample Code:
// initialise a...
I'm having issue with calling a method with l-value of an abstract class. The class definition is:
class SimulatorSequenceItemBase {
public:
SimulatorSequenceItemBase();
virtual ~SimulatorSequenceItemBase();
virtual uint32_t GetResult(uint32_t p_nSite) = 0;
virtual bool MoveNext(SimulatorSequenceItemBase& p_rNext) = 0;
...
Hi all. I have a question related to MFC application: is it possible for an MFC application to receive "select" or "WM_COMMAND" event for MENUITEM separator?
MY OBJECTIVE: when a user performs right-click in the program, a pop-up menu is created with an "auto-hide" functionality. Meaning: the pop-up menu stays when the mouse is inside t...
Hello,
How to implement in c++ the operator() and operator* (multiplication) for this Matrix class?
class matrix {
static const int MAX_SIZE=100;
T operator()(int, r, int c) const;
matrix& operator*(const matrix& N) const;
private:
int r_, n_;
struct elem{
T content;
int row, col;
elem* next_row;
elem* next_co...
I want a similar function similar to the VC++ GetThreadTimes function to work on solaris. I need a monitoring tool to monitor thread and monitor execution time from another thread. Is there a direct way of doing this?
I have found that getrusage() can do this only to get the value of times() for the calling thread. But I what I want to...
Hello all,
You have a class that many libraries depend on. You need to modify the class for one application. Which of the following changes require recompiling all libraries before it is safe to build the application?
add a constructor
add a data member
change destructor into virtual
add an argument with default value to an existing m...
I finally got a section of my code to run in parallel with OpenMP without errors. When I deployed the dll to another machine, however, it no longer ran in parallel.
Logging reveals that omp_in_parallel() == 0 on the other machine but not on mine.
My machine is using an Intel i5 CPU which has 2 hyperthreaded cores for an effective omp_g...
Which open source implementations of a tree (with arbitrary number of children per node; nodes containing a small data type like int or a pointer (additional to the implementation-specific indexing data, of course)) in a (linear) buffer do exist? (Obviously, the maximum number of tree nodes is bounded by the buffer size)
(Graph instead ...
Hi all,
i am trying to compile example source code which is using the OpenGL, SDL and IL aka DevIL aka OpenIL libraries. OpenGL and SDL are available as native frameworks, but DevIL isn't. So here is what i did:
I installed DevIL via homebrew. First i changed the Formula, because i need ILUT:
brew edit devil
then edited these lines
...
Possible Duplicate:
C++ concatenate string and int
Hi,
In C# I can write like this:
int i = 0;
string text = "out.jpg";
while(true)
{
i++;
Object.write(i+text, stream);
}
But this is not true for C++. the problem is at: i + default.
How could I fix this in C++?
Thanks in advance. Your help is much appreciated!
...
Given GMan's deliciously evil auto_cast utility function concocted here, I've been trying to figure out why it doesn't compile for me when I'm trying to auto_cast from an rvalue (on MSVC 10.0).
Here's the code that I'm using:
template <typename T>
class auto_cast_wrapper : boost::noncopyable
{
public:
template <typename R>
fr...
i have read about this metrial and i am still dont understand it's core
e.g:
public static void Main()
{
person []p = new person[]{new student(),new worker()};
}
public class person
{
public void f1() { }
public virtual void f2() { }
}
public class student:person
{
public override void f2() { }
}
public class worke...
I have the following code , which gets a return value from a function as char*
cDestDrive = ReadFromRegistry(HKEY_CURRENT_USER,NDSPATH,szDestPathRoot);
I am able to read the value inside cDestDrive till the time I am assigning it. The moment I am assigning it:
CString strServerAddress = cDestDrive;
the value of cDestDrive gets ch...
I tried profiling my application with OProfile recently. The data gathered is already very valuable to me, but I'm having difficulties with its precise interpretation. After running my app with oprofile set up and running, I generated the report and got:
root@se7xeon:src# opreport image:test -l -t 1
Overflow stats not available
C...
I think I do understand "the basic IDEA" of move semantics, but now when I'm on the stage of implementing my own map I stopped and started to think about it when I was going to write a use case and walk through for move ctor of map. Correct me if I'm wrong but what I do understand how the whole business of move semantics works is that th...
Hi,
I'm wondering can I use static libraries (lib*.a files) compiled with one
version of MingW and use them on the other version ? Or do I have to recompile all libraries ?
...
Hello guys, I'm writing a program to parse some data saved as text files. What I am trying to do is find the location of every needle in a haystack. I already can read the file in and determine the number of occurrences, but I am looking to find the index also.
Thanks,
-Tom
...
Hi, I'm trying to understand how boost interprocess library works.
I have an Equipment class which holds integer values in a vector container.
In parent parent process;
I constructed Equipment object in MySegmentObject segment, and in the constructor of this object I created the vector in MySegmentVector segment.
Using child process;...
Hello,
I have another problem I can't seem to solve..., or find on this site...
I have an object (called DataObject) with a map, declared as follows:
std::map<size_t, DataElement*> dataElements;
Now i have a copy function (used in the copy constructor):
void DataObject::copy(DataObject const &other) {
//here some code to clean...