How to use C++ in Go?
In the new Go language, how do I call C++ code? In other words, how can I wrap my C++ classes and use them in Go? ...
In the new Go language, how do I call C++ code? In other words, how can I wrap my C++ classes and use them in Go? ...
Ok, I'm trying to figure out which way would be faster to read a text file that I'm working with. The contents of the file look like this 1982 3923 3542 4343 2344 3453 2 334 423423 32432 23423 They're basically just an arbitrary number of int numbers and I need to read line by line. Would it be better to use getline or the insertion ...
I am trying to get a get the boost library program_options working on a simple windows console library. I have linked in the library C:\Program Files\boost\boost_1_40\lib\libboost_program_options-vc90-s-1_40.lib Included the header files #include <boost/program_options.hpp> #include <boost/program_options/config.hpp> #include <boost/pro...
In the try catch block is it bad practice to return values from the catch block in C++? try { //Some code... return 1; } catch(...) { return 0; } Which method of using try/catch is good practice? ...
Howdy all, I'm trying to create a constructor for a custom type, but for some reason, it's trying to call, what I'm guessing is the constructor in the constructor definition of anotehr class.. Couldn't find anything which fits the same symptoms I'm having in any other questions, also as I may not know what I'm looking for. When I call:...
I have a C++ class which contains only static data members. I noticed the compiler is OK if I define the access methods as const, as static, or as "regular" - so all seem to work. My question is what is the correct/better practice in this case? Thanks! ...
When I work with BOOST_FOREACH, there isn't a problem with simple templates as vector. But when I try to iterate through map > for example I need to typedef the element type. Is there any workaround? ...
I need to wrap a dynamically allocated array(from a = new double[100] for example) into std::vector(preferably) without copying the array. This restriction is imposed by that the array I want to wrap is mmaped from a file, so just doing vector(a, a+size) will double the memory usage. Is any tricks to do that? ...
Hello, If I have a derived object of QWidget class and on slot function in it I have an update(). here is some pseudocode: *.h slot: updateNow(); *.cpp constructor() { setPalllete(QPallete(QColor(250,250,200))); setAUtoFillBackground(true); } updateNow() { update(); } paintEvent() { QPainter painter(this); painter.d...
I'm trying out a GStreamer test application, but at runtime the following line fails: demuxer = gst_element_factory_make ("oggdemux", "ogg-demuxer"); // returns NULL I am using MacOSX and installed GStreamer, libogg and vorbis-tools through MacPorts. So I don't see why it fails. Any suggestions on how to make it work? EDIT: SOLVED! ...
Hi, i want to write an wrapper for different Array Classes with different Policies. For example: typedef ArrayType<useValArray,StdAllocator> Array; // one global assignment I want to use the class like a blitz++ Array for example: Array<double,2> x(2,2); //maps the Array to an Valarray or to a Blitz++ Array Array<double,2> x2(5,...
Hi Devs, i am developing an application in C# witch will be able to capture audio and video from webcam and MIC, then it will stream them together. I searched the www and found how to grab the webcam and audio using DirectShow.net. But now i can save them to hardisk as .avi file. How i can stream them together and again reproduce them t...
Scott Meyer's argument that non-member functions increase encapsulation and allow for more elegant design (designwise) seems very valid to me. See here: Article Yet I have problems with this. (And seemingly others too, especially Library developers, who usually completely ignore this) Code usually looks better and more logical when I u...
I want cout to output an int with leading zeros, so the value 1 would be printed as 001 and the value 25 printed as 025 .. you get the idea .. how can I do this? Thanks. ...
Hello Everyone! I have a project that uses Boost.Asio and the Media-Decoding-Samples that come with the Intel IPP-Library. The problem is the following. If I compile the project without defining WIN32_LEAN_AND_MEAN, Asio complains with the infamous "winsock.h already included" error. If I define the macro, a header in the other library ...
I have this snippet of code which I am considering to simplfy: if (numberOfResults > 1) { trackResult_ = new TrackResult[numberOfResults]; for (int i=0; i < numberOfResults; i++) { // Make a deep copy TrackResult tempResult = result[i]; TrackResult * clone = new TrackResult(tempResult); trackResult_[i] = *clone; ...
Hi, is it possible to return a reference from a function like in this example code: string &erase_whitespace(string &text) { text.erase(**etc.**); return text; } Call: string text = erase_whitespace(string("this is a test")); cout << test; Does this code work? On Visual C++ it does not crash but it looks wrong. Thanks ...
Any idea whats wrong with my code? when i execute glCompressedTexImage2D() the program just crashes (comes the Windows XP crash message thing...) Im trying to load DDS image without mipmaps, the image format is DDS DXT1 Am i missing some include file, or what did i do wrong? I downloaded the included files from: http://sourceforge.net/...
Hello there, I need to remove every elements that doesn't have same value between 3 vectors or more. For example, vector<int> Vector1, Vector2, Vector3; for(int i = 2; i < 7; i++) Vector1.push_back(i); // Vector1 = {2, 3, 4, (5), (6)} for(int i = 3; i < 8; i++) Vector2.push_back(i); // Vector2 = {3, 4, (5), (6), 7} for(int i = 5; i < 1...
can somebody please tell me the difference between the following two code snippets: //Code snippet A: Compiles fine int main() { if(int i = 2) { i = 2 + 3; } else { i = 0; } } //Code Snippet B: Doesn't compile :( int main() { if((int i = 2)) { i = 2 + 3; } else { ...