diff --git a/examples/accept_no_visitors.cpp b/examples/accept_no_visitors.cpp index 0f5d502..58662fe 100644 --- a/examples/accept_no_visitors.cpp +++ b/examples/accept_no_visitors.cpp @@ -11,8 +11,7 @@ #include #include -using boost::openmethod::make_shared_virtual; -using boost::openmethod::shared_virtual_ptr; +using namespace boost::openmethod::aliases; using std::cout; using std::string; diff --git a/examples/adventure.cpp b/examples/adventure.cpp index 14d52df..dc13e73 100644 --- a/examples/adventure.cpp +++ b/examples/adventure.cpp @@ -10,6 +10,8 @@ #include #include +using boost::openmethod::virtual_ptr; + struct Character { virtual ~Character() { } diff --git a/examples/ast.cpp b/examples/ast.cpp index 44ea1fb..4e26e74 100644 --- a/examples/ast.cpp +++ b/examples/ast.cpp @@ -12,6 +12,8 @@ #include #include +using boost::openmethod::virtual_ptr; + struct Node { virtual ~Node() {} }; diff --git a/examples/ast_unique_ptr.cpp b/examples/ast_unique_ptr.cpp index de79337..c9523e3 100644 --- a/examples/ast_unique_ptr.cpp +++ b/examples/ast_unique_ptr.cpp @@ -14,8 +14,7 @@ #include #include -using boost::openmethod::unique_virtual_ptr; -using boost::openmethod::make_unique_virtual; +using namespace boost::openmethod::aliases; struct Node { virtual ~Node() {} diff --git a/examples/asteroids.cpp b/examples/asteroids.cpp index 526c906..135461b 100644 --- a/examples/asteroids.cpp +++ b/examples/asteroids.cpp @@ -9,6 +9,8 @@ #include #include +using boost::openmethod::virtual_ptr; + class Thing { public: virtual ~Thing() { diff --git a/examples/custom_rtti.cpp b/examples/custom_rtti.cpp index 6e43d7f..0865d29 100644 --- a/examples/custom_rtti.cpp +++ b/examples/custom_rtti.cpp @@ -77,6 +77,8 @@ struct custom_policy : bom::registry { #include #include +using boost::openmethod::virtual_ptr; + BOOST_OPENMETHOD(poke, (std::ostream&, virtual_ptr), void); BOOST_OPENMETHOD_OVERRIDE( diff --git a/examples/default_error_handler.cpp b/examples/default_error_handler.cpp index bae2067..ab417cd 100644 --- a/examples/default_error_handler.cpp +++ b/examples/default_error_handler.cpp @@ -10,6 +10,8 @@ #include #include +using boost::openmethod::virtual_ptr; + struct Animal { virtual ~Animal() = default; }; diff --git a/examples/deferred_custom_rtti.cpp b/examples/deferred_custom_rtti.cpp index d60c330..26ccea4 100644 --- a/examples/deferred_custom_rtti.cpp +++ b/examples/deferred_custom_rtti.cpp @@ -131,6 +131,8 @@ struct custom_policy : bom::registry< #include #include +using boost::openmethod::virtual_ptr; + BOOST_OPENMETHOD(poke, (std::ostream&, virtual_ptr), void); BOOST_OPENMETHOD_OVERRIDE( diff --git a/examples/friendship.cpp b/examples/friendship.cpp index 3dfa42c..16bac3e 100644 --- a/examples/friendship.cpp +++ b/examples/friendship.cpp @@ -9,6 +9,8 @@ #include #include +using boost::openmethod::virtual_ptr; + #ifdef FRIEND_ALL // tag::friend_all[] diff --git a/examples/friendship_across_namespaces.cpp b/examples/friendship_across_namespaces.cpp index f3bc67a..65928b5 100644 --- a/examples/friendship_across_namespaces.cpp +++ b/examples/friendship_across_namespaces.cpp @@ -9,6 +9,8 @@ #include #include +using boost::openmethod::virtual_ptr; + #ifdef FRIEND_ALL // tag::friend_all[] diff --git a/examples/headers_namespaces/animal.hpp b/examples/headers_namespaces/animal.hpp index db9bad4..cd0d0b9 100644 --- a/examples/headers_namespaces/animal.hpp +++ b/examples/headers_namespaces/animal.hpp @@ -15,7 +15,8 @@ struct Animal { virtual ~Animal() = default; }; -BOOST_OPENMETHOD(poke, (std::ostream&, virtual_ptr), void); +BOOST_OPENMETHOD( + poke, (std::ostream&, boost::openmethod::virtual_ptr), void); } // namespace animals diff --git a/examples/headers_namespaces/cat.cpp b/examples/headers_namespaces/cat.cpp index 4c37106..b1a2b95 100644 --- a/examples/headers_namespaces/cat.cpp +++ b/examples/headers_namespaces/cat.cpp @@ -5,6 +5,8 @@ #include "cat.hpp" +using boost::openmethod::virtual_ptr; + namespace felines { BOOST_OPENMETHOD_CLASSES(animals::Animal, Cat, Cheetah); diff --git a/examples/headers_namespaces/dog.cpp b/examples/headers_namespaces/dog.cpp index efb111b..44a7435 100644 --- a/examples/headers_namespaces/dog.cpp +++ b/examples/headers_namespaces/dog.cpp @@ -8,7 +8,7 @@ namespace canines { BOOST_OPENMETHOD_CLASSES(animals::Animal, Dog); BOOST_OPENMETHOD_DEFINE_OVERRIDER( - poke, (std::ostream & os, virtual_ptr dog), void) { + poke, (std::ostream & os, boost::openmethod::virtual_ptr dog), void) { os << dog->name << " barks"; } diff --git a/examples/headers_namespaces/dog.hpp b/examples/headers_namespaces/dog.hpp index e679a64..604ee82 100644 --- a/examples/headers_namespaces/dog.hpp +++ b/examples/headers_namespaces/dog.hpp @@ -13,7 +13,7 @@ struct Dog : animals::Animal { }; BOOST_OPENMETHOD_DECLARE_OVERRIDER( - poke, (std::ostream & os, virtual_ptr dog), void); + poke, (std::ostream & os, boost::openmethod::virtual_ptr dog), void); } // namespace canines diff --git a/examples/headers_namespaces/main.cpp b/examples/headers_namespaces/main.cpp index 45bd1d6..9e69441 100644 --- a/examples/headers_namespaces/main.cpp +++ b/examples/headers_namespaces/main.cpp @@ -6,6 +6,8 @@ #include "cat.hpp" #include "dog.hpp" +using boost::openmethod::virtual_ptr; + struct Bulldog : canines::Dog { using Dog::Dog; }; diff --git a/examples/hello_world.cpp b/examples/hello_world.cpp index fc58a77..9beb920 100644 --- a/examples/hello_world.cpp +++ b/examples/hello_world.cpp @@ -31,6 +31,8 @@ struct Bulldog : Dog { #include #include +using boost::openmethod::virtual_ptr; + BOOST_OPENMETHOD( poke, // method name (std::ostream&, virtual_ptr), // method signature diff --git a/examples/matrix.cpp b/examples/matrix.cpp index a37244f..0c59186 100644 --- a/examples/matrix.cpp +++ b/examples/matrix.cpp @@ -16,6 +16,7 @@ using std::make_shared; using std::shared_ptr; using std::string; +using boost::openmethod::virtual_ptr; using boost::openmethod::make_shared_virtual; using boost::openmethod::shared_virtual_ptr; diff --git a/examples/next.cpp b/examples/next.cpp index bbf1d4c..81d6bdc 100644 --- a/examples/next.cpp +++ b/examples/next.cpp @@ -12,6 +12,8 @@ #include #include +using boost::openmethod::virtual_ptr; + using namespace std; struct Vehicle { diff --git a/examples/slides.cpp b/examples/slides.cpp index a50f60e..e600005 100644 --- a/examples/slides.cpp +++ b/examples/slides.cpp @@ -133,6 +133,7 @@ struct Init { namespace openmethods { using namespace nodes; +using boost::openmethod::virtual_ptr; BOOST_OPENMETHOD_CLASSES(Node, Number, Plus, Times); diff --git a/examples/synopsis.cpp b/examples/synopsis.cpp index 63117f4..c0c5d37 100644 --- a/examples/synopsis.cpp +++ b/examples/synopsis.cpp @@ -28,6 +28,8 @@ class Dolphin : public Animal {}; #include #include +using boost::openmethod::virtual_ptr; + // Classes must be registered: BOOST_OPENMETHOD_CLASSES(Animal, Dog, Cat, Dolphin); diff --git a/examples/throw_error_handler.cpp b/examples/throw_error_handler.cpp index 0de26b2..17b2f05 100644 --- a/examples/throw_error_handler.cpp +++ b/examples/throw_error_handler.cpp @@ -37,6 +37,8 @@ struct custom_registry : bom::default_registry::with { #include #include +using boost::openmethod::virtual_ptr; + BOOST_OPENMETHOD_CLASSES(Animal, Cat, Dog); BOOST_OPENMETHOD(trick, (std::ostream&, virtual_ptr), void); diff --git a/examples/virtual_ptr.cpp b/examples/virtual_ptr.cpp index 6ec783d..e16caf9 100644 --- a/examples/virtual_ptr.cpp +++ b/examples/virtual_ptr.cpp @@ -7,6 +7,8 @@ #include #include +using boost::openmethod::virtual_ptr; + struct Animal { virtual ~Animal() = default; }; diff --git a/include/boost/openmethod.hpp b/include/boost/openmethod.hpp index 54f96cd..12a2a69 100644 --- a/include/boost/openmethod.hpp +++ b/include/boost/openmethod.hpp @@ -9,8 +9,4 @@ #include #include -#ifndef BOOST_OPENMETHOD_DISABLE_GLOBAL_VIRTUAL_PTR -using boost::openmethod::virtual_ptr; -#endif - #endif // BOOST_OPENMETHOD_HPP diff --git a/include/boost/openmethod/core.hpp b/include/boost/openmethod/core.hpp index 4d7529f..b391920 100644 --- a/include/boost/openmethod/core.hpp +++ b/include/boost/openmethod/core.hpp @@ -1518,6 +1518,14 @@ void methodReturnType, Registry>::override_impl< this->vp_type_ids); } +namespace aliases { + +using boost::openmethod::final_virtual_ptr; +using boost::openmethod::virtual_; +using boost::openmethod::virtual_ptr; + +} // namespace aliases + } // namespace boost::openmethod #ifdef _MSC_VER diff --git a/include/boost/openmethod/shared_ptr.hpp b/include/boost/openmethod/shared_ptr.hpp index 4bd359a..1374315 100644 --- a/include/boost/openmethod/shared_ptr.hpp +++ b/include/boost/openmethod/shared_ptr.hpp @@ -125,6 +125,11 @@ inline auto make_shared_virtual(T&&... args) std::make_shared(std::forward(args)...)); } +namespace aliases { + using boost::openmethod::shared_virtual_ptr; + using boost::openmethod::make_shared_virtual; +} + } // namespace boost::openmethod #endif diff --git a/include/boost/openmethod/unique_ptr.hpp b/include/boost/openmethod/unique_ptr.hpp index 916bba0..2c3a7dd 100644 --- a/include/boost/openmethod/unique_ptr.hpp +++ b/include/boost/openmethod/unique_ptr.hpp @@ -47,6 +47,11 @@ inline auto make_unique_virtual(T&&... args) std::make_unique(std::forward(args)...)); } +namespace aliases { + using boost::openmethod::unique_virtual_ptr; + using boost::openmethod::make_unique_virtual; +} + } // namespace boost::openmethod #endif diff --git a/test/test_rolex.cpp b/test/test_rolex.cpp index 9b4c8ef..bccafe9 100644 --- a/test/test_rolex.cpp +++ b/test/test_rolex.cpp @@ -6,6 +6,8 @@ #include #include +using boost::openmethod::virtual_ptr; + struct Role { virtual ~Role() { }