Do you use C++'s libraries?

  • (2 Pages)
  • +
  • 1
  • 2

29 Replies - 4054 Views - Last Post: 16 January 2012 - 11:42 AM

Poll: Do you use C++'s libaries (45 member(s) have cast votes)

Please Select C++ libraries you use regularly

  1. iostreams (43 votes [14.53%] - View)

    Percentage of vote: 14.53%

  2. string (45 votes [15.20%] - View)

    Percentage of vote: 15.20%

  3. sstream (25 votes [8.45%] - View)

    Percentage of vote: 8.45%

  4. algorithm (18 votes [6.08%] - View)

    Percentage of vote: 6.08%

  5. iterators (14 votes [4.73%] - View)

    Percentage of vote: 4.73%

  6. functional (11 votes [3.72%] - View)

    Percentage of vote: 3.72%

  7. numeric (6 votes [2.03%] - View)

    Percentage of vote: 2.03%

  8. stdexcept (8 votes [2.70%] - View)

    Percentage of vote: 2.70%

  9. exception (10 votes [3.38%] - View)

    Percentage of vote: 3.38%

  10. memory (12 votes [4.05%] - View)

    Percentage of vote: 4.05%

  11. vector (33 votes [11.15%] - View)

    Percentage of vote: 11.15%

  12. map (21 votes [7.09%] - View)

    Percentage of vote: 7.09%

  13. set (12 votes [4.05%] - View)

    Percentage of vote: 4.05%

  14. deque (9 votes [3.04%] - View)

    Percentage of vote: 3.04%

  15. bitset (7 votes [2.36%] - View)

    Percentage of vote: 2.36%

  16. list (10 votes [3.38%] - View)

    Percentage of vote: 3.38%

  17. stack (12 votes [4.05%] - View)

    Percentage of vote: 4.05%

Which do you use more often?

  1. C libraries (5 votes [11.11%] - View)

    Percentage of vote: 11.11%

  2. C++ libraries (36 votes [80.00%] - View)

    Percentage of vote: 80.00%

  3. Third party frameworks (4 votes [8.89%] - View)

    Percentage of vote: 8.89%

Would you rather:

  1. Use a library function already available (28 votes [62.22%] - View)

    Percentage of vote: 62.22%

  2. Write the code myself (17 votes [37.78%] - View)

    Percentage of vote: 37.78%

Vote Guests cannot vote

#16 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2247
  • View blog
  • Posts: 9,237
  • Joined: 18-February 07

Re: Do you use C++'s libraries?

Posted 31 August 2011 - 01:07 PM

I think I 100% agree with everything you said. Books on C++ are a dismal display. Beginner's books almost universally take the C -> C++ approach. Intermediate books tend to be very old. I suppose the market fell out of those somewhere in the early to mid 1990's and while there is some great information in my C/C++ Annotated Archive - the style, techniques, and frankly technologies discussed are out of date. C++ has grown a lot as a language since the 1990's not that you can't tell from most of the books published.

The Advanced books tend to be just that: advanced. I suppose there are a few that dumb the examples down, but then the examples tend to be all but useless.

One of my hopes (dreams?) is that the release of C++11 will encourage publishers to dip their toes back into the water on C++ books. However so far all I have seen is updates to old books "NOW including C++0x" - which basically means the Authors slapped a chapter on the end and talk about lambdas and maybe rvalue references.

But still no mention of the paradigm shifts that have happened in programming since the 1980's. For that you really do have to learn other languages and then come back and try to look at C++ with fresh eyes - and find yourself "discovering" things that have been there all along.
Was This Post Helpful? 2
  • +
  • -

#17 Serapth  Icon User is offline

  • D.I.C Head

Reputation: 53
  • View blog
  • Posts: 153
  • Joined: 17-August 11

Re: Do you use C++'s libraries?

Posted 31 August 2011 - 01:26 PM

It is funny you should say that.

