mirror of
https://github.com/boostorg/openmethod.git
synced 2026-01-19 04:22:12 +00:00
do not alias virtual_ptr in global namespace, 'aliases' namespace
This commit is contained in:
@@ -11,8 +11,7 @@
|
||||
#include <boost/openmethod/shared_ptr.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::make_shared_virtual;
|
||||
using boost::openmethod::shared_virtual_ptr;
|
||||
using namespace boost::openmethod::aliases;
|
||||
|
||||
using std::cout;
|
||||
using std::string;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <boost/openmethod.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
struct Character {
|
||||
virtual ~Character() {
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <boost/openmethod.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
struct Node {
|
||||
virtual ~Node() {}
|
||||
};
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
#include <boost/openmethod/unique_ptr.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::unique_virtual_ptr;
|
||||
using boost::openmethod::make_unique_virtual;
|
||||
using namespace boost::openmethod::aliases;
|
||||
|
||||
struct Node {
|
||||
virtual ~Node() {}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <boost/openmethod.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
class Thing {
|
||||
public:
|
||||
virtual ~Thing() {
|
||||
|
||||
@@ -77,6 +77,8 @@ struct custom_policy : bom::registry<custom_rtti, bom::policies::vptr_vector> {
|
||||
#include <boost/openmethod.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
BOOST_OPENMETHOD(poke, (std::ostream&, virtual_ptr<Animal>), void);
|
||||
|
||||
BOOST_OPENMETHOD_OVERRIDE(
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <boost/openmethod.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
struct Animal {
|
||||
virtual ~Animal() = default;
|
||||
};
|
||||
|
||||
@@ -131,6 +131,8 @@ struct custom_policy : bom::registry<
|
||||
#include <boost/openmethod.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
BOOST_OPENMETHOD(poke, (std::ostream&, virtual_ptr<Animal>), void);
|
||||
|
||||
BOOST_OPENMETHOD_OVERRIDE(
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <string>
|
||||
#include <boost/openmethod.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
#ifdef FRIEND_ALL
|
||||
|
||||
// tag::friend_all[]
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <string>
|
||||
#include <boost/openmethod.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
#ifdef FRIEND_ALL
|
||||
|
||||
// tag::friend_all[]
|
||||
|
||||
@@ -15,7 +15,8 @@ struct Animal {
|
||||
virtual ~Animal() = default;
|
||||
};
|
||||
|
||||
BOOST_OPENMETHOD(poke, (std::ostream&, virtual_ptr<Animal>), void);
|
||||
BOOST_OPENMETHOD(
|
||||
poke, (std::ostream&, boost::openmethod::virtual_ptr<Animal>), void);
|
||||
|
||||
} // namespace animals
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "cat.hpp"
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
namespace felines {
|
||||
|
||||
BOOST_OPENMETHOD_CLASSES(animals::Animal, Cat, Cheetah);
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace canines {
|
||||
BOOST_OPENMETHOD_CLASSES(animals::Animal, Dog);
|
||||
|
||||
BOOST_OPENMETHOD_DEFINE_OVERRIDER(
|
||||
poke, (std::ostream & os, virtual_ptr<Dog> dog), void) {
|
||||
poke, (std::ostream & os, boost::openmethod::virtual_ptr<Dog> dog), void) {
|
||||
os << dog->name << " barks";
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ struct Dog : animals::Animal {
|
||||
};
|
||||
|
||||
BOOST_OPENMETHOD_DECLARE_OVERRIDER(
|
||||
poke, (std::ostream & os, virtual_ptr<Dog> dog), void);
|
||||
poke, (std::ostream & os, boost::openmethod::virtual_ptr<Dog> dog), void);
|
||||
|
||||
} // namespace canines
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "cat.hpp"
|
||||
#include "dog.hpp"
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
struct Bulldog : canines::Dog {
|
||||
using Dog::Dog;
|
||||
};
|
||||
|
||||
@@ -31,6 +31,8 @@ struct Bulldog : Dog {
|
||||
#include <iostream>
|
||||
#include <boost/openmethod.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
BOOST_OPENMETHOD(
|
||||
poke, // method name
|
||||
(std::ostream&, virtual_ptr<Animal>), // method signature
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <boost/openmethod.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct Vehicle {
|
||||
|
||||
@@ -133,6 +133,7 @@ struct Init {
|
||||
namespace openmethods {
|
||||
|
||||
using namespace nodes;
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
BOOST_OPENMETHOD_CLASSES(Node, Number, Plus, Times);
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ class Dolphin : public Animal {};
|
||||
#include <boost/openmethod.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
// Classes must be registered:
|
||||
BOOST_OPENMETHOD_CLASSES(Animal, Dog, Cat, Dolphin);
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ struct custom_registry : bom::default_registry::with<throw_if_not_implemented> {
|
||||
#include <boost/openmethod.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
BOOST_OPENMETHOD_CLASSES(Animal, Cat, Dog);
|
||||
|
||||
BOOST_OPENMETHOD(trick, (std::ostream&, virtual_ptr<Animal>), void);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <boost/openmethod.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
struct Animal {
|
||||
virtual ~Animal() = default;
|
||||
};
|
||||
|
||||
@@ -9,8 +9,4 @@
|
||||
#include <boost/openmethod/core.hpp>
|
||||
#include <boost/openmethod/macros.hpp>
|
||||
|
||||
#ifndef BOOST_OPENMETHOD_DISABLE_GLOBAL_VIRTUAL_PTR
|
||||
using boost::openmethod::virtual_ptr;
|
||||
#endif
|
||||
|
||||
#endif // BOOST_OPENMETHOD_HPP
|
||||
|
||||
@@ -1518,6 +1518,14 @@ void method<Name, auto(Parameters...)->ReturnType, 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
|
||||
|
||||
@@ -125,6 +125,11 @@ inline auto make_shared_virtual(T&&... args)
|
||||
std::make_shared<Class>(std::forward<T>(args)...));
|
||||
}
|
||||
|
||||
namespace aliases {
|
||||
using boost::openmethod::shared_virtual_ptr;
|
||||
using boost::openmethod::make_shared_virtual;
|
||||
}
|
||||
|
||||
} // namespace boost::openmethod
|
||||
|
||||
#endif
|
||||
|
||||
@@ -47,6 +47,11 @@ inline auto make_unique_virtual(T&&... args)
|
||||
std::make_unique<Class>(std::forward<T>(args)...));
|
||||
}
|
||||
|
||||
namespace aliases {
|
||||
using boost::openmethod::unique_virtual_ptr;
|
||||
using boost::openmethod::make_unique_virtual;
|
||||
}
|
||||
|
||||
} // namespace boost::openmethod
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <boost/openmethod.hpp>
|
||||
#include <boost/openmethod/compiler.hpp>
|
||||
|
||||
using boost::openmethod::virtual_ptr;
|
||||
|
||||
struct Role {
|
||||
virtual ~Role() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user