c++

Dynamically change allocation strategy in boost::vector and boost::matrix

Hi, In my new project i am building a data management module.I want to give a simple template storage type to upper layers like template<typename T> class Data { public: T getValue(); private: boost::numeric::ublas::matrix<T> data; } My aim is, to change allocator of data with some different allocators like Boost.inter process...

BadImageFormatException encountered with WcfSvcHost and IIS WCF host

Creating a WCF Service Library in Visual Studio 2008 on Vista x64 is troublesome when referencing an x86 DLL. A service that calls a 32-bit DLL is required to have a platform target of x86 to run on a 64-bit OS. When you do this, the WcfSvcHost throws a BadImageFormatException when you attempt to debug the service. There is a bug report ...

How to Cross Compile for Cell Linux on the PS3 from Windows?

How can a cross compilation setup be achieved to allow compiling Cell Linux programs on a Windows PC using the cygwin toolchain? The cygwin tools provide a GNU compiler to use in building the cross compiler, and associated tools for the build process e.g. rpm, cpio, make, flex, bison and so on. I am moderately confident this is possible...

How do you convert a Visual Studio project from using wide strings to ordinary strings.

When I created my visual studio project it defaulted to forcing me to use wide strings for all the functions which take character strings. MessageBox() for example, takes a LPCWSTR rather than a const char*. While I understand that it's great for multi-lingual and portable applications, it is completely unnecessary for my simple little a...

What does the unary plus operator do?

What does the unary plus operator do? There are several definitions that I have found (here and here) but I still have no idea what it would be used for. It seems like it doesn't do anything but there has be a reason for it, right? ...

C++/Java Inheritance vs. Delegation vs. etc...

Hello, I am creating a class library with many different options for possible customizations. For example, you can design your class so that it can perform FeatureX(), or you can design your class so that it can perform FeatureY(). Under normal circumstances, you would simply create an interface IFeatureX with a pure virtual method cal...

Why is stringstreams rdbuf() and str() giving me different output?

I have this code, int main() { std::string st; std::stringstream ss; ss<<"hej hej med dig"<<std::endl; std::getline(ss,st,' '); std::cout <<"ss.rdbuf()->str() : " << ss.rdbuf()->str(); std::cout <<"ss.rdbuf() : " << ss.rdbuf(); return 0; } Giving me this output ss.rdbuf()->str() : hej hej med dig ...

How should I change this declaration?

I have been given a header with the following declaration: //The index of 1 is used to make sure this is an array. MyObject objs[1]; However, I need to make this array dynamically sized one the program is started. I would think I should just declare it as MyObject *objs;, but I figure if the original programmer declared it this way, t...

Partial Least Squares Implementation for C/C++?

Does anyone know of an open-source implementation of a partial least squares algorithm in C or C++? ...

What happens when GetTickCount() wraps?

If a thread is doing something like this: const DWORD interval = 20000; DWORD ticks = GetTickCount(); while(true) { DoTasksThatTakeVariableTime(); if( GetTickCount() - ticks > interval ) { DoIntervalTasks(); ticks = GetTickCount(); } } Eventually, ticks is going to wrap when the value doesn't fit in a ...

How to calculate a time difference in C++

What's the best way to calculate a time difference in C++? I'm timing the execution speed of a program, so I'm interested in milliseconds. Better yet, seconds.milliseconds.. The accepted answer works, but needs to include ctime or time.h as noted in the comments. Another answer (dupe) can be found here ...

What data source could I use for my stock market program?

I would like to make a free open-source C++ application for both Linux and Windows which will create live stock market charts (i.e. they're refreshed frequently). Please could you give me some pointers on these issues: What should I use as the data source? Are there free services I can implement? I would like to use the same or simila...

How to remove, reinstall and/or find info about Visual Studio 2008 hotfixes?

Another developer and I are experiencing different behavior in native C++ executables built with Microsoft Visual Studio 2008, Version 9.0.30729.1 SP on different machines. We are statically linking to the Standard Library so we don't think it's a DLL version issue. We have ruled out differences in our source code and build settings. ...

Why are references not reseatable in C++

Hi, C++ references have two properties: They always point to the same object. They can not be 0. Pointers are the opposite: They can point to different objects. They can be 0. Why is there no "non-nullable, reseatable reference or pointer" in C++? I can't think of a good reason why references shouldn't be reseatable. Edit: The ...

Can you call a C# DLL from a C DLL?

I've built a DLL in C#. Now I want to use the R Environment to call functions in that DLL. The R environment supports calling unmanaged C/C++ DLL's but not into .NET DLL's. So my question is, can I call functions in a C# DLL from a C/C++ DLL? If so, do you have a link to info about how to do this? ...

Is there a way to get Asio working without Boost?

I know there is a version of ASIO that is not included in the Boost namespace, but even then ASIO depends on Boost, but I'm wondering if there is a way to get ASIO to work without dependencies on Boost (because I cannot include Boost into the project, for too many reasons). ...

Is there any difference between +-ing strings and <<-ing strings in c++?

What is the difference, if any between the effects of the following snippets: cout << "Some text" << s1 << "some more text\n"; cout << "Some text" + s1 + "some more text\n"; ...

Windows Mobile Development: Choice of .Net compact vs. Native (c++) code

Hey there, I work on an experienced and diverse development team and we are preparing to approach our first mobile development which will be for Windows Mobile 6 (platform changes are not an option). We have skills and experience in both Visual C++ and .Net technologies for Windows desktop and server development. The mobile developm...

Why is my file-loading thread not parallelized with the main thread?

My program does file loading and memcpy'ing in the background while the screen is meant to be updated interactively. The idea is to have async loading of files the program will soon need so that they are ready to be used when the main thread needs them. However, the loads/copies don't seem to happen in parallel with the main thread. The ...

Can an application depend on two different versions of libstdc++?

Can an application depend on two different versions of libstdc++ at the same time? (e.g.: libstdc++5 and libstdc++6)? The scenario being - some binary depends on libstdc++ 6 but loads an .so that depends on libstdc++5... Will that have any chance of working? ...