]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/exception/example/enable_error_info.cpp
1 //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //This example shows how to throw exception objects that support
7 //transporting of arbitrary data to the catch site, even for types
8 //that do not derive from boost::exception.
10 #include <boost/exception/all.hpp>
13 typedef boost::error_info
<struct tag_std_range_min
,size_t> std_range_min
;
14 typedef boost::error_info
<struct tag_std_range_max
,size_t> std_range_max
;
15 typedef boost::error_info
<struct tag_std_range_index
,size_t> std_range_index
;
26 operator[]( size_t i
) const
29 throw boost::enable_error_info(std::range_error("Index out of range")) <<
31 std_range_max(size()) <<