c++

Calling C/C++ from python?

What would be the quickest way to construct a python binding to a C or C++ library? (using windows if this matters) ...

Wide exec for C/C++

Is there a wchar_t version of exec[lv][pe]* (i.e. an exec that uses wchar_t as path and wchar_t as arguments)? In Windows, I can just do CreateProcessW(process, cmdline), but in *nix, I'm stuck (i.e. no pure POSIX equivalent). I'm trying to add UTF-16 support to my program (an autorun). ...

How to find out which numbers occur the most in a given group of numbers?

Suppose we have a vector/array in C++ and we wish to count which of these N elements has maximum repetitive occurrences and output the highest count. Which algorithm is best suited for this job. example: int a = { 2, 456, 34, 3456, 2, 435, 2, 456, 2} the output is 4 because 2 occurs 4 times. That is the maximum number of times 2 occu...

What existing style and coding standard documents should be used on a C++ project?

The following have been proposed for an upcoming C++ project. C++ Coding Standards, by Sutter and Alexandrescu JSF Air Vehicle C++ coding standards The Elements of C++ Style Effective C++ 3rd Edition, by Scott Meyers Are there other choices? Or is the list above what be should used on a C++ project? Some related links http://stac...

Creating, opening and printing a word file from C++

Hello everyone, I have three related questions. I want to create a word file with a name from C++. I want to be able to sent the printing command to this file, so that the file is being printed without the user having to open the document and do it manually and I want to be able to open the document. Opening the document should just op...

What continuous integration tool is best for a C++ project?

Cruisecontrol and Hudson are two popular continuous integration systems. Although both systems are able to do the automated continuous builds nicely, it just seems a lot easier to create a batch or bash build script, then use Windows scheduler or cron to schedule builds. Are there better continuous integration systems available for C++...

What are some recommendations for porting C++ code to the MacOS?

For a upcoming project, there are plans to port the existing C++ code that compiles on Windows and Linux to the MacOS(leopard). The software is command line application, but a GUI front end might be planned. The MacOS uses the g++ compiler. By having the same compiler as Linux, it does not seem like there would be any issues, but there...

Compile-time type based dispatch

Following techniques from 'Modern C++ Design', I am implementing a persistence library with various compile-time optimisations. I would like the ability to dispatch a function to a templated member variable if that variable derives from a given class: template<class T, template <class> class Manager = DefaultManager> class Data { privat...

Including Relevant Boost Libraries with C++ Source (Using Visual Studio)

I have a project I'm working on (for school) that I'm digging into the Boost libraries for the solutions. I need some way to distribute the required Boost source code with my application so that it can be compiled without the libraries being installed on the system doing the compiling. (School computers lack just about anything you can m...

Benefits of inline functions in C++?

What is the advantages/disadvantages of using inline functions in C++? I see that it only increase performance for the code that the compiler output but with today's optimized compilers, fast CPUs, huge memory etc (not like in the 1980< where memory was scarce and everything had to fit in 100KB of memory) what advantages do they really h...

What do you use for fixed point representation in C++?

I'm looking for a fixed-point standard to use for financial data, do you know any that is worth trying? Do you have any experience on the performance of that hand-made fixed-point classes? ...

What you think about default pass-by-reference semantics on C++?

EDIT: This question is more about language engineering than C++ itself. I used C++ as an example to show what I wanted, mostly because I use it daily. I didn't want to know how it works on C++ but open a discussion on how it could be done. That's not the way it works right now, that's the way I wish it could be done, and that would brea...

Function pointer to template class member functions

I have a templated class defined (in part) as template <class T> MyClass { public: void DoSomething(){} }; If I want to call DoSomething from another class, but be able to do this for multiple 'T' types in the same place, I am stuck for an idea as method functions pointers are uniquely constrained to the class type. Of course, each...

Visual Studio support for new C / C++ standards?

Hello everyone, I keep reading about C99 and C++0x and all these totally sweet things that are getting added to the language standard that might be nice to use someday. However, we currently languish in the land of writing C++ in Visual Studio. Will any of the new stuff in the standard ever get added to visual studio, or are microsoft ...

What is the best way to produce random double on POSIX?

I'd like to get uniform distribution in range [0.0, 1.0) If possible, please let the implementation make use of random bytes from /dev/urandom. It would also be nice if your solution was thread-safe. If you're not sure, please indicate that. See some solution I thought about after reading other answers. ...

What are POD types in C++?

I've been following SO for a bit now, and I've come across this term POD-type a few times... what does it mean? ...

How do I get the resolution of the main monitor in Mac OS X in C++?

I have a graphical app that needs to test the resolution of the display it is starting up on in Mac OS X to ensure it is not larger than the resolution. This is done before the window itself is initialized. If there is more than one display, it needs to be the primary display. This is the display that hardware accelerated (OpenGL) a...

How to read config file entries from an INI file

I can't use the Get*Profile functions because I'm using an older version of the windows CE platform SDK which doesn't have those. It doesn't have to be too general. [section] name = some string I just need to open the file, check for the existence of "section", and the the value associated with "name". Standard C++ preferred. ...

C++ versus D

Is the D language a credible alternative to Java and C++? What will it take to become a credible alternative? Should I bother learning it? Does it deserve evangelizing? The main reason I ask is that with the new c++ standard (c++0x) almost here, its clear to me that the language has gone well past the point of no return with respect to ...

How does the UTF-8 support of TinyXML work

I'm using TinyXML (http://www.grinninglizard.com/tinyxml/) to parse/build XML files. Now according to the documentation (http://www.grinninglizard.com/tinyxmldocs/) this library supports multibyte character sets through UTF-8. So far so good I think. But, the only API that the library provides (for getting/setting element names, attribut...