One of many neat features in C++11 is the introduction of ‘enum class’ – this addresses problems arising from enum declarations such as scoping (the enum cases leak in the same scope as the enum type) and implicit conversion to integer. See Stroustrup’s C++11 FAQ for more details.
However, in the papers that motivated the new language feature (N1513 and N2347) they discuss the current workarounds for C++03. One such workaround is to define a class to represent the enum type – it’s much more verbose than the new C++11 feature, but it solves the scoping and conversion issues.
// Header file
class Weekday
{
private:
// Note that the private enum cases have underscores to differentiate
// from the public cases
typedef enum Weekday_ { Mon_, Tues_, Wed_, Thurs_, Fri_, Sat_, Sun_ };
Weekday_ value_;
public:
static const Weekday Mon, Tues, Wed, Thurs, Fri, Sat, Sun;
explicit Weekday( const Weekday_& value ) : value_( value ){}
bool operator<( const Weekday& rhs ) const { return this->value_ < rhs.value_; }
bool operator==( const Weekday& rhs ) const { return this->value_ == rhs.value_; }
bool operator!=( const Weekday& rhs ) const { return !(this->operator==(rhs)); }
};
// Source file
// Definitions for the public Weekday instances
// in terms of the private enum
const Weekday Weekday::Mon( Mon_ );
const Weekday Weekday::Tues( Tues_ );
const Weekday Weekday::Wed( Wed_ );
const Weekday Weekday::Thurs( Thurs_ );
const Weekday Weekday::Fri( Fri_ );
const Weekday Weekday::Sat( Sat_ );
const Weekday Weekday::Sun( Sun_ );
That’s it – I’ve been using this recently and it works pretty well. I also added a “to_int()” member and a static “from_int()” member to explicitly convert bewteen the enum class and integers – the implementation is simply a switch over the enum cases.


This John Corey thriller from Nelson DeMille has all the usual ingredients to make a great read – thrust Corey into a highly pressured world where gun play is the norm; include his wife, the lovely Kate Mayfield, to offset the crass and politically incorrect commentary from Corey; throw in an arch-villain as the nemesis for this adventure; finesse with conspiracy theories regarding Corey’s historical emnity with the CIA. The scene setting in Yemen was vivid and had the hallmarks of DeMille’s attention to detail, and yet, this book over-stayed its welcome by a couple of hundred pages. 
I first saw Chris Hadfield on the excellent 
This story was long awaited, partly because the author has been building up to the meeting of Jack Reacher with Susan Turner and his journey across America to Virginia for several books – this association started in the book 61 Hours, so definitely worth reading that one and before this. On the other hand, this book is one of the best Jack Reacher thrillers, so you might not want to wait. I was waiting to read this in paperback, but was delighted to receive it in a beautiful hardcover edition for my birthday.
