2
0
mirror of https://github.com/boostorg/leaf.git synced 2026-01-19 04:22:08 +00:00

Renamed namespace leaf_detail -> detail

This commit is contained in:
Emil Dotchevski
2024-09-08 22:20:57 -07:00
parent f81020e77c
commit ec11ab1d9c
24 changed files with 161 additions and 161 deletions

View File

@@ -53,7 +53,7 @@ static_assert((BOOST_LEAF_CFG_TLS_ARRAY_START_INDEX) >= 0,
namespace boost { namespace leaf {
namespace leaf_detail
namespace detail
{
using atomic_unsigned_int = std::atomic<unsigned int>;
}

View File

@@ -16,7 +16,7 @@
namespace boost { namespace leaf {
namespace leaf_detail
namespace detail
{
using atomic_unsigned_int = std::atomic<unsigned int>;
}

View File

@@ -15,7 +15,7 @@
namespace boost { namespace leaf {
namespace leaf_detail
namespace detail
{
using atomic_unsigned_int = unsigned int;
}

View File

@@ -24,7 +24,7 @@ struct is_predicate: std::false_type
{
};
namespace leaf_detail
namespace detail
{
template <class T>
struct is_exception: std::is_base_of<std::exception, typename std::decay<T>::type>
@@ -135,7 +135,7 @@ namespace leaf_detail
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class T>
struct get_dispatch
@@ -176,7 +176,7 @@ namespace leaf_detail
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <int I, class Tup>
struct tuple_for_each
@@ -232,7 +232,7 @@ namespace leaf_detail
////////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class T> struct does_not_participate_in_context_deduction: std::is_abstract<T> { };
template <> struct does_not_participate_in_context_deduction<error_id>: std::true_type { };
@@ -273,7 +273,7 @@ class context
context( context const & ) = delete;
context & operator=( context const & ) = delete;
using Tup = leaf_detail::deduce_e_tuple<E...>;
using Tup = detail::deduce_e_tuple<E...>;
Tup tup_;
bool is_active_;
@@ -336,7 +336,7 @@ public:
BOOST_LEAF_CONSTEXPR void activate() noexcept
{
using namespace leaf_detail;
using namespace detail;
BOOST_LEAF_ASSERT(!is_active());
tuple_for_each<std::tuple_size<Tup>::value,Tup>::activate(tup_);
#if !defined(BOOST_LEAF_NO_THREADS) && !defined(NDEBUG)
@@ -347,7 +347,7 @@ public:
BOOST_LEAF_CONSTEXPR void deactivate() noexcept
{
using namespace leaf_detail;
using namespace detail;
BOOST_LEAF_ASSERT(is_active());
is_active_ = false;
#if !defined(BOOST_LEAF_NO_THREADS) && !defined(NDEBUG)
@@ -360,7 +360,7 @@ public:
BOOST_LEAF_CONSTEXPR void unload(error_id id) noexcept
{
BOOST_LEAF_ASSERT(!is_active());
leaf_detail::tuple_for_each<std::tuple_size<Tup>::value,Tup>::unload(tup_, id.value());
detail::tuple_for_each<std::tuple_size<Tup>::value,Tup>::unload(tup_, id.value());
}
BOOST_LEAF_CONSTEXPR bool is_active() const noexcept
@@ -372,7 +372,7 @@ public:
void print( std::basic_ostream<CharT, Traits> & os ) const
{
char const * prefix = "Contents:";
leaf_detail::print_tuple_contents<Tup>(os, &tup_, error_id(), prefix);
detail::print_tuple_contents<Tup>(os, &tup_, error_id(), prefix);
}
template <class CharT, class Traits>
@@ -385,7 +385,7 @@ public:
template <class T>
BOOST_LEAF_CONSTEXPR T const * get(error_id err) const noexcept
{
leaf_detail::slot<T> const * e = leaf_detail::find_in_tuple<leaf_detail::slot<T>>(tup_);
detail::slot<T> const * e = detail::find_in_tuple<detail::slot<T>>(tup_);
return e ? e->has_value(err.value()) : nullptr;
}
@@ -403,7 +403,7 @@ public:
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class TypeList>
struct deduce_context_impl;
@@ -443,7 +443,7 @@ namespace leaf_detail
}
template <class... H>
using context_type_from_handlers = typename leaf_detail::context_type_from_handlers_impl<H...>::type;
using context_type_from_handlers = typename detail::context_type_from_handlers_impl<H...>::type;
////////////////////////////////////////////

View File

@@ -17,7 +17,7 @@ namespace boost { namespace leaf {
class error_id;
namespace leaf_detail
namespace detail
{
struct BOOST_LEAF_SYMBOL_VISIBLE tls_tag_id_factory_current_id;
@@ -88,7 +88,7 @@ namespace leaf_detail
{
capture_list moved(first_);
first_ = nullptr;
tls::write_uint<leaf_detail::tls_tag_id_factory_current_id>(unsigned(err_id));
tls::write_uint<detail::tls_tag_id_factory_current_id>(unsigned(err_id));
moved.for_each(
[err_id]( node & n )
{

View File

@@ -46,7 +46,7 @@
namespace boost { namespace leaf {
namespace leaf_detail
namespace detail
{
// The functions below are C++11 constexpr, but we use BOOST_LEAF_ALWAYS_INLINE to control object file
// section count / template bleat. Evidently this makes a difference on gcc / windows at least.
@@ -145,7 +145,7 @@ namespace n
// Unrecognized __PRETTY_FUNCTION__/__FUNCSIG__ formats will result in compiler diagnostics.
// In that case, please file an issue on https://github.com/boostorg/leaf.
#define BOOST_LEAF_P(P) (sizeof(char[1 + leaf_detail::check_prefix(BOOST_LEAF_PRETTY_FUNCTION, P)]) - 1)
#define BOOST_LEAF_P(P) (sizeof(char[1 + detail::check_prefix(BOOST_LEAF_PRETTY_FUNCTION, P)]) - 1)
// clang style:
int const p01 = BOOST_LEAF_P("r boost::leaf::n::p() [T = ");
// old clang style:
@@ -170,7 +170,7 @@ namespace n
int const p15 = BOOST_LEAF_P("struct boost::leaf::n::r __fastcall boost::leaf::n::p<");
#undef BOOST_LEAF_P
#define BOOST_LEAF_S(S) (sizeof(char[1 + leaf_detail::check_suffix(BOOST_LEAF_PRETTY_FUNCTION, S)]) - 1)
#define BOOST_LEAF_S(S) (sizeof(char[1 + detail::check_suffix(BOOST_LEAF_PRETTY_FUNCTION, S)]) - 1)
// clang/gcc style:
int const s01 = BOOST_LEAF_S("]");
// msvc style:
@@ -213,7 +213,7 @@ parsed parse()
namespace boost { namespace leaf {
namespace leaf_detail
namespace detail
{
template <class CharT, class Traits>
std::ostream & demangle_and_print(std::basic_ostream<CharT, Traits> & os, char const * mangled_name)

View File

@@ -12,7 +12,7 @@
namespace boost { namespace leaf {
namespace leaf_detail
namespace detail
{
template <class T> struct remove_noexcept { using type = T; };
template <class R, class... A> struct remove_noexcept<R(*)(A...) noexcept> { using type = R(*)(A...); };

View File

@@ -13,7 +13,7 @@
namespace boost { namespace leaf {
namespace leaf_detail
namespace detail
{
template <class T>
class optional

View File

@@ -21,7 +21,7 @@ struct show_in_diagnostics: std::true_type
{
};
namespace leaf_detail
namespace detail
{
template <class T, class E = void>
struct is_printable: std::false_type

View File

@@ -27,7 +27,7 @@ protected:
BOOST_LEAF_CONSTEXPR diagnostic_info( error_info const & ei, Tup const & tup ) noexcept:
error_info(ei),
tup_(&tup),
print_tuple_contents_(&leaf_detail::print_tuple_contents<Tup>)
print_tuple_contents_(&detail::print_tuple_contents<Tup>)
{
}
@@ -47,7 +47,7 @@ protected:
}
};
namespace leaf_detail
namespace detail
{
struct diagnostic_info_: diagnostic_info
{
@@ -97,7 +97,7 @@ protected:
}
};
namespace leaf_detail
namespace detail
{
struct diagnostic_info_: diagnostic_info
{
@@ -128,14 +128,14 @@ namespace leaf_detail
class diagnostic_details: public diagnostic_info
{
leaf_detail::dynamic_allocator const * const da_;
detail::dynamic_allocator const * const da_;
protected:
diagnostic_details( diagnostic_details const & ) noexcept = default;
template <class Tup>
BOOST_LEAF_CONSTEXPR diagnostic_details( error_info const & ei, Tup const & tup, leaf_detail::dynamic_allocator const * da ) noexcept:
BOOST_LEAF_CONSTEXPR diagnostic_details( error_info const & ei, Tup const & tup, detail::dynamic_allocator const * da ) noexcept:
diagnostic_info(ei, tup),
da_(da)
{
@@ -160,7 +160,7 @@ protected:
}
};
namespace leaf_detail
namespace detail
{
struct diagnostic_details_: diagnostic_details
{
@@ -212,7 +212,7 @@ protected:
}
};
namespace leaf_detail
namespace detail
{
struct diagnostic_details_: diagnostic_details
{
@@ -264,7 +264,7 @@ protected:
}
};
namespace leaf_detail
namespace detail
{
struct diagnostic_details_: diagnostic_details
{

View File

@@ -59,7 +59,7 @@
#endif
#define BOOST_LEAF_NEW_ERROR ::boost::leaf::leaf_detail::inject_loc{__FILE__,__LINE__,__FUNCTION__}+::boost::leaf::new_error
#define BOOST_LEAF_NEW_ERROR ::boost::leaf::detail::inject_loc{__FILE__,__LINE__,__FUNCTION__}+::boost::leaf::new_error
namespace boost { namespace leaf {
@@ -85,7 +85,7 @@ struct show_in_diagnostics<e_source_location>: std::false_type
class BOOST_LEAF_SYMBOL_VISIBLE error_id;
namespace leaf_detail
namespace detail
{
class BOOST_LEAF_SYMBOL_VISIBLE exception_base
{
@@ -102,7 +102,7 @@ namespace leaf_detail
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class E>
class BOOST_LEAF_SYMBOL_VISIBLE slot:
@@ -170,7 +170,7 @@ namespace leaf_detail
#if BOOST_LEAF_CFG_CAPTURE
namespace leaf_detail
namespace detail
{
class BOOST_LEAF_SYMBOL_VISIBLE dynamic_allocator:
capture_list
@@ -305,7 +305,7 @@ namespace leaf_detail
if( std::exception_ptr ex = std::current_exception() )
(void) new capturing_exception_node(last_, std::move(ex));
#endif
leaf_detail::capture_list::node * const f = first_;
detail::capture_list::node * const f = first_;
first_ = nullptr;
last_ = &first_;
return { err_id, capture_list(f) };
@@ -399,7 +399,7 @@ namespace leaf_detail
}
template <>
struct show_in_diagnostics<leaf_detail::dynamic_allocator>: std::false_type
struct show_in_diagnostics<detail::dynamic_allocator>: std::false_type
{
};
@@ -407,7 +407,7 @@ struct show_in_diagnostics<leaf_detail::dynamic_allocator>: std::false_type
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class E>
inline void slot<E>::unload( int err_id ) noexcept(!BOOST_LEAF_CFG_CAPTURE)
@@ -489,7 +489,7 @@ namespace leaf_detail
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class T, int Arity = function_traits<T>::arity>
struct load_item
@@ -527,7 +527,7 @@ namespace leaf_detail
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
struct BOOST_LEAF_SYMBOL_VISIBLE tls_tag_id_factory_current_id;
@@ -578,7 +578,7 @@ namespace leaf_detail
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
namespace leaf_detail
namespace detail
{
class leaf_category final: public std::error_category
{
@@ -623,7 +623,7 @@ namespace leaf_detail
inline bool is_error_id( std::error_code const & ec ) noexcept
{
bool res = (&ec.category() == &leaf_detail::get_error_category<>::cat);
bool res = (&ec.category() == &detail::get_error_category<>::cat);
BOOST_LEAF_ASSERT(!res || !ec.value() || ((ec.value()&3)==1));
return res;
}
@@ -632,14 +632,14 @@ inline bool is_error_id( std::error_code const & ec ) noexcept
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
BOOST_LEAF_CONSTEXPR error_id make_error_id(int) noexcept;
}
class BOOST_LEAF_SYMBOL_VISIBLE error_id
{
friend error_id BOOST_LEAF_CONSTEXPR leaf_detail::make_error_id(int) noexcept;
friend error_id BOOST_LEAF_CONSTEXPR detail::make_error_id(int) noexcept;
int value_;
@@ -658,20 +658,20 @@ public:
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
error_id( std::error_code const & ec ) noexcept:
value_(leaf_detail::import_error_code(ec))
value_(detail::import_error_code(ec))
{
BOOST_LEAF_ASSERT(!value_ || ((value_&3)==1));
}
template <class Enum>
error_id( Enum e, typename std::enable_if<std::is_error_code_enum<Enum>::value, Enum>::type * = 0 ) noexcept:
value_(leaf_detail::import_error_code(e))
value_(detail::import_error_code(e))
{
}
operator std::error_code() const noexcept
{
return std::error_code(value_, leaf_detail::get_error_category<>::cat);
return std::error_code(value_, detail::get_error_category<>::cat);
}
#endif
@@ -685,7 +685,7 @@ public:
{
if (int err_id = value())
{
int const unused[] = { 42, leaf_detail::load_item<Item>::load_(err_id, std::forward<Item>(item)) };
int const unused[] = { 42, detail::load_item<Item>::load_(err_id, std::forward<Item>(item)) };
(void)unused;
}
return *this;
@@ -696,7 +696,7 @@ public:
{
if( int err_id = value() )
{
int const unused[] = { 42, leaf_detail::load_item<Item>::load_(err_id, std::forward<Item>(item))... };
int const unused[] = { 42, detail::load_item<Item>::load_(err_id, std::forward<Item>(item))... };
(void) unused;
}
return *this;
@@ -744,7 +744,7 @@ public:
}
};
namespace leaf_detail
namespace detail
{
BOOST_LEAF_CONSTEXPR inline error_id make_error_id( int err_id ) noexcept
{
@@ -755,18 +755,18 @@ namespace leaf_detail
inline error_id new_error() noexcept
{
return leaf_detail::make_error_id(leaf_detail::new_id());
return detail::make_error_id(detail::new_id());
}
template <class... Item>
inline error_id new_error( Item && ... item ) noexcept
{
return leaf_detail::make_error_id(leaf_detail::new_id()).load(std::forward<Item>(item)...);
return detail::make_error_id(detail::new_id()).load(std::forward<Item>(item)...);
}
inline error_id current_error() noexcept
{
return leaf_detail::make_error_id(leaf_detail::current_id());
return detail::make_error_id(detail::current_id());
}
////////////////////////////////////////////

View File

@@ -20,7 +20,7 @@ namespace boost
namespace boost { namespace leaf {
namespace leaf_detail
namespace detail
{
template <class T>
[[noreturn]] void throw_exception_impl( T && e )
@@ -35,7 +35,7 @@ namespace leaf_detail
namespace boost { namespace leaf {
namespace leaf_detail
namespace detail
{
template <class T>
[[noreturn]] void throw_exception_impl( T && e )
@@ -50,11 +50,11 @@ namespace leaf_detail
////////////////////////////////////////
#define BOOST_LEAF_THROW_EXCEPTION ::boost::leaf::leaf_detail::throw_with_loc{__FILE__,__LINE__,__FUNCTION__}+::boost::leaf::leaf_detail::make_exception
#define BOOST_LEAF_THROW_EXCEPTION ::boost::leaf::detail::throw_with_loc{__FILE__,__LINE__,__FUNCTION__}+::boost::leaf::detail::make_exception
namespace boost { namespace leaf {
namespace leaf_detail
namespace detail
{
struct throw_with_loc
{
@@ -66,14 +66,14 @@ namespace leaf_detail
[[noreturn]] friend void operator+( throw_with_loc loc, Ex && ex )
{
ex.load_source_location_(loc.file, loc.line, loc.fn);
::boost::leaf::leaf_detail::throw_exception_impl(std::move(ex));
::boost::leaf::detail::throw_exception_impl(std::move(ex));
}
};
}
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
inline void enforce_std_exception( std::exception const & ) noexcept { }
@@ -87,7 +87,7 @@ namespace leaf_detail
bool is_current_exception() const noexcept
{
return tls::read_uint<leaf_detail::tls_tag_id_factory_current_id>() == unsigned(error_id::value());
return tls::read_uint<detail::tls_tag_id_factory_current_id>() == unsigned(error_id::value());
}
error_id get_error_id() const noexcept final override
@@ -99,7 +99,7 @@ namespace leaf_detail
#if BOOST_LEAF_CFG_DIAGNOSTICS && !defined(BOOST_LEAF_NO_EXCEPTIONS)
void print_type_name(std::ostream & os) const final override
{
leaf_detail::demangle_and_print(os, typeid(Ex).name());
detail::demangle_and_print(os, typeid(Ex).name());
}
#endif
@@ -149,7 +149,7 @@ namespace leaf_detail
~exception() noexcept
{
if( clear_current_error_ && is_current_exception() )
tls::write_uint<leaf_detail::tls_tag_id_factory_current_id>(0);
tls::write_uint<detail::tls_tag_id_factory_current_id>(0);
}
};
@@ -218,8 +218,8 @@ template <class... E>
// Warning: setting a breakpoint here will not intercept exceptions thrown
// via BOOST_LEAF_THROW_EXCEPTION or originating in the few other throw
// points elsewhere in LEAF. To intercept all of those exceptions as well,
// set a breakpoint inside boost::leaf::leaf_detail::throw_exception_impl.
leaf_detail::throw_exception_impl(leaf_detail::make_exception(std::forward<E>(e)...));
// set a breakpoint inside boost::leaf::detail::throw_exception_impl.
detail::throw_exception_impl(detail::make_exception(std::forward<E>(e)...));
}
////////////////////////////////////////
@@ -229,7 +229,7 @@ template <class... E>
template <class T>
class BOOST_LEAF_SYMBOL_VISIBLE result;
namespace leaf_detail
namespace detail
{
inline error_id catch_exceptions_helper( std::exception const &, leaf_detail_mp11::mp_list<> )
{
@@ -263,7 +263,7 @@ namespace leaf_detail
template <class... Ex, class F>
inline
leaf_detail::deduce_exception_to_result_return_type<leaf_detail::fn_return_type<F>>
detail::deduce_exception_to_result_return_type<detail::fn_return_type<F>>
exception_to_result( F && f ) noexcept
{
try
@@ -272,7 +272,7 @@ exception_to_result( F && f ) noexcept
}
catch( std::exception const & ex )
{
return leaf_detail::catch_exceptions_helper(ex, leaf_detail_mp11::mp_list<Ex...>());
return detail::catch_exceptions_helper(ex, leaf_detail_mp11::mp_list<Ex...>());
}
catch(...)
{

View File

@@ -19,11 +19,11 @@ class BOOST_LEAF_SYMBOL_VISIBLE result;
#ifndef BOOST_LEAF_NO_EXCEPTIONS
namespace leaf_detail
namespace detail
{
inline error_id unpack_error_id(std::exception const & ex) noexcept
{
if( leaf_detail::exception_base const * eb = dynamic_cast<leaf_detail::exception_base const *>(&ex) )
if( detail::exception_base const * eb = dynamic_cast<detail::exception_base const *>(&ex) )
return eb->get_error_id();
if( error_id const * err_id = dynamic_cast<error_id const *>(&ex) )
return *err_id;
@@ -91,11 +91,11 @@ public:
{
os << "\nCaught:" BOOST_LEAF_CFG_DIAGNOSTICS_FIRST_DELIMITER;
#if BOOST_LEAF_CFG_DIAGNOSTICS
if( auto eb = dynamic_cast<leaf_detail::exception_base const *>(ex_) )
if( auto eb = dynamic_cast<detail::exception_base const *>(ex_) )
eb->print_type_name(os);
else
#endif
leaf_detail::demangle_and_print(os, typeid(*ex_).name());
detail::demangle_and_print(os, typeid(*ex_).name());
os << ": \"" << ex_->what() << '"';
}
#endif
@@ -109,7 +109,7 @@ public:
}
};
namespace leaf_detail
namespace detail
{
template <>
struct handler_argument_traits<error_info const &>: handler_argument_always_available<>
@@ -124,7 +124,7 @@ namespace leaf_detail
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class T, class... List>
struct type_index;
@@ -297,7 +297,7 @@ namespace leaf_detail
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class A>
template <class Tup>
@@ -352,7 +352,7 @@ namespace leaf_detail
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class>
struct handler_matches_any_error: std::false_type
@@ -373,7 +373,7 @@ namespace leaf_detail
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class Tup, class... A>
BOOST_LEAF_CONSTEXPR inline bool check_handler_( Tup & tup, error_info const & ei, leaf_detail_mp11::mp_list<A...> ) noexcept
@@ -485,7 +485,7 @@ context<E...>::
handle_error( error_id id, H && ... h ) const
{
BOOST_LEAF_ASSERT(!is_active());
return leaf_detail::handle_error_<R>(tup(), error_info(id, nullptr, this->get<e_source_location>(id)), std::forward<H>(h)...);
return detail::handle_error_<R>(tup(), error_info(id, nullptr, this->get<e_source_location>(id)), std::forward<H>(h)...);
}
template <class... E>
@@ -496,12 +496,12 @@ context<E...>::
handle_error( error_id id, H && ... h )
{
BOOST_LEAF_ASSERT(!is_active());
return leaf_detail::handle_error_<R>(tup(), error_info(id, nullptr, this->get<e_source_location>(id)), std::forward<H>(h)...);
return detail::handle_error_<R>(tup(), error_info(id, nullptr, this->get<e_source_location>(id)), std::forward<H>(h)...);
}
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class T>
void unload_result( result<T> * r )
@@ -530,7 +530,7 @@ try_handle_all( TryBlock && try_block, H && ... h ) noexcept
return std::move(r).value();
else
{
leaf_detail::unload_result(&r);
detail::unload_result(&r);
error_id id = r.error();
ctx.deactivate();
using R = typename std::decay<decltype(std::declval<TryBlock>()().value())>::type;
@@ -550,7 +550,7 @@ try_handle_some( TryBlock && try_block, H && ... h ) noexcept
return r;
else
{
leaf_detail::unload_result(&r);
detail::unload_result(&r);
error_id id = r.error();
ctx.deactivate();
using R = typename std::decay<decltype(std::declval<TryBlock>()())>::type;
@@ -573,13 +573,13 @@ try_catch( TryBlock && try_block, H && ... ) noexcept
#else
namespace leaf_detail
namespace detail
{
template <class Ctx, class TryBlock, class... H>
decltype(std::declval<TryBlock>()())
try_catch_( Ctx & ctx, TryBlock && try_block, H && ... h )
{
using namespace leaf_detail;
using namespace detail;
BOOST_LEAF_ASSERT(ctx.is_active());
using R = decltype(std::declval<TryBlock>()());
try
@@ -591,7 +591,7 @@ namespace leaf_detail
catch( std::exception & ex )
{
ctx.deactivate();
error_id id = leaf_detail::unpack_error_id(ex);
error_id id = detail::unpack_error_id(ex);
return handle_error_<R>(ctx.tup(), error_info(id, &ex, ctx.template get<e_source_location>(id)), std::forward<H>(h)...,
[&]() -> R
{
@@ -621,12 +621,12 @@ try_handle_all( TryBlock && try_block, H && ... h )
static_assert(is_result_type<decltype(std::declval<TryBlock>()())>::value, "The return type of the try_block passed to try_handle_all must be registered with leaf::is_result_type");
context_type_from_handlers<H...> ctx;
auto active_context = activate_context(ctx);
if( auto r = leaf_detail::try_catch_(ctx, std::forward<TryBlock>(try_block), std::forward<H>(h)...) )
if( auto r = detail::try_catch_(ctx, std::forward<TryBlock>(try_block), std::forward<H>(h)...) )
return std::move(r).value();
else
{
BOOST_LEAF_ASSERT(ctx.is_active());
leaf_detail::unload_result(&r);
detail::unload_result(&r);
error_id id = r.error();
ctx.deactivate();
using R = typename std::decay<decltype(std::declval<TryBlock>()().value())>::type;
@@ -642,11 +642,11 @@ try_handle_some( TryBlock && try_block, H && ... h )
static_assert(is_result_type<decltype(std::declval<TryBlock>()())>::value, "The return type of the try_block passed to try_handle_some must be registered with leaf::is_result_type");
context_type_from_handlers<H...> ctx;
auto active_context = activate_context(ctx);
if( auto r = leaf_detail::try_catch_(ctx, std::forward<TryBlock>(try_block), std::forward<H>(h)...) )
if( auto r = detail::try_catch_(ctx, std::forward<TryBlock>(try_block), std::forward<H>(h)...) )
return r;
else if( ctx.is_active() )
{
leaf_detail::unload_result(&r);
detail::unload_result(&r);
error_id id = r.error();
ctx.deactivate();
using R = typename std::decay<decltype(std::declval<TryBlock>()())>::type;
@@ -681,8 +681,8 @@ try_catch( TryBlock && try_block, H && ... h )
catch( std::exception & ex )
{
ctx.deactivate();
error_id id = leaf_detail::unpack_error_id(ex);
return leaf_detail::handle_error_<R>(ctx.tup(), error_info(id, &ex, ctx.template get<e_source_location>(id)), std::forward<H>(h)...,
error_id id = detail::unpack_error_id(ex);
return detail::handle_error_<R>(ctx.tup(), error_info(id, &ex, ctx.template get<e_source_location>(id)), std::forward<H>(h)...,
[&]() -> R
{
ctx.unload(id);
@@ -693,7 +693,7 @@ try_catch( TryBlock && try_block, H && ... h )
{
ctx.deactivate();
error_id id = current_error();
return leaf_detail::handle_error_<R>(ctx.tup(), error_info(id, nullptr, ctx.template get<e_source_location>(id)), std::forward<H>(h)...,
return detail::handle_error_<R>(ctx.tup(), error_info(id, nullptr, ctx.template get<e_source_location>(id)), std::forward<H>(h)...,
[&]() -> R
{
ctx.unload(id);
@@ -706,7 +706,7 @@ try_catch( TryBlock && try_block, H && ... h )
#if BOOST_LEAF_CFG_CAPTURE
namespace leaf_detail
namespace detail
{
template <class LeafResult>
struct try_capture_all_dispatch_non_void
@@ -719,7 +719,7 @@ namespace leaf_detail
leaf_result
try_capture_all_( TryBlock && try_block ) noexcept
{
leaf_detail::slot<leaf_detail::dynamic_allocator> sl;
detail::slot<detail::dynamic_allocator> sl;
sl.activate();
#ifndef BOOST_LEAF_NO_EXCEPTIONS
try
@@ -780,7 +780,7 @@ namespace leaf_detail
leaf_result
try_capture_all_( TryBlock && try_block ) noexcept
{
leaf_detail::slot<leaf_detail::dynamic_allocator> sl;
detail::slot<detail::dynamic_allocator> sl;
sl.activate();
#ifndef BOOST_LEAF_NO_EXCEPTIONS
try
@@ -809,10 +809,10 @@ namespace leaf_detail
template <class TryBlock>
inline
typename leaf_detail::try_capture_all_dispatch<decltype(std::declval<TryBlock>()())>::leaf_result
typename detail::try_capture_all_dispatch<decltype(std::declval<TryBlock>()())>::leaf_result
try_capture_all( TryBlock && try_block ) noexcept
{
return leaf_detail::try_capture_all_dispatch<decltype(std::declval<TryBlock>()())>::try_capture_all_(std::forward<TryBlock>(try_block));
return detail::try_capture_all_dispatch<decltype(std::declval<TryBlock>()())>::try_capture_all_(std::forward<TryBlock>(try_block));
}
#endif
@@ -826,7 +826,7 @@ namespace boost { namespace exception_detail { template <class ErrorInfo> struct
namespace boost { namespace leaf {
namespace leaf_detail
namespace detail
{
template <class T>
struct match_enum_type;

View File

@@ -24,13 +24,13 @@ public:
#if !defined(BOOST_LEAF_NO_EXCEPTIONS) && BOOST_LEAF_STD_UNCAUGHT_EXCEPTIONS
uncaught_exceptions_(std::uncaught_exceptions()),
#endif
err_id_(leaf_detail::current_id())
err_id_(detail::current_id())
{
}
int check_id() const noexcept
{
int err_id = leaf_detail::current_id();
int err_id = detail::current_id();
if( err_id != err_id_ )
return err_id;
else
@@ -41,7 +41,7 @@ public:
# else
if( std::uncaught_exception() )
# endif
return leaf_detail::new_id();
return detail::new_id();
#endif
return 0;
}
@@ -49,27 +49,27 @@ public:
int get_id() const noexcept
{
int err_id = leaf_detail::current_id();
int err_id = detail::current_id();
if( err_id != err_id_ )
return err_id;
else
return leaf_detail::new_id();
return detail::new_id();
}
error_id check() const noexcept
{
return leaf_detail::make_error_id(check_id());
return detail::make_error_id(check_id());
}
error_id assigned_error_id() const noexcept
{
return leaf_detail::make_error_id(get_id());
return detail::make_error_id(get_id());
}
};
////////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <int I, class Tup>
struct tuple_for_each_preload
@@ -222,10 +222,10 @@ namespace leaf_detail
template <class... Item>
BOOST_LEAF_ATTRIBUTE_NODISCARD BOOST_LEAF_CONSTEXPR inline
leaf_detail::preloaded<typename leaf_detail::deduce_item_type<Item>::type...>
detail::preloaded<typename detail::deduce_item_type<Item>::type...>
on_error( Item && ... i )
{
return leaf_detail::preloaded<typename leaf_detail::deduce_item_type<Item>::type...>(std::forward<Item>(i)...);
return detail::preloaded<typename detail::deduce_item_type<Item>::type...>(std::forward<Item>(i)...);
}
} }

View File

@@ -12,13 +12,13 @@
#if __cplusplus >= 201703L
# define BOOST_LEAF_MATCH_ARGS(et,v1,v) auto v1, auto... v
#else
# define BOOST_LEAF_MATCH_ARGS(et,v1,v) typename leaf_detail::et::type v1, typename leaf_detail::et::type... v
# define BOOST_LEAF_MATCH_ARGS(et,v1,v) typename detail::et::type v1, typename detail::et::type... v
#endif
#define BOOST_LEAF_ESC(...) __VA_ARGS__
namespace boost { namespace leaf {
namespace leaf_detail
namespace detail
{
#if __cplusplus >= 201703L
template <class MatchType, class T>
@@ -76,7 +76,7 @@ BOOST_LEAF_CONSTEXPR inline bool category( std::error_code const & ec )
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class T>
struct match_enum_type
@@ -108,7 +108,7 @@ struct match
template <class T>
BOOST_LEAF_CONSTEXPR static bool evaluate(T && x)
{
return leaf_detail::cmp_value_pack(std::forward<T>(x), V1, V...);
return detail::cmp_value_pack(std::forward<T>(x), V1, V...);
}
};
@@ -121,7 +121,7 @@ struct match<condition<Enum, Enum>, V1, V...>
BOOST_LEAF_CONSTEXPR static bool evaluate(std::error_code const & e) noexcept
{
return leaf_detail::cmp_value_pack(e, V1, V...);
return detail::cmp_value_pack(e, V1, V...);
}
};
#endif
@@ -133,7 +133,7 @@ struct is_predicate<match<E, V1, V...>>: std::true_type
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class E>
struct match_value_enum_type
@@ -164,7 +164,7 @@ struct match_value
BOOST_LEAF_CONSTEXPR static bool evaluate(E const & e) noexcept
{
return leaf_detail::cmp_value_pack(e.value, V1, V...);
return detail::cmp_value_pack(e.value, V1, V...);
}
};
@@ -177,7 +177,7 @@ struct match_value<condition<E, Enum>, V1, V...>
BOOST_LEAF_CONSTEXPR static bool evaluate(E const & e)
{
return leaf_detail::cmp_value_pack(e.value, V1, V...);
return detail::cmp_value_pack(e.value, V1, V...);
}
};
#endif
@@ -201,7 +201,7 @@ struct match_member<P, V1, V...>
BOOST_LEAF_CONSTEXPR static bool evaluate(E const & e) noexcept
{
return leaf_detail::cmp_value_pack(e.*P, V1, V...);
return detail::cmp_value_pack(e.*P, V1, V...);
}
};
@@ -236,7 +236,7 @@ struct is_predicate<if_not<P>>: std::true_type
#ifndef BOOST_LEAF_NO_EXCEPTIONS
namespace leaf_detail
namespace detail
{
template <class Ex>
BOOST_LEAF_CONSTEXPR inline bool check_exception_pack( std::exception const & ex, Ex const * ) noexcept
@@ -264,7 +264,7 @@ struct catch_
BOOST_LEAF_CONSTEXPR static bool evaluate(std::exception const & ex) noexcept
{
return leaf_detail::check_exception_pack(ex, static_cast<Ex const *>(nullptr)...);
return detail::check_exception_pack(ex, static_cast<Ex const *>(nullptr)...);
}
};

View File

@@ -16,7 +16,7 @@
namespace boost { namespace leaf {
namespace leaf_detail { class dynamic_allocator; }
namespace detail { class dynamic_allocator; }
////////////////////////////////////////
@@ -31,7 +31,7 @@ class bad_result:
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class T, bool Printable = is_printable<T>::value>
struct result_value_printer;
@@ -65,7 +65,7 @@ namespace leaf_detail
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
template <class T>
struct stored
@@ -133,7 +133,7 @@ namespace leaf_detail
}
#if BOOST_LEAF_CFG_CAPTURE
explicit result_discriminant( int err_id, leaf_detail::capture_list const & ) noexcept:
explicit result_discriminant( int err_id, detail::capture_list const & ) noexcept:
state_((err_id&~3) | 2)
{
BOOST_LEAF_ASSERT((err_id&3) == 1);
@@ -170,20 +170,20 @@ class BOOST_LEAF_SYMBOL_VISIBLE BOOST_LEAF_ATTRIBUTE_NODISCARD result
template <class U>
friend class result;
friend class leaf_detail::dynamic_allocator;
friend class detail::dynamic_allocator;
#if BOOST_LEAF_CFG_CAPTURE
using capture_list = leaf_detail::capture_list;
using capture_list = detail::capture_list;
#endif
using result_discriminant = leaf_detail::result_discriminant;
using stored_type = typename leaf_detail::stored<T>::type;
using value_no_ref = typename leaf_detail::stored<T>::value_no_ref;
using value_no_ref_const = typename leaf_detail::stored<T>::value_no_ref_const;
using value_ref = typename leaf_detail::stored<T>::value_ref;
using value_cref = typename leaf_detail::stored<T>::value_cref;
using value_rv_ref = typename leaf_detail::stored<T>::value_rv_ref;
using value_rv_cref = typename leaf_detail::stored<T>::value_rv_cref;
using result_discriminant = detail::result_discriminant;
using stored_type = typename detail::stored<T>::type;
using value_no_ref = typename detail::stored<T>::value_no_ref;
using value_no_ref_const = typename detail::stored<T>::value_no_ref_const;
using value_ref = typename detail::stored<T>::value_ref;
using value_cref = typename detail::stored<T>::value_cref;
using value_rv_ref = typename detail::stored<T>::value_rv_ref;
using value_rv_cref = typename detail::stored<T>::value_rv_cref;
union
{
@@ -298,7 +298,7 @@ class BOOST_LEAF_SYMBOL_VISIBLE BOOST_LEAF_ATTRIBUTE_NODISCARD result
protected:
#if BOOST_LEAF_CFG_CAPTURE
result( int err_id, leaf_detail::capture_list && cap ) noexcept:
result( int err_id, detail::capture_list && cap ) noexcept:
cap_(std::move(cap)),
what_(err_id, cap)
{
@@ -519,12 +519,12 @@ public:
value_no_ref_const * operator->() const noexcept
{
return has_value() ? leaf_detail::stored<T>::cptr(stored_) : nullptr;
return has_value() ? detail::stored<T>::cptr(stored_) : nullptr;
}
value_no_ref * operator->() noexcept
{
return has_value() ? leaf_detail::stored<T>::ptr(stored_) : nullptr;
return has_value() ? detail::stored<T>::ptr(stored_) : nullptr;
}
#ifdef BOOST_LEAF_NO_CXX11_REF_QUALIFIERS
@@ -598,7 +598,7 @@ public:
friend std::ostream & operator<<( std::basic_ostream<CharT, Traits> & os, result const & r )
{
if( r.what_.kind() == result_discriminant::val )
leaf_detail::print_result_value(os, r.value());
detail::print_result_value(os, r.value());
else
r.print_error_result(os);
return os;
@@ -607,26 +607,26 @@ public:
////////////////////////////////////////
namespace leaf_detail
namespace detail
{
struct void_ { };
}
template <>
class BOOST_LEAF_SYMBOL_VISIBLE BOOST_LEAF_ATTRIBUTE_NODISCARD result<void>:
result<leaf_detail::void_>
result<detail::void_>
{
template <class U>
friend class result;
friend class leaf_detail::dynamic_allocator;
friend class detail::dynamic_allocator;
using result_discriminant = leaf_detail::result_discriminant;
using void_ = leaf_detail::void_;
using result_discriminant = detail::result_discriminant;
using void_ = detail::void_;
using base = result<void_>;
#if BOOST_LEAF_CFG_CAPTURE
result( int err_id, leaf_detail::capture_list && cap ) noexcept:
result( int err_id, detail::capture_list && cap ) noexcept:
base(err_id, std::move(cap))
{
}

View File

@@ -38,7 +38,7 @@ int main()
{
static_assert(std::is_same<test_info, decltype(std::declval<leaf::match<test_info, 42>>().matched)>::value, "handler_argument_traits deduction bug");
using tr = leaf::leaf_detail::handler_argument_traits<leaf::match<test_info, 42>>;
using tr = leaf::detail::handler_argument_traits<leaf::match<test_info, 42>>;
static_assert(std::is_same<leaf::leaf_detail_mp11::mp_list<>, tr::context_types>::value, "handler_argument_traits deduction bug");
{

View File

@@ -139,7 +139,7 @@ void not_called_on_purpose()
test<info<1>, info<2>, leaf::e_source_location>( expd([]( info<1>, info<2>, leaf::diagnostic_info const & ){ }, []( info<1>, info<2> ){ }) );
#if BOOST_LEAF_CFG_DIAGNOSTICS && BOOST_LEAF_CFG_CAPTURE
test<info<1>, info<2>, leaf::e_source_location, leaf::leaf_detail::dynamic_allocator>( expd([]( info<1>, info<2>, leaf::diagnostic_details const & ){ }, []( info<1>, info<2> ){ }) );
test<info<1>, info<2>, leaf::e_source_location, leaf::detail::dynamic_allocator>( expd([]( info<1>, info<2>, leaf::diagnostic_details const & ){ }, []( info<1>, info<2> ){ }) );
#else
test<info<1>, info<2>, leaf::e_source_location>( expd([]( info<1>, info<2>, leaf::diagnostic_details const & ){ }, []( info<1>, info<2> ){ }) );
#endif

View File

@@ -25,10 +25,10 @@ std::vector<int> generate_ids()
ids.reserve(ids_per_thread);
for(int i=0; i!=ids_per_thread-1; ++i)
{
int id = leaf::leaf_detail::new_id();
int id = leaf::detail::new_id();
BOOST_TEST_NE(id&1, 0);
int last = leaf::leaf_detail::current_id();
BOOST_TEST_EQ(last, leaf::leaf_detail::current_id());
int last = leaf::detail::current_id();
BOOST_TEST_EQ(last, leaf::detail::current_id());
BOOST_TEST_NE(last&1, 0);
BOOST_TEST_EQ(last, id);
ids.push_back(id);

View File

@@ -204,29 +204,29 @@ int main()
}
{
int const id = leaf::leaf_detail::current_id();
int const id = leaf::detail::current_id();
BOOST_TEST_EQ( 21, test<my_exception const &>( []
{
auto load = leaf::on_error(info{42});
throw my_exception(42);
} ) );
BOOST_TEST_NE(id, leaf::leaf_detail::current_id());
BOOST_TEST_NE(id, leaf::detail::current_id());
}
{
int const id = leaf::leaf_detail::current_id();
int const id = leaf::detail::current_id();
BOOST_TEST_EQ( 21, test<my_exception &>( []
{
auto load = leaf::on_error(info{42});
throw my_exception(42);
} ) );
BOOST_TEST_NE(id, leaf::leaf_detail::current_id());
BOOST_TEST_NE(id, leaf::detail::current_id());
}
{
BOOST_TEST_EQ( 23, test<my_exception const &>( []
{
int const id = leaf::leaf_detail::current_id();
int const id = leaf::detail::current_id();
try
{
leaf::try_catch(
@@ -237,7 +237,7 @@ int main()
}
catch(...)
{
BOOST_TEST_EQ(id, leaf::leaf_detail::current_id());
BOOST_TEST_EQ(id, leaf::detail::current_id());
throw;
}
} ) );
@@ -246,7 +246,7 @@ int main()
{
BOOST_TEST_EQ( 23, test<my_exception &>( []
{
int const id = leaf::leaf_detail::current_id();
int const id = leaf::detail::current_id();
try
{
leaf::try_catch(
@@ -257,7 +257,7 @@ int main()
}
catch(...)
{
BOOST_TEST_EQ(id, leaf::leaf_detail::current_id());
BOOST_TEST_EQ(id, leaf::detail::current_id());
throw;
}
} ) );

View File

@@ -16,7 +16,7 @@ namespace leaf = boost::leaf;
template <class F>
void check_traits( F )
{
using namespace leaf::leaf_detail;
using namespace leaf::detail;
using leaf::leaf_detail_mp11::mp_list;
static_assert(function_traits<F>::arity==4,"arity");
static_assert(std::is_same<fn_return_type<F>,double>::value,"return_type");
@@ -44,6 +44,6 @@ int main()
{
return 42;
} );
static_assert(leaf::leaf_detail::function_traits<int>::arity==-1, "int arity");
static_assert(leaf::detail::function_traits<int>::arity==-1, "int arity");
return 0;
}

View File

@@ -85,7 +85,7 @@ public:
void run_tests()
{
using leaf::leaf_detail::optional;
using leaf::detail::optional;
{
optional<my_info> x;
BOOST_TEST(x.empty());

View File

@@ -72,7 +72,7 @@ struct c4
template <int Line, class T>
std::string print(T const & x, char const * prefix, char const * delimiter)
{
using namespace leaf::leaf_detail;
using namespace leaf::detail;
std::ostringstream s;
diagnostic<T>::print(s, prefix, delimiter, x);
diagnostic<T>::print(s, prefix, delimiter, x);

View File

@@ -62,7 +62,7 @@ struct my_error_info
{
};
// Mirroring boost::leaf::leaf_detail::optional<T>, to verify correctness of TLS pointers
// Mirroring boost::leaf::detail::optional<T>, to verify correctness of TLS pointers
template <class T>
struct optional
{