mirror of
https://github.com/boostorg/openmethod.git
synced 2026-01-19 04:22:12 +00:00
use nested namespace definitions everywhere, and reformat
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include <iostream>
|
||||
#include<boost/openmethod.hpp>
|
||||
#include <boost/openmethod.hpp>
|
||||
|
||||
#include "dog.hpp"
|
||||
|
||||
@@ -12,4 +12,4 @@ BOOST_OPENMETHOD_DEFINE_OVERRIDER(
|
||||
os << dog->name << " barks";
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace canines
|
||||
|
||||
@@ -18,6 +18,6 @@ BOOST_OPENMETHOD(
|
||||
using app_specific_behavior::BOOST_OPENMETHOD_GUIDE(meet);
|
||||
|
||||
BOOST_OPENMETHOD_OVERRIDE(
|
||||
meet, (std::ostream& os, virtual_ptr<Animal>, virtual_ptr<Animal>), void) {
|
||||
meet, (std::ostream & os, virtual_ptr<Animal>, virtual_ptr<Animal>), void) {
|
||||
os << "ignore";
|
||||
}
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace boost::openmethod {
|
||||
namespace detail {
|
||||
|
||||
template<class Reports, class Facets, typename = void>
|
||||
@@ -1320,7 +1319,6 @@ auto finalize() -> void {
|
||||
Policy::dispatch_data.clear();
|
||||
}
|
||||
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod
|
||||
|
||||
#endif
|
||||
|
||||
@@ -741,7 +741,8 @@ class virtual_ptr : public detail::virtual_ptr_impl<Class, Policy> {
|
||||
|
||||
if constexpr (
|
||||
Policy::template has_facet<policies::runtime_checks> &&
|
||||
Policy::template is_polymorphic<typename impl::traits::virtual_type> &&
|
||||
Policy::template is_polymorphic<
|
||||
typename impl::traits::virtual_type> &&
|
||||
Policy::template is_polymorphic<other_class>) {
|
||||
// check that dynamic type == static type
|
||||
auto static_type = Policy::template static_type<other_class>();
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include <charconv>
|
||||
#include <random>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace boost::openmethod {
|
||||
|
||||
namespace detail {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -86,7 +86,7 @@ inline auto operator<<(ostdstream& os, std::size_t value) -> ostdstream& {
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
|
||||
} // namespace boost::openmethod
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include <algorithm>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace boost::openmethod {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename T>
|
||||
@@ -210,6 +210,6 @@ class static_list {
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace boost::openmethod {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename Iterator>
|
||||
@@ -158,7 +158,6 @@ auto operator<<(trace_type<Policy>& trace, const type_name& manip) -> auto& {
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod
|
||||
|
||||
#endif // BOOST_OPENMETHOD_DETAIL_HPP
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
|
||||
#include <boost/openmethod/detail/static_list.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace boost::openmethod {
|
||||
|
||||
using type_id = std::uintptr_t;
|
||||
using vptr_type = const std::uintptr_t*;
|
||||
@@ -133,7 +132,7 @@ struct overrider_info : static_list<overrider_info>::static_link {
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
|
||||
} // namespace boost::openmethod
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
#include <boost/openmethod/policies/basic_policy.hpp>
|
||||
#include <boost/openmethod/detail/ostdstream.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace policies {
|
||||
namespace boost::openmethod::policies {
|
||||
|
||||
template<class Policy, typename Stream = detail::ostderr>
|
||||
struct basic_error_output : virtual error_output {
|
||||
@@ -21,8 +19,6 @@ struct basic_error_output : virtual error_output {
|
||||
template<class Policy, typename Stream>
|
||||
Stream basic_error_output<Policy, Stream>::error_stream;
|
||||
|
||||
} // namespace policies
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod::policies
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include <functional>
|
||||
#include <variant>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace boost::openmethod {
|
||||
|
||||
namespace detail {
|
||||
|
||||
using class_catalog = detail::static_list<detail::class_info>;
|
||||
@@ -130,7 +130,6 @@ struct basic_policy : abstract_policy, domain<Policy>, Facets... {
|
||||
|
||||
} // namespace policies
|
||||
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace policies {
|
||||
namespace boost::openmethod::policies {
|
||||
|
||||
template<class Policy, typename Stream = detail::ostderr>
|
||||
struct basic_trace_output : virtual trace_output {
|
||||
@@ -34,9 +32,7 @@ bool basic_trace_output<Policy, Stream>::trace_enabled([]() {
|
||||
return env && *env++ == '1' && *env++ == 0;
|
||||
}());
|
||||
|
||||
} // namespace policies
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod::policies
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
|
||||
#include <random>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace boost::openmethod {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -187,7 +186,6 @@ template<class Policy>
|
||||
std::size_t fast_perfect_hash<Policy>::hash_max;
|
||||
|
||||
} // namespace policies
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
|
||||
#include <boost/openmethod/policies/basic_policy.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace policies {
|
||||
namespace boost::openmethod::policies {
|
||||
|
||||
struct minimal_rtti : virtual rtti {
|
||||
template<class Class>
|
||||
@@ -23,8 +21,6 @@ struct minimal_rtti : virtual rtti {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace policies
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod::policies
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
#include <boost/core/demangle.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace policies {
|
||||
namespace boost::openmethod::policies {
|
||||
|
||||
struct std_rtti : virtual rtti {
|
||||
#ifndef BOOST_NO_RTTI
|
||||
@@ -52,8 +50,6 @@ struct std_rtti : virtual rtti {
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace policies
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod::policies
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
#include <functional>
|
||||
#include <variant>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace policies {
|
||||
namespace boost::openmethod::policies {
|
||||
|
||||
template<class Policy>
|
||||
class vectored_error_handler : public error_handler {
|
||||
@@ -83,8 +81,6 @@ typename vectored_error_handler<Policy>::function_type
|
||||
vectored_error_handler<Policy>::fn =
|
||||
vectored_error_handler<Policy>::default_handler;
|
||||
|
||||
} // namespace policies
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod::policies
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace policies {
|
||||
namespace boost::openmethod::policies {
|
||||
|
||||
template<
|
||||
class Policy, class Facet = void,
|
||||
@@ -84,8 +82,6 @@ class vptr_map : public extern_vptr,
|
||||
template<class Policy, typename UseIndirectVptrs, class Map>
|
||||
Map vptr_map<Policy, UseIndirectVptrs, Map>::vptrs;
|
||||
|
||||
} // namespace policies
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod::policies
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace policies {
|
||||
namespace boost::openmethod::policies {
|
||||
|
||||
template<class Policy, typename Facet = void>
|
||||
class vptr_vector : public extern_vptr,
|
||||
@@ -95,8 +93,6 @@ template<class Policy, typename UseIndirectVptrs>
|
||||
std::vector<typename vptr_vector<Policy, UseIndirectVptrs>::element_type>
|
||||
vptr_vector<Policy, UseIndirectVptrs>::vptrs;
|
||||
|
||||
} // namespace policies
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod::policies
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
#include <boost/openmethod/core.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace boost::openmethod {
|
||||
namespace detail {
|
||||
|
||||
template<typename Class>
|
||||
@@ -125,7 +124,6 @@ inline auto make_shared_virtual(T&&... args)
|
||||
std::make_shared<Class>(std::forward<T>(args)...));
|
||||
}
|
||||
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace boost::openmethod {
|
||||
|
||||
template<class Class, class Policy>
|
||||
struct virtual_traits<std::unique_ptr<Class>, Policy> {
|
||||
@@ -47,7 +46,6 @@ inline auto make_unique_virtual(T&&... args)
|
||||
std::make_unique<Class>(std::forward<T>(args)...));
|
||||
}
|
||||
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod
|
||||
|
||||
#endif
|
||||
|
||||
@@ -325,9 +325,7 @@ namespace test_static_slots {
|
||||
struct Animal;
|
||||
}
|
||||
|
||||
namespace boost {
|
||||
namespace openmethod {
|
||||
namespace detail {
|
||||
namespace boost::openmethod::detail {
|
||||
|
||||
template<>
|
||||
struct static_offsets<method<
|
||||
@@ -338,9 +336,7 @@ struct static_offsets<method<
|
||||
static constexpr std::size_t slots[] = {0, 1};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace openmethod
|
||||
} // namespace boost
|
||||
} // namespace boost::openmethod::detail
|
||||
|
||||
namespace test_static_slots {
|
||||
|
||||
|
||||
@@ -41,10 +41,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(shared_virtual_ptr_value, Policy, test_policies) {
|
||||
// construction and assignment from a plain pointer or reference is not
|
||||
// allowed
|
||||
|
||||
static_assert(
|
||||
!construct_assign_ok<shared_virtual_ptr<Dog, Policy>, Dog>);
|
||||
static_assert(
|
||||
!construct_assign_ok<shared_virtual_ptr<Dog, Policy>, Dog&&>);
|
||||
static_assert(!construct_assign_ok<shared_virtual_ptr<Dog, Policy>, Dog>);
|
||||
static_assert(!construct_assign_ok<shared_virtual_ptr<Dog, Policy>, Dog&&>);
|
||||
static_assert(
|
||||
!construct_assign_ok<shared_virtual_ptr<Dog, Policy>, const Dog&>);
|
||||
static_assert(
|
||||
|
||||
@@ -169,7 +169,6 @@ BOOST_AUTO_TEST_CASE(test_virtual_ptr_non_polymorphic) {
|
||||
|
||||
} // namespace using_non_polymorphic_classes
|
||||
|
||||
|
||||
struct Player {
|
||||
virtual ~Player() {
|
||||
}
|
||||
|
||||
@@ -239,10 +239,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(plain_virtual_ptr_value, Policy, test_policies) {
|
||||
BOOST_TEST(p.vptr() == nullptr);
|
||||
}
|
||||
|
||||
static_assert(
|
||||
!construct_assign_ok<virtual_ptr<Dog, Policy>, const Dog&>);
|
||||
static_assert(
|
||||
!construct_assign_ok<virtual_ptr<Dog, Policy>, const Dog*>);
|
||||
static_assert(!construct_assign_ok<virtual_ptr<Dog, Policy>, const Dog&>);
|
||||
static_assert(!construct_assign_ok<virtual_ptr<Dog, Policy>, const Dog*>);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE_TEMPLATE(indirect_virtual_ptr, Policy, test_policies) {
|
||||
|
||||
@@ -77,8 +77,8 @@ struct check_illegal_smart_ops {
|
||||
static_assert(!std::is_constructible_v<
|
||||
virtual_ptr<smart_ptr<Animal>, Policy>, Animal*>);
|
||||
|
||||
static_assert(
|
||||
!std::is_constructible_v<smart_ptr<Animal>, const other_smart_ptr<Animal>&>);
|
||||
static_assert(!std::is_constructible_v<
|
||||
smart_ptr<Animal>, const other_smart_ptr<Animal>&>);
|
||||
// smart_ptr<Animal> p{other_smart_ptr<Animal>()};
|
||||
|
||||
static_assert(!std::is_constructible_v<
|
||||
|
||||
Reference in New Issue
Block a user