mirror of
https://github.com/boostorg/leaf.git
synced 2026-02-14 00:42:36 +00:00
Removed redundant open/close of leaf namespace
This commit is contained in:
@@ -68,63 +68,6 @@
|
||||
|
||||
namespace boost { namespace leaf {
|
||||
|
||||
class BOOST_LEAF_SYMBOL_VISIBLE error_id;
|
||||
|
||||
namespace leaf_detail
|
||||
{
|
||||
struct BOOST_LEAF_SYMBOL_VISIBLE tls_tag_id_factory_current_id;
|
||||
|
||||
template <class=void>
|
||||
struct BOOST_LEAF_SYMBOL_VISIBLE id_factory
|
||||
{
|
||||
static atomic_unsigned_int counter;
|
||||
|
||||
BOOST_LEAF_CONSTEXPR static unsigned generate_next_id() noexcept
|
||||
{
|
||||
auto id = (counter+=4);
|
||||
BOOST_LEAF_ASSERT((id&3)==1);
|
||||
return id;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
atomic_unsigned_int id_factory<T>::counter(unsigned(-3));
|
||||
|
||||
inline int current_id() noexcept
|
||||
{
|
||||
unsigned id = tls::read_uint<tls_tag_id_factory_current_id>();
|
||||
BOOST_LEAF_ASSERT(id==0 || (id&3)==1);
|
||||
return int(id);
|
||||
}
|
||||
|
||||
inline int new_id() noexcept
|
||||
{
|
||||
unsigned id = id_factory<>::generate_next_id();
|
||||
tls::write_uint<tls_tag_id_factory_current_id>(id);
|
||||
return int(id);
|
||||
}
|
||||
|
||||
struct inject_loc
|
||||
{
|
||||
char const * const file;
|
||||
int const line;
|
||||
char const * const fn;
|
||||
|
||||
template <class T>
|
||||
friend T operator+( inject_loc loc, T && x ) noexcept
|
||||
{
|
||||
x.load_source_location_(loc.file, loc.line, loc.fn);
|
||||
return std::move(x);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
} }
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
namespace boost { namespace leaf {
|
||||
|
||||
struct BOOST_LEAF_SYMBOL_VISIBLE e_source_location
|
||||
{
|
||||
char const * file;
|
||||
@@ -138,11 +81,9 @@ struct BOOST_LEAF_SYMBOL_VISIBLE e_source_location
|
||||
}
|
||||
};
|
||||
|
||||
} }
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
namespace boost { namespace leaf {
|
||||
class BOOST_LEAF_SYMBOL_VISIBLE error_id;
|
||||
|
||||
namespace leaf_detail
|
||||
{
|
||||
@@ -207,14 +148,10 @@ namespace leaf_detail
|
||||
};
|
||||
}
|
||||
|
||||
} }
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
#if BOOST_LEAF_CFG_CAPTURE
|
||||
|
||||
namespace boost { namespace leaf {
|
||||
|
||||
namespace leaf_detail
|
||||
{
|
||||
class BOOST_LEAF_SYMBOL_VISIBLE dynamic_allocator:
|
||||
@@ -485,14 +422,10 @@ namespace leaf_detail
|
||||
}
|
||||
}
|
||||
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
namespace boost { namespace leaf {
|
||||
|
||||
namespace leaf_detail
|
||||
{
|
||||
template <class E>
|
||||
@@ -570,12 +503,8 @@ namespace leaf_detail
|
||||
}
|
||||
}
|
||||
|
||||
} }
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
namespace boost { namespace leaf {
|
||||
|
||||
namespace leaf_detail
|
||||
{
|
||||
template <class T, int Arity = function_traits<T>::arity>
|
||||
@@ -612,13 +541,58 @@ namespace leaf_detail
|
||||
};
|
||||
}
|
||||
|
||||
} }
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
|
||||
namespace leaf_detail
|
||||
{
|
||||
struct BOOST_LEAF_SYMBOL_VISIBLE tls_tag_id_factory_current_id;
|
||||
|
||||
namespace boost { namespace leaf {
|
||||
template <class=void>
|
||||
struct BOOST_LEAF_SYMBOL_VISIBLE id_factory
|
||||
{
|
||||
static atomic_unsigned_int counter;
|
||||
|
||||
BOOST_LEAF_CONSTEXPR static unsigned generate_next_id() noexcept
|
||||
{
|
||||
auto id = (counter+=4);
|
||||
BOOST_LEAF_ASSERT((id&3)==1);
|
||||
return id;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
atomic_unsigned_int id_factory<T>::counter(unsigned(-3));
|
||||
|
||||
inline int current_id() noexcept
|
||||
{
|
||||
unsigned id = tls::read_uint<tls_tag_id_factory_current_id>();
|
||||
BOOST_LEAF_ASSERT(id==0 || (id&3)==1);
|
||||
return int(id);
|
||||
}
|
||||
|
||||
inline int new_id() noexcept
|
||||
{
|
||||
unsigned id = id_factory<>::generate_next_id();
|
||||
tls::write_uint<tls_tag_id_factory_current_id>(id);
|
||||
return int(id);
|
||||
}
|
||||
|
||||
struct inject_loc
|
||||
{
|
||||
char const * const file;
|
||||
int const line;
|
||||
char const * const fn;
|
||||
|
||||
template <class T>
|
||||
friend T operator+( inject_loc loc, T && x ) noexcept
|
||||
{
|
||||
x.load_source_location_(loc.file, loc.line, loc.fn);
|
||||
return std::move(x);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
|
||||
|
||||
namespace leaf_detail
|
||||
{
|
||||
@@ -670,14 +644,10 @@ inline bool is_error_id( std::error_code const & ec ) noexcept
|
||||
return res;
|
||||
}
|
||||
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
namespace boost { namespace leaf {
|
||||
|
||||
namespace leaf_detail
|
||||
{
|
||||
BOOST_LEAF_CONSTEXPR error_id make_error_id(int) noexcept;
|
||||
@@ -857,12 +827,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} }
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
namespace boost { namespace leaf {
|
||||
|
||||
template <class R>
|
||||
struct is_result_type: std::false_type
|
||||
{
|
||||
|
||||
@@ -102,12 +102,8 @@ namespace leaf_detail
|
||||
};
|
||||
}
|
||||
|
||||
} }
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
namespace boost { namespace leaf {
|
||||
|
||||
namespace leaf_detail
|
||||
{
|
||||
inline void enforce_std_exception( std::exception const & ) noexcept { }
|
||||
|
||||
Reference in New Issue
Block a user