Thread: C++ Templates book discussion

  1. #1
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    ( split from C++ Book recommendations thread and merged with ChaosEngine's response/discussion thread ~ Ken Fitlike )

    I'm not really sure you need an entire book about how to use templates.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> I'm not really sure you need an entire book about how to use templates.
    If you want to use them (and C++) well, then both of those "entire" books would be good choices.

  3. #3
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    I think that a chapter in a larger good book is fine. Note that I am not talking about the STL, but rather the implementation of the template language feature.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    This isn't exactly the place to discuss this, but are you familiar with what is contained in those books? I'm guessing that you are not and that you just don't realize the types of advanced programming techniques that are available through templates. If you consider yourself ready for advanced C++ programming, and you haven't read them already, consider buying or borrowing those books, or even reading through them in a bookstore.

  5. #5
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    No, I've read (and own) one. I don't happen to think you need an entire book to explain the topic. Some might, and I respect that. I think that you don't. Perosnal opinion, take it or leave it. I feel that a good chapter in a good book, combined with some research online, is sufficient. I felt that my money could have been better spent. That being said, there are those who can only learn through a real book, and if that is true, by all means, buy a book. If not, like me, skip it.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  6. #6
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597

    C++ Templates book discussion

    in this post I recommended some books.

    manutd disagreed and I think this is an interesting discussion but I don't want to hijack the book thread (which IMHO is a good resource), hence this thread.

    Quote Originally Posted by manutd
    No, I've read (and own) one. I don't happen to think you need an entire book to explain the topic. Some might, and I respect that. I think that you don't. Perosnal opinion, take it or leave it. I feel that a good chapter in a good book, combined with some research online, is sufficient. I felt that my money could have been better spent. That being said, there are those who can only learn through a real book, and if that is true, by all means, buy a book. If not, like me, skip it.
    First, which book do you own? I'm assuming it's the Vandevoorde/Josuttis Template book since that's what you seem to be focusing on.

    Personally, I think templates are one of the largest and most complex areas of C++ and easily merit their own book (template meta-programming on it's own merits a book!). I'm curious as to exactly how much coding you've done with templates. If it's limited to a few template classes/functions, then yes a book is overkill, but once you get into policy-based design, tmp and all the rules regarding partial specialisation, I've found that book to be a very valuable resource that has some info not available on the web. for instance, do you know off the top of your head the formal ordering rules for template matching? If you do, you're a smarter man than I.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  7. #7
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Yes, that's the one. I've done a lot of coding with templates, hence why I own the book. But for the number of times I actually need a reference on the formal ordering rules for template matching, I don't really think its worth the money.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  8. #8
    Registered User
    Join Date
    Jan 2007
    Posts
    330
    I think it depends on what you want to do with templates

    If you want to do what they are intended for then sure a few chapters in a book is enough about how to use templates, make your own templates and make template functions. And hmm, maybe a big chapter on how STL is designed although that needs its own book IMO.

    But if you get into heavy template metaprogramming there seems to be no end with what you can do. Then sure, this can fill up a few books easily.
    I bought the book of the guy who made the Loki library once, cant remember the name. That book was where I draw the line with what I wanted to know in C++. I really had the feeling in that book that C++ had become an academic toy for people who dont really want to make real programs but just wanna find out what stuff you can do with templates.
    But the point still stands, you can do a lot with templates that the designers of C++ never thought of when they added templates to the language. Can fill up lots of books, but you dont need that knowledge to make real C++ programs

  9. #9
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    As I said, I'm not talking about the STL. That easily requires a book (or two). I feel that a C++ programmer only needs a chapter or two in a larger book, and if any additional features are needed, some research on the internet in order to use templates.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  10. #10
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Are you including template meta-programming in that statement?

  11. #11
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Yes. Remember, I have the book and have compared the information there to that available online, and I feel the amount of information available only in a book is not worth the money.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  12. #12
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    I thought you had the Vandevoorde book. I am not familiar with its contents, but the template meta-programming code and examples in Alexandrescu's book could not be covered by a chapter or two. That's what I was referring to.

  13. #13
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Manutd, really take the advise already given to heart. Template based techniques are vast, powerful, and not always apparent from someone outside the loop. To think that templates can be fully covered by a chapter or two is to miss the point of template based programming.

    Don't forget that C++ templates alone are responsible for an entire new programming paradigm.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  14. #14
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Aiih! I have the book. I've read it and don't happen to agree with the neccesity of a whole book, given the information available on the internet.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  15. #15
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    ???

    But... then you surely don't agree with any book in C++!
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to make a chain-structure
    By MalickT in forum C Programming
    Replies: 12
    Last Post: 03-27-2008, 05:51 AM
  2. Looking for a c++ book, didn't were to post this...
    By Rune Hunter in forum C++ Programming
    Replies: 6
    Last Post: 09-24-2004, 06:32 PM
  3. Replies: 5
    Last Post: 09-19-2004, 06:52 AM
  4. Must read book!
    By RealityFusion in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 07-15-2004, 09:05 PM
  5. Should i get a new reference book?
    By Raison in forum Windows Programming
    Replies: 2
    Last Post: 06-15-2004, 10:43 PM