mirror of
https://github.com/boostorg/conversion.git
synced 2025-08-02 14:04:28 +02:00
Prefer "using" over "typedef"
This commit is contained in:
@@ -150,10 +150,10 @@ This includes C++ built-in pointers, `std::shared_ptr`,
|
|||||||
class Banana : public Fruit {};
|
class Banana : public Fruit {};
|
||||||
|
|
||||||
// Use one of these:
|
// Use one of these:
|
||||||
typedef Fruit* FruitPtr;
|
using FruitPtr = Fruit*;
|
||||||
typedef std::shared_ptr<Fruit> FruitPtr;
|
using FruitPtr = std::shared_ptr<Fruit>;
|
||||||
typedef boost::shared_ptr<Fruit> FruitPtr;
|
using FruitPtr = boost::shared_ptr<Fruit>;
|
||||||
typedef boost::intrusive_ptr<Fruit> FruitPtr;
|
using FruitPtr = boost::intrusive_ptr<Fruit>;
|
||||||
|
|
||||||
void f(FruitPtr fruit) {
|
void f(FruitPtr fruit) {
|
||||||
// ... logic which leads us to believe it is a banana
|
// ... logic which leads us to believe it is a banana
|
||||||
|
@@ -17,7 +17,7 @@ namespace detail {
|
|||||||
|
|
||||||
template<class T> struct icast_identity
|
template<class T> struct icast_identity
|
||||||
{
|
{
|
||||||
typedef T type;
|
using type = T;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
@@ -113,7 +113,7 @@ namespace boost
|
|||||||
std::is_reference<Target>::value, Target
|
std::is_reference<Target>::value, Target
|
||||||
>::type polymorphic_downcast(Source& x)
|
>::type polymorphic_downcast(Source& x)
|
||||||
{
|
{
|
||||||
typedef typename std::remove_reference<Target>::type* target_pointer_type;
|
using target_pointer_type = typename std::remove_reference<Target>::type*;
|
||||||
return *boost::polymorphic_downcast<target_pointer_type>(
|
return *boost::polymorphic_downcast<target_pointer_type>(
|
||||||
std::addressof(x)
|
std::addressof(x)
|
||||||
);
|
);
|
||||||
|
@@ -18,8 +18,8 @@ struct foo
|
|||||||
operator long() const { return 0; }
|
operator long() const { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef type<long> long_type;
|
using long_type = type<long>;
|
||||||
typedef type<foo> foo_type;
|
using foo_type = type<foo>;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user