Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

C++ Boost


class bad_expression

Boost.Regex Index


#include <boost/pattern_except.hpp>

The class bad_expression defines the type of objects thrown as exceptions to report errors during the conversion from a string representing a regular expression to a finite state machine.  

namespace boost{

class bad_pattern : public std::runtime_error
   explicit bad_pattern(const std::string& s) : std::runtime_error(s){};

class bad_expression : public bad_pattern
   bad_expression(const std::string& s) : bad_pattern(s) {}

} // namespace boost


bad_expression(const string& what_arg);

Effects: Constructs an object of class bad_expression.

Postcondition: strcmp(what(), what_arg.c_str()) == 0.

Footnotes: the class bad_pattern forms the base class for all pattern-matching exceptions, of which bad_expression is one. The choice of std::runtime_error as the base class for bad_pattern is moot; depending upon how the library is used exceptions may be either logic errors (programmer supplied expressions) or run time errors (user supplied expressions).

Revised 24 Oct 2003

Copyright John Maddock 1998- 2003

Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at