c++

Overloaded [] operator on template class in C++ with const / nonconst versions

Whew, that was a long title. Here's my problem. I've got a template class in C++ and I'm overloading the [] operator. I have both a const and a non-const version, with the non-const version returning by reference so that items in the class can be changed as so: myobject[1] = myvalue; This all works until I use a boolean as the templa...

Get MP4 stream lengths

Hi, I'm working in an app in wich we use IMediaDet to get stream lengths. Now we're starting to work with MP4 containers. The problem is, when I try an IMediaDet::put_fileName() with the MP4 file, I get HRESULT = -2147024770 (ERROR_MOD_NOT_FOUND). Using a comercial mp4 demuxer, I see the video stream uses mpg2 encoding. My questions: H...

Does LVS_EX_FULLROWSELECT have any compatibility issues with other styles?

I am trying to set the LVS_EX_FULLROWSELECT style on my grid list control as I want full row selection. However apparently it doesn't have any effect. Since I am using a number of other styles as well, I am wondering if LVS_EX_FULLROWSELECT has any compatibility issues with other styles. Anyone? Following are the styles I am setting. In...

CHtmlView class and focus

I am having Dialog Box Application written in MFC. Dialog is having 3 child controls on it. 2 Buttons (Button 1 & Button 2) and a HTML Control (Class derived from CHtmlView) HTML Control has been navigated to a HTML page having 2 checkboxes (Check Box 1 & Check Box 2). Control Z-Order for focus should be like: Button 1 Button 2 HTML Con...

How can you find whether an environment variable exists at compile time?

I don't particularly know if this is a good thing or not but I used to work somewhere where everyone had an environment variable like YOUR_NAME on their computer. Then if you had a bit of debug code that was only of interest to yourself you could wrap it in #if defined( YOUR_NAME ) and it wouldn't even be compiled for someone else unless...

c++ matrix template library need for neural networks computations

hi i'm implementing some neural network algorithms and i'll be needing a matrix library, I've looked and found that there are ones like ( boost::ublas ) , (blitz++), TNT... I need experts opinion which one is suitable for (simple , easy coding, high performance maybe ) ...

How to create a std::wstring using the ascii codes of characters in C++?

I need to create a wstring with the chars that have the following ascii values: 30, 29, 28, 27, 26, 25. In VB6, I would do asc(30) + asc(29)+ etc... What's the C++ equivalent? Thanks! ...

What am I doing wrong with boost::interprocess::message_queue?

I've created a boost::message_queue by the following way: namespace bipc = boost::interprocess; ... try { bipc::message_queue::remove("EDBA90AC-289D-4825-98D9-F85185041676"); // The below throws exception, no matter what's the name of the queue... boost::shared_ptr<bipc::message_queue> mq(new bipc::message_queue(bipc::cr...

How do C++ progs get their return value, when a return is not specified in the function?

Hi Everyone, I recently wrote a post: http://stackoverflow.com/questions/3452355/weird-error-in-c-program-removing-printout-breaks-program ...in which I was trying to solve a seemingly baffling problem, in which removing a cout statement would break my program. As it turned out, my problem was that I forgot to return my true/false succ...

Boost::Interprocess with complex, nested classes

I think I finally have a grasp on the basics of the boost:interprocess library, and I've been using it successfully when dealing with relatively simple classes that contain a few member variables that are all standard data types. However, I am now faced with the problem of pushing a rather complex class out into interprocess shared memo...

Declaring and initializing a static int in a header

If I have the following in a header file: Foo.h Foo { public: static const int BAR = 1234; ... }; Do I also need to define the variable in the .cpp, e.g.: Foo.cpp const int Foo::BAR; We have an issue where initializing a static in a header seems to work on MS compilers but with gcc on the Mac it seems to give linker errors. ...

C++ How to loop dynamic arguments from function?

I need to loop all the dynamic arguments i have gave to my function, how? I mean this kind of code: void something(int setting1, int setting2, ...){ // loop somehow all the ... arguments and use setting1-2 values in that loop } setting1 and setting2 are not part of the dynamic argument list. ...

Initialize large two dimensional array in C++

I want to have static and constant two dimensional array inside a class. The array is relatively large, but I only want to initialize a few elements and others may be whatever compiler initializes them to. For example, if a class is defined like: class A { public: static int const test[10][10]; }; int const A::test[10][10] = { {0,...

handle management with boost::shared_ptr<>

I would like to use boost::shared_ptr<> to encapsulate the lifetime management of a handle. My handle and it's creation/destruction functions are declared like this: typedef const struct MYHANDLE__ FAR* MYHANDLE; void CloseMyHandle( MYHANDLE ); MYHANDLE CreateMyHandle(); Ideally, I would like to use the boost::shared_ptr<> like this ...

Boost autolinks libraries which are not build by Boost, but the intented once are build.

Hello, I am developing a Math application which can be extended by writing python scripts. I am using QT 4.6.3 (build as static library, debug and release versions) and Boost 1.43.0 (build as static library, runtime-link also set to static, multi-threaded version, debug and release). Everything is build with MSVC++2008. The boost build ...

Why is my paintBox Canvas being erased when my program is "Not Responding"?

Hello: I have written a small program using Borland's C++ builder, and along the way, everything seemed fine. My program has a map window and a table window, and when a user presses a button, a long process is started that reads in all the map and table information and then displays that. Every time i ran it through the debugger, I had...

Global Arrays in C++

Why the array is not overflowed (e.g. error alert) when the array is declared globally, in other why I'm able to fill it with unlimited amount of elements (through for) even it's limited by size in declaration and it does alert when I declare the array locally inside the main ? char name[9]; int main(){ int i; for( int i=...

Blowfish c++ (irc)

Lo Folk, i'm searching Blowfish for C++ with IRC support. Anybody know where to find those tricky thing? Thx ...

Why can't I use __declspec(dllexport) to export DllGetClassObject() from a COM DLL?

I am developing a COM dll and trying to export the DllGetClassObject() method with the __declspec(dllexport). Here is my declaration: extern "C" HRESULT __declspec(dllexport) __stdcall DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv) But I kept get this error: ...

low level Hooker

I want to make a hook that will act like "event" (and not with agly GetAsyncKeyState) in C# (I want to do it in C++). so, I've made a dll with this content: http://pastebin.com/yEHJKSS7 . well, it doesn't call to Handler Function. by the way, here's how I used the dll: void KeysHandler(int vkKey, int flags) { if(vkKey == VK_ESCAP...