c++

how to implemnt JSON simple parser in c++ ( can't use external libs )

Hi one of my clients want to implement JSON parser and reader in c++ he doesn't want to adopt third party lib. so i like to know where i can find simple implementation of JSON parser so i could adjust it or implement it in c++ Thanks ...

map iterator in template function unrecognized by compiler

I have the following code. template<class key,class val> bool has_key(key chkey,std::map<key,val> map){ for (std::map<key,val>::iterator it = map.begin(); #line 13 referenced by gcc it!=map.end(); ++it){ if(chkey == it->first) return true; } return false; } GCC is giving me the following error. objects.hpp: In functio...

error C2440: 'initializing' : cannot convert from 'LPVOID' to 'UINT

Im getting the following error while trying to convert code from C to C++: error C2440: 'initializing' : cannot convert from 'LPVOID' to 'UINT (__cdecl *)(LPVOID,UINT,LPWSTR,UINT)' Here's the piece of code causing problems: UINT (*GetString)( LPVOID rsrc, UINT res, LPWSTR buf, UINT len ) = (LPVOID)0x4347e0; How do I fix it? ...

SIP RTP Stack for IVR Application

I have an IVR application which plays the prompts and records the user message and detects the DTMF. Currently the application is based on SS7 signaling and uses the PSTN based media boards for media play / record functionality. Now I have to move this application to IP based solution. For this, I need any open-source / low-cost solutio...

Use next_permutation to permutate a vector of classes

Is it possible to use std::next_permutation() to permutate the elements of a vector of a class i created? How does the comparison parameter in next_permutation() work? ...

why does creating a local type vector fail

#include <iostream> #include <vector> int main() { class Int { public: Int(int _i) : i(i) {} private: int i; }; std::vector<Int> VI; } I try to compile the above code and got the following error message: foo.cc: In function 'int main()': foo.cc:13: error: 'main()::Int' uses local t...

How to combine a function and a predicate in for_each ?

How can you call a Function over some part of a container, using for_each() ? I have created a for_each_if() to do a for( i in shapes ) if( i.color == 1 ) displayShape(i); and the call looks like for_each_if( shapes.begin(), shapes.end(), bind2nd( ptr_fun(colorEquals), 0 ), ...

How to make Windows' Memo unfocusable or Label height = size of its content?

Hi! How to make simpe Memo to be unfocusable, so if an user will click on it, focus will not be moved to it? or How to make a Label automaticly word wrap if it's text width > width of a label and make it height = height of text * 'visible' lines count? Thanks! ...

Regarding C++ class access/manipulation in C.

Hello. I've been reading questions on Stack Overflow for a few weeks now... this'll be my first question. So recently I've looked into making C access/manipulate a C++ class. I understand that ideally one shouldn't compile components in C and C++ separately under normal circumstances, but this isn't an option at the moment. I looked in...

observable container for C++

Is there an implementation of container classes for C++ which support notification in a similar way as ObservableCollection for C#? ...

Boost.Test output_test_stream fails with templated output operator

I have a class: class foo { private: std::string data; public: foo &append(const char* str, size_t n) { data.append(str,n); } // for debug output template <typename T> friend T& operator<< (T &out, foo const &f); // some other stuff }; template <typename T> T& operator<< (T &out, foo const &f) { return out...

Template subclass pointer problem

In a moment of madness, I decided to write a quadtree C++ template class. I've run into some weird compiler error that I don't understand with regard to subclasses and pointers to templates. I've found some hacky work arounds, but I wondered if anyone could shed some light on why my code wouldn't compile... I'm on Linux, building with...

Is the primary implementation of *any* popular programming language interpreter written in C++?

At the moment I am considering whether or not to rewrite a programming language interpreter that I maintain in C++. The interpreter is currently implemented in C. But I was wondering, is the primary implementationbecause, certainly, people have made versions of many interpreters using a language other than the one used by the original a...

how to copy data?

I have a callback function which has the parameter const unsigned char *pData. everytime I hit the callback function I need to store the pData value into my local unsigned char* variable. Is there any function to copy the data? Edit: Here is a code sample: void Callbackfun(int x, const unsigned char* pData, const UINT cbData) { s...

Boost multi-index with slow insertion performance

I have the following code (which largely follows the first example here: http://www.boost.org/doc/libs/1_42_0/libs/multi_index/doc/examples.html)). For some reason, with only 10000 insertations to the multi-index, it takes several minutes to run the program. Am I doing something wrong or is this expected? struct A { int id; in...

Why Rich:toolTip not work Under rich:calendar

Why is Rich:toolTip not working under rich:calendar? <td> <rich:calendar id="valuereq" requiredMessage="Requested Date Required" inputClass="inside_text" value="#{projectDetailManageBean.projectDetail.requestDate}" datePattern="M/dd/yy" required="true"> <rich:toolTip for="valuereq">Select Request Date</rich:toolTip> </rich:calend...

pure virtual function and abstract class

I have the following classes, Base and Derived and when I compile the compiler complains that it cannot create an instance of DLog because it is abstract. Can someone tell me how I can fix this error? I'm guessing it's because not both pure virtual functions are not implemented in the Derived. class Logger { public: virtual void ...

On Passing a 2D-Array into a function.

This is not so much a question on, "How do I pass it into the function?" but rather, "Is this acceptable?" void func( int **ptr ); int main( int argc, char* argv[] ) { int arr[][3] = {{1, 2,}, {3, 4}, {5, 6}}; int *pArr = *arr; (&pArr[0])[1] = 3; func(&pArr); cin.get(); return 0; } void func( int **ptr ) { ...

assigning / validation of signature using RSA (PKCS 7)

Any suggestions for simple and fast library for assigning / validation of signature using RSA Cryptographic Messaging Operations (PKCS#7)? ...

header files and using namespace ...

Someone once hinted that doing this in a header file is not advised: using namespace std; Why is it not advised? ...