I hated C++ with a capital HATE by the point I stopped using it. In writing a C++ tutorial, I had to jump back into it after working in C# for years and I have to say although I am very rusty and in some cases simply lack knowledge ( like for example the performance ramificatins of using dynamic_cast ), but in terms of undertanding the languages strengths and weaknesses, I have never had such clarity, even when I was using C++ professionally fulltime.

If ever though there was a language that needs a good book ecosystem, it's C++! There are so many minute details that need to be understood, hell even just to get through the compile/link process, before we even aproach some of the more bizarre language details. There literally should be hundreds of good books, so this failing is brutal.

I personally don't hold that C++ is a good beginers language, you just have to master far to many things right up front. This however is exactly why I decided to do a couple of tutorials in C++, as people are going to choose to learn with C++ regardless to if it is a good idea or not. At the least I can hopefully counter some of the horrific tutorals out there now. :) Ironically I write C++ in a very Csharpy way, but frankly I think thats actually improved my code a great deal.

I still hold that as one of the greatest pieces of advice you can give. Learn to program, not programming languages. The more the better, although at some point you need to just buckle down and get things done. Hell, with the rise of functional programming, I really wish I was exposed to LISP before my brain was warped to think procedurally.
Was This Post Helpful? 2
  • +
  • -

#18 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2247
  • View blog
  • Posts: 9,237
  • Joined: 18-February 07

Re: Do you use C++'s libraries?

Posted 31 August 2011 - 01:41 PM

I have this theory that programmers when working outside of thier core language tend to program with an accent. Indeed I have a heavy C++ accent when I program Java at work and I often attract funny looks. One programmer even went as far as re-writting my code, not because it was bad but he didn't understand it and he reverted back to my code once I explained it (it really was better code IMO).

I am however having a hard time learning Haskell. I am not really sure what the problem is. They language is not complicated and the syntax is doable -- but I have a hard time framing problems into the language.
Was This Post Helpful? 0
  • +
  • -

#19 ishkabible  Icon User is offline

  • spelling expret
  • member icon





Reputation: 1618
  • View blog
  • Posts: 5,707
  • Joined: 03-August 09

Re: Do you use C++'s libraries?

Posted 31 August 2011 - 01:45 PM

Quote

C++11's variadic templates of course will allow for typesafe calls to printf like functions. But... I am a little curious about how that will work with relation to code size. Am I creating custom blocks of code for every different format I choose?


funny you should mention that. i actually thought of something i like even better than printf or using a stream like interface. it relays on variadic templates though.

say rather than using the '<<'/'>>' operator for output you used '()'(function call operator).
this opens up a whole new range of possibilities and is VERY flexibility.

for instance you might have the following overloads.

1) include all overloads of '<<'/'>>' but convert them to function call operators
2) add the following
template<typename... Types, typename T>
iostream& operator()(const std::string& fmt, T val, Types... vals); //T is the type that will be printed on this recursion, Types are the other types
template<typename... Types, typename T>
iostream& operator()(std::string&&  fmt, T1_N val, Types... vals); //rvalue reference, just cuz we can
template<typename... Types, typename>
iostream& operator()(T val, Types... vals) { //ill even implement this one ;)/>
    (*this)(val)(vals);
    return *this; //return it so you can chain calls
}



this is allows you to seamlessly use formatting and regular non formatting together. it also allows you to separate arguments with nothing but a comma so long as the leading argument is not a string. i like this ALOT better than either formatting or operators or anything else i have seen. but again it relays on variadic arguments, otherwise it would not be type safe.

you can do things like this
cout("%s this string is formatted, check out these numbers %i %f", "check it...", 10 23.57594);



edit:

Quote

I have this theory that programmers when working outside of thier core language tend to program with an accent


very true, fluency is another word that can be added. i really only know 2 languages fluently, C++(maybe C) and Lua. you can get to a point where the syntax isn't really much of an issue unless you're trying to do something not supported(making hacks).

This post has been edited by ishkabible: 31 August 2011 - 01:52 PM

Was This Post Helpful? 1
  • +
  • -

