mirror of
https://github.com/boostorg/conversion.git
synced 2025-08-01 05:24:39 +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 {};
|
||||
|
||||
// Use one of these:
|
||||
typedef Fruit* FruitPtr;
|
||||
typedef std::shared_ptr<Fruit> FruitPtr;
|
||||
typedef boost::shared_ptr<Fruit> FruitPtr;
|
||||
typedef boost::intrusive_ptr<Fruit> FruitPtr;
|
||||
using FruitPtr = Fruit*;
|
||||
using FruitPtr = std::shared_ptr<Fruit>;
|
||||
using FruitPtr = boost::shared_ptr<Fruit>;
|
||||
using FruitPtr = boost::intrusive_ptr<Fruit>;
|
||||
|
||||
void f(FruitPtr fruit) {
|
||||
// ... logic which leads us to believe it is a banana
|
||||
|
@@ -17,7 +17,7 @@ namespace detail {
|
||||
|
||||
template<class T> struct icast_identity
|
||||
{
|
||||
typedef T type;
|
||||
using type = T;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
@@ -113,7 +113,7 @@ namespace boost
|
||||
std::is_reference<Target>::value, Target
|
||||
>::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>(
|
||||
std::addressof(x)
|
||||
);
|
||||
|
@@ -18,8 +18,8 @@ struct foo
|
||||
operator long() const { return 0; }
|
||||
};
|
||||
|
||||
typedef type<long> long_type;
|
||||
typedef type<foo> foo_type;
|
||||
using long_type = type<long>;
|
||||
using foo_type = type<foo>;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
Reference in New Issue
Block a user