effective-c++

Silencing GCC warnings when using an "Uncopyable" class

I have several classes that I don't want to be copyable, some of these classes have pointer data members. To make these classes uncopyable I privately inherit the following class template: template <class T> class Uncopyable { protected: Uncopyable() {} virtual ~Uncopyable() {} private: Uncopyable(const Uncopyable &); ...

Modern effective C++ books

Hello Can you give me advice for a modern book(s) for Effective C++ Programming By modern I mean that I want it to include new features from Boost C++ Library (casts, smart pointers, etc.) I have these books: Effective C++: 55 Specific Ways to Improve Your Programs and Designs More Effective C++: 35 New Ways to Improve Your Programs...

Effective C++: Which edition to purchase?

I would like to purchase a copy of Effective C++, but I've hit on in issue. The first edition goes for about $4 used on Amazon, which is awesome. The second edition is about ten times as much. Could someone please give me some advice as to what I'm be missing out on if I bought the older edition? In other words, is the first edition st...

Interview question; what is the main theme of Effective C++?

I was asked the following question at a recent job interview: What do you think is the main theme / single word that sums up the Effective C++ series from Scott Meyers? What would be your answer to this question? ...

Is it appropriate to set a value to a "const char *" in the header file

I have seen people using 2 methods to declare and define char * Medhod-1: The header file has the below extern const char* COUNTRY_NAME_USA = "USA"; Medhod-2: The header file has the below declaration extern const char* COUNTRY_NAME_USA; The cpp file has the below defintion : extern const char* COUNTRY_NAME_U...

Equivalent to Scott Meyer's Effective C++ for C#?

When I started out, Scott Meyer's Effective C++ really helped me grok a lot of foreign concepts. I'm now trying to mentor a junior programmer, except he's using C#. Is there a good equivalent to give him? ...

C++: using const with STL iterators

From Effective C++, Item 3 /* case1 */ const std::vector<int>::iterator i // i acts like a T* const /* case2 */ std::vector<int>::const_iterator ci // ci acts like a const T* To remember how const applies, I used to remember the following from this article Basically ‘const’ applies to whatever is on its immediate left (other t...

About downcasting from base class to subclass pointer...

A static check tool shows a violation on the below code: class CSplitFrame : public CFrameWnd ... class CVsApp : public CWinApp CWnd* CVsApp::GetSheetView(LPCSTR WindowText) { CWnd* pWnd = reinterpret_cast<CSplitFrame*>(m_pMainWnd)->m_OutputBar.GetChildWnd(WindowText); return pWnd; } ERROR MSG: Clas...

Forward declaration include, on top of declaration include (ClassFwd.h + Class.h)

Hi all, In Effective C++ (3rd edition), Scott Meyers, in Item 31, suggests that classes should have, on top of their classic Declaration (.h) and Definition (.cpp) files, a Forward Declaration Include File (fwd.h), which class that do not need the full definition can use, instead of forward declaring themselves. I somewhat see the case...