#20 Munawwar  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 162
  • View blog
  • Posts: 457
  • Joined: 20-January 10

Re: Do you use C++'s libraries?

Posted 05 September 2011 - 05:13 AM

Out of the 17 C++ headers, I most frequently use iostream,string and vector. Other than these, I am more concerned about getting work done. I actually find Pareto principle being true. 80% of work can be done with 20% of the C++ library. In other words, I can get pretty far by being stupid :D.

And even though C++ standard libraries can do a lot, there are some cases where I have to write custom functions and classes to do stuffs, which I find the standards lack.
For example, the string class doesn't have a simple replace(targetSubstring, replacement).
String can't do a string += int or float.
It is easy to write these. But these are stuffs that should come "out of the box".
Was This Post Helpful? 0
  • +
  • -

#21 Ricky65  Icon User is offline

  • D.I.C Head

Reputation: 38
  • View blog
  • Posts: 115
  • Joined: 03-June 10

Re: Do you use C++'s libraries?

Posted 13 September 2011 - 04:33 AM

I use most of the standard libraries fairly regularly, some like <iterator> are included indirectly. I assume "liat" is a typo for "list". I have to admit, apart from during programming exercises, I've never had the need to use std::list.

The most startling stat for me is that ~47% of programmers would rather write code themselves than use a library function. My first reaction was "why reinvent the wheel and make it unnecessarily hard on yourself?". Much better to use tried and tested libraries such as those included in Boost. I also like POCO.

I know somebody who programmed in C++ for years and had never heard of Boost, yet alone used it. For the past year he's been using Boost and he tells me his productivity has increased ten-fold.

I understand that some Boost libraries are too specialised or have poor documentation (ASIO) but they're indispensible for a C++ programmer imo.

I was also surprised that the standard algorithms are not more popular. There are some gems in there if you're prepared to read up about them. I see lots of people unnecessarily reimplement these algorithms and they are often half-baked. cppreference.com is a great resource for algorithms and C++ in general.

I'm currently putting together a collection of algorithm extensions which I feel are useful but are not included in the C++ Standard Library. These include binary_find (like binary_search but returns a ForwardIterator, not bool! not exactly the same as lower_bound) and find_last_of (reciprocal function to find_first_of). I hope to share them on here soon.
Was This Post Helpful? 0
  • +
  • -

#22 Gungnir  Icon User is offline

  • Your Imaginary Friend

Reputation: 152
  • View blog
  • Posts: 527
  • Joined: 21-May 11

Re: Do you use C++'s libraries?

Posted 01 October 2011 - 12:34 PM

Quote

they mash this in to C-with-classes.

GOLD! I lol'd.

I'll take this into account as I'm often guilty of doing just that. C is such a comprehensive language that many C++ coders take it for granted whilst barely even scraping the surface of the power that is C++.

I suppose I should go back to my roots one of these days and really look into doing things more efficiently with OOC and C++. I'm sort of leaning too heavily towards C because of the Win32 API (which just feels like cheating after having done SDL for a long time).
Was This Post Helpful? 0
  • +
  • -

#23 oscode  Icon User is offline

  • D.I.C Regular

Reputation: 109
  • View blog
  • Posts: 257
  • Joined: 24-October 10

Re: Do you use C++'s libraries?

Posted 21 October 2011 - 05:55 AM

View PostNickDMax, on 30 August 2011 - 11:59 PM, said:

RetardedGenius a good guide to get started with is Boost book. The printed version even seems to cover the newest version 1.47 which I am very excited about.


That's a fantastic reference which I wasn't aware of, thanks.
Was This Post Helpful? 0
  • +
  • -

#24 masoug  Icon User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 181
  • Joined: 30-December 09

Re: Do you use C++'s libraries?

Posted 27 October 2011 - 03:14 PM

View PostNickDMax, on 30 August 2011 - 01:33 PM, said:

I suspect that most C++ programmers do not actually use the standard library very often. Opting instead to use the C function and write their own implementations.


