c++

boost::intrusive_ptr constructor ambiguity using a class' 'this' pointer

The offending code: template<typename T> class SharedObject { public: typedef boost::intrusive_ptr<T> Pointer; typedef boost::intrusive_ptr<T const> ConstPointer; inline Pointer GetPointer() { return Pointer(this); //Ambiguous call here } inline ConstPointer GetPointer() const { return ConstPointer(this); } ... ...

Is point A nearby point B in 3D - distance check

I am looking for efficent algorithm for checking if one point is nearby another in 3D. sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2) < radius This doesn't seem to be too fast and actually I don't need such a big accuracy. How else could I do this? ...

C++ Inheritance, calling a derived function from the base class

Hi. Probably asking this shows that I don't have the convenient grasp on OOP, but... How can I call a derived function from a base class? I mean, being able to replace one function from the base to the derived class. Ex. class a { public: void f1(); void f2(); }; void a::f1() { this->f2(); } /* here goes the a::f2() definit...

How to log an c++ exception

Hello! Do you know how can I log the exception ? right now the message in the catch statement is printed, but i cannot understood why ins´t Manage.Gere() called sussefully . try{ Manager.Gere(&par,&Acc, coman, comando, RunComando, log, &parti, comandosS, RunComandosSuper,true); } catch (...) { log("ERROR ENTER GERE*****"); } ...

Way in Visual Studio to display integers as bit array

Is there a way in Visual Studio, either through it's native features or a plugin, to show an integer/long/char variable in the debugger window as a bit array? For example, rather than seeing 5 or 0x5 I'd like to see 101. As a bonus feature I'd like to see them left-padded with the correct amount of zeroes, so that the total width of the...

how to write a function Click() for dynamic created button ?

Trying to write a simple VCL program for educating purposes (dynamicly created forms, controls etc). Have such a sample code: void __fastcall TForm1::Button1Click(TObject *Sender) { TForm* formQuiz = new TForm(this); formQuiz->BorderIcons = TBorderIcons() << biSystemMenu >> biMinimize >> biMaximize; formQuiz->Position = TPos...

How can i change the border?

Hello. I make a simle window with wxwidgets. How can i change the border? Also how can i call the destroy fuction(OnClose) with the right arrow button press? #include <wx/wx.h> class _Frame: public wxFrame { public: _Frame(wxFrame *frame, const wxString& title); private: void OnClose(wxCloseEvent& event); D...

Capturing real time images from a network camera

Hi What is the best way to capture streamed MJPEG from a network IP camera? I'd like to get frames and process them, using c++ (or python extended with c++). Is OpenCV my best option? Thanks Simon ...

How to enable the mouse in C++ program under DOS using DJGPP?

I've been using DJGPP for the first time recently and can't seem to enable mouse support. What's the best way? Thanks for any help. ...

How can i convert a string into a ZZ number?

I'm using the NTL library to implement ElGamal encryption/decryption algorithm. I've got it to the point that it's working but the algorithm wants the message to be converted to integers so it can be encrypted. So if i input a number like 1234 everything works ok but how would i go to be able to convert a C++ string (std::string) to a ZZ...

Initializing Constant Static Array In Header File

Hi, I have just found out that the following is not valid. //Header File class test { const static char array[] = { '1', '2', '3' }; }; Where is the best place to initialize this? Thanks in advance; ...

Visual Studio linking error LNK2005 and LNK2020

Hi. I'm using visual studio 2003 and I'm getting the following linking error in my project: Linking... LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification msvcrtd.lib(MSVCR71D.dll) : error LNK2005: _fprintf already defined in LIBCMTD.lib(fprintf.obj) C:\Documents and Settings\mz07\Desktop\project\H...

Extract audio from video as wav

I know there is a question similar to mine: http://stackoverflow.com/questions/1010937/extract-wav-file-from-video-file I am new to C++ and understand about COM library + directX is needed for video and audio. I been looking for tutorial and samples code but little success. My question is how do I code the application to take video fi...

Creating a library of template functions

I've been developing a library of mostly template functions and managed to keep things organized (to some extent) in the following manner: // MyLib.h class MyLib { template<class T> static void Func1() { } template<class T> static void Func2() { } }; And obviously calls would be made like this: MyLib::Func1(); As y...

Reading response data from TCppWebBrowser in Borland Builder

How to I access the data returned on a web page using the TCppWebBrowser component in Borland Builder 6.0? I have succeeded in posting data using the sample at: http://edn.embarcadero.com/article/27519 ...

Modern effective C++ books

Hello Can you give me advice for a modern book(s) for Effective C++ Programming By modern I mean that I want it to include new features from Boost C++ Library (casts, smart pointers, etc.) I have these books: Effective C++: 55 Specific Ways to Improve Your Programs and Designs More Effective C++: 35 New Ways to Improve Your Programs...

segmentation fault when calling a function

Segmentation fault when calling the Update_Multiplier and gdb debugger shows these: Program received signal SIGSEGV, Segmentation fault. 0x080b74e8 in Update_Multiplier() () double upperbound = 116325; double objective = 1.1707e+07; int main() { Update_Multiplier(); } void Update_Multiplier() { cout << "function 0" << end...

Returning reference to a pointer- C++

Consider the following class. class mapping_items { public: mapping_items(){} void add(const mapping_item* item) { items_.push_back( item ); } size_t count() const{ return items_.size(); } const mapping_item& find(const std::string& pattern){ const mapping_item* item = // iterate vecto...

What are the "things to know" when diving into multi-threaded programming in C++

I'm currently working on a wireless networking application in C++ and it's coming to a point where I'm going to want to multi-thread pieces of software under one process, rather than have them all in separate processes. Theoretically, I understand multi-threading, but I've yet to dive in practically. What should every programmer know...

storing a type's type for processing variable argument lists

Is it possible to do something along the lines of: type t = int;//this would be a function which identifies what type the next argument is if( t == int ) printf( "%d", va_arg( theva_list, t ) ); in a relatively trivial way? The only object I know which can hold a type is type_info and I can't work out how to use it in this way. T...