views:

81

answers:

1
#include <stdexcept>
#include <string>

using namespace std;

class ListIndexOutOfRangeException : public out_of_range
{
public:
    ListIndexOutOfRangeException(const string & message = "") : out_of_range(message.c_str())
    {
    }
}; // end ListIndexOutOfRangeException
+1  A: 

out_of_range accepts a string reference, so just use

: out_of_range(message)

instead.

edit:

And as others have said, the compiler is telling you you have used message.cstr() instead of message.c_str(). But the method call is unnecessary anyway, just pass the string.

Mike Weller
Nice one! Thanks.
Brandon