Technically, C++ almost always use C++ libs because most of the 3rd-party libs out there really boil down to the libc and libc++...
Was This Post Helpful? 0
  • +
  • -

#25 ishkabible  Icon User is offline

  • spelling expret
  • member icon





Reputation: 1618
  • View blog
  • Posts: 5,707
  • Joined: 03-August 09

Re: Do you use C++'s libraries?

Posted 27 October 2011 - 03:21 PM

not so right actually. most 3rd party libs do system specific things like threading, GUI, networking, etc...
Was This Post Helpful? 0
  • +
  • -

#26 TMKCodes  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 48
  • View blog
  • Posts: 440
  • Joined: 21-March 09

Re: Do you use C++'s libraries?

Posted 07 November 2011 - 05:55 AM

Myself I sometimes have some problems with the standard libraries, when they don't do what I really want. So I reinvent the wheel and write my own libraries. I barely never anymore use any containers in the standard library collection.
Was This Post Helpful? 0
  • +
  • -

#27 ishkabible  Icon User is offline

  • spelling expret
  • member icon





Reputation: 1618
  • View blog
  • Posts: 5,707
  • Joined: 03-August 09

Re: Do you use C++'s libraries?

Posted 07 November 2011 - 09:23 AM

you should reverse that behavior. the containers in the standard library are highly optimized. i strongly recommend you use them.

I think the thing people miss most is how flexible the standard library is, particularly the usage of iterators.

containers, iterators, allocators and algorithms in the standard library are very flexible. I strongly recommend using STL compatible structures, you will be amazed at how flexible your code will become

the IO library is confusing at first but once you get the hang of it you realize how flexible it really is. it provides a highly extensible interface for any kind of input/output you can think of.

the string library is also very flexible. it actually allows for almost any encoding to be used in the same interface!!

the exceptions library is small but useful. I can't say I'm a huge fan of exceptions however as exceptions should be minimized in C++ if possible(IMO see below). the size of the library reflects it's place in C++ i think.

a word about exceptions:
exceptions use RTTI and code for unwinding the stack is expensive. many have said that because of this, exceptions defy the C++ motto of "you pay for what you use" and i for one agree. this isn't to say that they shouldn't be use all together but i think most uses of them are abusive. IMO, exceptions should be used only when you need to safely unwind layers of recursion and the program should after unwinding safely quit. it's to allow a program to gracefully crash IMO
Was This Post Helpful? 0
  • +
  • -

#28 superSonic.code  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 9
  • Joined: 08-September 11

Re: Do you use C++'s libraries?

Posted 29 November 2011 - 05:59 PM

I've tried third party libraries, and ones I have made myself, but I find that the C++ libraries are much more "reliable" than third party libraries. The C++ are also easier to use, since you don't have to download them separately. However, this is just my opinion.
Was This Post Helpful? 0
  • +
  • -

#29 GWatt  Icon User is offline

  • member icon

Reputation: 262
  • View blog
  • Posts: 3,054
  • Joined: 01-December 05

Re: Do you use C++'s libraries?

Posted 30 November 2011 - 09:55 AM

Mostly when I program in C++ I use QT. Even if you don't use the GUI parts of QT, it has a much more comprehensive core than the STL and I've found that QT implements many of the parts of boost that I would use. Admittedly QT isn't a particularly good choice unless you're targeting KDE or a mobile device that's based off QT.
Was This Post Helpful? 0
  • +
  • -

#30 vividexstance  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 630
  • View blog
  • Posts: 2,109
  • Joined: 31-December 10

Re: Do you use C++'s libraries?

Posted 16 January 2012 - 11:42 AM

I found this page the other day that has a bunch of links to the online manuals for many GNU programs/libraries. Here is that page: GNU Manual. On that page, I discovered this library I had never heard of called GNU Common C++ and GNU uCommon C++. Here is the page for this: GNU Common C++. Here is just a short description of some of the things provided:

Quote

GNU Common C++ and GNU uCommon C++ are both very portable and highly optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized String and data structure classes, etc.

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2