c++

is there is any way to get xml value by tag in rapid xml using c++

hello, is there is any way to get the value of tag by its tagname in rapidxml using c++ <?xml version=\1.0\ encoding=\latin-1\?> <book>example</book> <book1>example1</book1> i need to get the book value ie example and book1 value ....we can use this doc.first_node()->value() get first node and next node but i need to is there is any w...

Variable dissapears in binary which is available in static lib

Hi, I have the problem mentioned. I create an object inside a static lib, it is there when I run nm on the static lib, but when i link the lib to a binary and run nm it has disappeared. I know this problem has been asked before, but I could not find any answers. It is important for me to be able to retain that variable in the binary ...

C#: How do I instantiate a class in C#, like showin this C++ example.

I've translated the following C++ code to C#, but i cant determine where and how to put the class instance. If i do it using: customAnalysis test = new customAnalysis(); It receive an errormessage, telling me that the class is instantiated by Rhino3D, and therefore i'm not supposed to do it. But i need to create a reference to the cl...

how to convert a boost::weak_ptr to a boost::shared_ptr

i have a shared_ptr and a weak_ptr typedef boost::weak_ptr<classname> classnamePtr; typedef boost::shared_ptr<x> xPtr; how to convert a weak_ptr to a shared_ptr shared_ptr = weak_ptr; Xptr = classnameptr; ????? ...

struct reference and operator=

Hi.I have a class like this: template <class T> class bag { private: typedef struct{T item; unsigned int count;} body; typedef struct _node{_node* prev; body _body; _node* next;}* node; struct iterator{ enum exception{NOTDEFINED, OUTOFLIST}; body operator*(); ...

Reducing number of template arguments for class

Hi, I have a method and two classes defined like this: template<template<class X> class T> void doSomething() { T<int> x; } template <class T> class ClassWithOneArg { T t; }; template <class T1, class T2> class ClassWithTwoArgs { T1 t1; T2 t2; }; I can now doSomething<ClassWithOneArg>(); but I cannot doSomethi...

shared_ptr gets destroyed before I can use it properly

I have the following code, which is supposed to add a shared_ptr instance to an intrusive linked list by thread A. Some other consumer thread will then use it later on by removing it from the list. However at a certain point my shared_ptr seems to get destroyed and the reference to it in the linked list is no longer valid resulting in ...

VS2010 Ultimate where do I get my .exe ?

Sorry for the dumb question... I'm trying to make a simple executable that reads something from a file (in same folder) with ifstream and processes it.. I made an "empty c++ project", added a main.cpp to source files, tried to run it as debug/release, tried to rebuild the solution.. have searched all the subfolders in my Projects folder...

Xcode not displaying console output when compiling with gloox

Hi I'm currently messing around with gloox and having problems displaying console output in Xcode 3.2.3. I've tried compiling the example from the website and that works. However, when I try to print anything into the console, I get nothing. This only happens when I am initializing the library. As soon as I remove reference to it and s...

Unary Operator-() on zero values - c++

I wrote this code to overload the unary operator- on a matrix class: const RegMatrix RegMatrix::operator-()const{ RegMatrix result(numRow,numCol); int i,j; for(i=0;i<numRow;++i) for(j=0;j<numCol;++j){ result.setElement(i,j,(-_matrix[i][j])); } return result; } When i ran my program with...

Trouble with inheritance of operator= in C++

I'm having trouble with the inheritance of operator=. Why doesn't this code work, and what is the best way to fix it? #include <iostream> class A { public: A & operator=(const A & a) { x = a.x; return *this; } bool operator==(const A & a) { return x == a.x; } virtual int get() = 0; ...

How google docs shows my .PPT files without using a flash viewer?

I want to show .ppt (PowerPoint) files uploaded by my user on my website. I could do this by converting them into Flash files, then showing the Flash files on the web page. But I don't want to use Flash to do this. I want to show it, like google docs shows, without using Flash. I've already solved the problem for .pdf files by convertin...

Is there a version of the VC++ 2008 Redistributable Package with the DEBUG dlls?

Hello All, We have a (mainly) C#/WPF application that invokes some C++ libraries via interop. For testing purposes (and because of some inconsistencies in a third party library), we would like to distribute a debug version or our application on a target machine, partially for remote debugging. In any case, when doing so, the program b...

Is there a ReSharper-like tool for C++ projects?

I'm searching tool like ReSharper for C++. I want to have a more flexible refactoring tool than Visual Assist. It is really really good but if there exists a tool like ReSharper for C++, I want to know the tool's name. ...

Replace\remove character in string

Hello, string DelStr = "I! am! bored!"; string RepStr = "10/07/10" I want to delete all '!' on DelStr and I want to replace all '/' with '-' on the RepStr string. Is there any way to do this without doing a loop to go through each character? ...

Forward declare FILE *

How do I forward declare FILE * in C? I normally do this using struct MyType;, but naturally this doesn't appear to be possible. If behaviour differs between C standards or compilers and with C++, this is also of interest. Update0 Why I want to do this aside: What I'm asking is how to forward declare a non-struct/"typedef'd struct" ty...

Joining two programs one with main() one with WinMain()

I want to combine two programs into a single executable. One is an open source program that has a rather complex project file, the other is one of mine with a much simpler structure. Because of the relative complexities of the project files I feel it would make most sense to start with the open source project and modify it to include my ...

C++: how to convert date string to int

Hi I need a procedure that convert string time to int. Which support all this formats under unix: "Wed, 09 Feb 1994 22:23:32 GMT" -- HTTP format "Thu Feb 3 17:03:55 GMT 1994" -- ctime(3) format "Thu Feb 3 00:00:00 1994", -- ANSI C asctime() format "Tuesday, 08-Feb-94 14:15:29 GMT" -- old rfc850 HTTP form...

Expression template operator overloading problem with std::vector.

I'm currently working on a numerical library that uses expression templates. Unfortunately I encountered a problem with my operator overloads. Consider the following stripped down example. #include <vector> namespace test { class test {}; template<class A, class B> class testExpr {}; template<class A, class B> tes...

Defining operator< for a struct

I sometimes use small structs as keys in maps, and so I have to define an operator< for them. Usually, this ends up looking something like this: struct MyStruct { int a; int b; int c; bool operator<(const MyStruct& rhs) const { if (a < rhs.a) { return true; } else if (a ==...