summaryrefslogtreecommitdiff
path: root/boost/fiber/future/promise.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/fiber/future/promise.hpp')
-rw-r--r--boost/fiber/future/promise.hpp69
1 files changed, 35 insertions, 34 deletions
diff --git a/boost/fiber/future/promise.hpp b/boost/fiber/future/promise.hpp
index 278c839700..83ba63fb23 100644
--- a/boost/fiber/future/promise.hpp
+++ b/boost/fiber/future/promise.hpp
@@ -25,10 +25,10 @@ namespace detail {
template< typename R >
struct promise_base {
- typedef typename shared_state< R >::ptr_t ptr_t;
+ typedef typename shared_state< R >::ptr_type ptr_type;
bool obtained_{ false };
- ptr_t future_{};
+ ptr_type future_{};
promise_base() :
promise_base{ std::allocator_arg, std::allocator< promise_base >{} } {
@@ -36,15 +36,15 @@ struct promise_base {
template< typename Allocator >
promise_base( std::allocator_arg_t, Allocator alloc) {
- typedef detail::shared_state_object< R, Allocator > object_t;
- typedef std::allocator_traits< typename object_t::allocator_t > traits_t;
- typename object_t::allocator_t a{ alloc };
- typename traits_t::pointer ptr{ traits_t::allocate( a, 1) };
+ typedef detail::shared_state_object< R, Allocator > object_type;
+ typedef std::allocator_traits< typename object_type::allocator_type > traits_type;
+ typename object_type::allocator_type a{ alloc };
+ typename traits_type::pointer ptr{ traits_type::allocate( a, 1) };
try {
- traits_t::construct( a, ptr, a);
+ traits_type::construct( a, ptr, a);
} catch (...) {
- traits_t::deallocate( a, ptr, 1);
+ traits_type::deallocate( a, ptr, 1);
throw;
}
future_.reset( convert( ptr) );
@@ -66,9 +66,10 @@ struct promise_base {
}
promise_base & operator=( promise_base && other) noexcept {
- if ( this == & other) return * this;
- promise_base tmp{ std::move( other) };
- swap( tmp);
+ if ( this != & other) {
+ promise_base tmp{ std::move( other) };
+ swap( tmp);
+ }
return * this;
}
@@ -101,14 +102,14 @@ struct promise_base {
template< typename R >
class promise : private detail::promise_base< R > {
private:
- typedef detail::promise_base< R > base_t;
+ typedef detail::promise_base< R > base_type;
public:
promise() = default;
template< typename Allocator >
promise( std::allocator_arg_t, Allocator alloc) :
- base_t{ std::allocator_arg, alloc } {
+ base_type{ std::allocator_arg, alloc } {
}
promise( promise const&) = delete;
@@ -118,38 +119,38 @@ public:
promise & operator=( promise && other) = default;
void set_value( R const& value) {
- if ( ! base_t::future_) {
+ if ( ! base_type::future_) {
throw promise_uninitialized{};
}
- base_t::future_->set_value( value);
+ base_type::future_->set_value( value);
}
void set_value( R && value) {
- if ( ! base_t::future_) {
+ if ( ! base_type::future_) {
throw promise_uninitialized{};
}
- base_t::future_->set_value( std::move( value) );
+ base_type::future_->set_value( std::move( value) );
}
void swap( promise & other) noexcept {
- base_t::swap( other);
+ base_type::swap( other);
}
- using base_t::get_future;
- using base_t::set_exception;
+ using base_type::get_future;
+ using base_type::set_exception;
};
template< typename R >
class promise< R & > : private detail::promise_base< R & > {
private:
- typedef detail::promise_base< R & > base_t;
+ typedef detail::promise_base< R & > base_type;
public:
promise() = default;
template< typename Allocator >
promise( std::allocator_arg_t, Allocator alloc) :
- base_t{ std::allocator_arg, alloc } {
+ base_type{ std::allocator_arg, alloc } {
}
promise( promise const&) = delete;
@@ -159,31 +160,31 @@ public:
promise & operator=( promise && other) noexcept = default;
void set_value( R & value) {
- if ( ! base_t::future_) {
+ if ( ! base_type::future_) {
throw promise_uninitialized{};
}
- base_t::future_->set_value( value);
+ base_type::future_->set_value( value);
}
void swap( promise & other) noexcept {
- base_t::swap( other);
+ base_type::swap( other);
}
- using base_t::get_future;
- using base_t::set_exception;
+ using base_type::get_future;
+ using base_type::set_exception;
};
template<>
class promise< void > : private detail::promise_base< void > {
private:
- typedef detail::promise_base< void > base_t;
+ typedef detail::promise_base< void > base_type;
public:
promise() = default;
template< typename Allocator >
promise( std::allocator_arg_t, Allocator alloc) :
- base_t{ std::allocator_arg, alloc } {
+ base_type{ std::allocator_arg, alloc } {
}
promise( promise const&) = delete;
@@ -194,19 +195,19 @@ public:
inline
void set_value() {
- if ( ! base_t::future_) {
+ if ( ! base_type::future_) {
throw promise_uninitialized{};
}
- base_t::future_->set_value();
+ base_type::future_->set_value();
}
inline
void swap( promise & other) noexcept {
- base_t::swap( other);
+ base_type::swap( other);
}
- using base_t::get_future;
- using base_t::set_exception;
+ using base_type::get_future;
+ using base_type::set_exception;
};
template< typename R >