Posts Tagged ‘STL’

C / C++ and STL

Wednesday, October 28th, 2009

Before everyone gets really upset with the rest of this post, as is the trend in the OO community…  I thought I’d start, rather than end, with a disclaimer:  I use C++ and STL on a daily basis in my job, although I don’t use all of what stl has to offer it does make coding in c++ much easier. C++ in itself does allow fairly elegant code (if constructed carefully) whilst providing a decent level of code performance. So I do actually like C++ and stl and they make my life at work much better :)

But this blog isn’t about my day job….  It’s about my tinkering with the wonderful world of parallel algorithms and CUDA code.

What a lot of people don’t realize is that you *can* use stl, c++ classes and templates in a .cu file. As long as its client side code you should be fine. I’ve had a few compiler crashes when using stl especially the sort. To sort this out I used the overloaded < operator in your class, don’t try and define a custom < method it will crash the compiler.

(more…)