set(const set& x, const allocator_type &a) : base_t(static_cast<const base_t&>(x), a) {} //! <b>Effects</b>: Move constructs a set using the specified allocator. //! Constructs *this using x's resources. //! //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise. set(BOOST_RV_REF(set) x, const allocator_type &a) : base_t(boost::move(static_cast<base_t&>(x)), a) {} //! <b>Effects</b>: Makes *this a copy of x. //! //! <b>Complexity</b>: Linear in x.size(). set& operator=(BOOST_COPY_ASSIGN_REF(set) x) { return static_cast<set&>(this->base_t::operator=(static_cast<const base_t&>(x))); } //! <b>Effects</b>: this->swap(x.get()). //! //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment //! is false and (allocation throws or value_type's move constructor throws) //! //! <b>Complexity</b>: Constant if allocator_traits_type:: //! propagate_on_container_move_assignment is true or //! this->get>allocator() == x.get_allocator(). Linear otherwise. set& operator=(BOOST_RV_REF(set) x) BOOST_CONTAINER_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value) { return static_cast<set&>(this->base_t::operator=(boost::move(static_cast<base_t&>(x)))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
explicit copyable_and_movable (void) { std::cout << "copyable_and_movable default constructor\n"; }; explicit copyable_and_movable (int) { std::cout << "copyable_and_movable int constructor\n"; } copyable_and_movable(const copyable_and_movable &rhs) { std::cout << "copyable_and_movable copy constructor\n"; } copyable_and_movable& operator=(BOOST_COPY_ASSIGN_REF(copyable_and_movable) rhs) { std::cout << "copyable_and_movable operator=(BOOST_COPY_ASSIGN_REF(copyable_and_movable)\n"; return *this; } // Move constructor copyable_and_movable (BOOST_RV_REF(copyable_and_movable) rhs) { std::cout << "copyable_and_movable move constructor\n"; } // Move assign operator copyable_and_movable& operator=(BOOST_RV_REF(copyable_and_movable) rhs) { std::cout << "copyable_and_movable move assing operator\n";
/* makes this class able to emulate a r-value reference */ BOOST_COPYABLE_AND_MOVABLE(CartBuffer) public: HDINLINE CartBuffer(const math::Size_t<T_dim>& size); HDINLINE CartBuffer(size_t x); HDINLINE CartBuffer(size_t x, size_t y); HDINLINE CartBuffer(size_t x, size_t y, size_t z); /* the copy constructor just increments the reference counter but does not copy memory */ HDINLINE CartBuffer(const CartBuffer& other); /* the move constructor */ HDINLINE CartBuffer(BOOST_RV_REF(CartBuffer) other); HDINLINE ~CartBuffer(); /* copy another container into this one (hard data copy) */ HDINLINE CartBuffer& operator=(BOOST_COPY_ASSIGN_REF(CartBuffer) rhs); /* use the memory from another container and increment the reference counter */ HDINLINE CartBuffer& operator=(BOOST_RV_REF(CartBuffer) rhs); /* get a view. Views represent a clipped area of the container. * \param a Top left corner of the view, inside the view. * Negative values are remapped, e.g. Int<2>(-1,-2) == Int<2>(width-1, height-2) * \param b Bottom right corner of the view, outside the view. * Values are remapped, so that Int<2>(0,0) == Int<2>(width, height) */ HDINLINE View<CartBuffer> view(math::Int<T_dim> a = math::Int<T_dim>(0), math::Int<T_dim> b = math::Int<T_dim>(0)) const; /* get a cursor at the container's origin cell */
//! <b>Effects</b>: Initializes m_alloc with //! a2. explicit resource_adaptor_imp(const Allocator& a2) : ebo_alloc_t(a2) { this->static_assert_if_not_char_allocator(); } //! <b>Effects</b>: Initializes m_alloc with //! a2. explicit resource_adaptor_imp(BOOST_RV_REF(Allocator) a2) : ebo_alloc_t(::boost::move(a2)) { this->static_assert_if_not_char_allocator(); } //! <b>Effects</b>: Copy assigns //! m_alloc. resource_adaptor_imp& operator=(BOOST_COPY_ASSIGN_REF(resource_adaptor_imp) other) { this->ebo_alloc_t::get() = other.ebo_alloc_t::get(); return *this; } //! <b>Effects</b>: Move assigns //! m_alloc. resource_adaptor_imp& operator=(BOOST_RV_REF(resource_adaptor_imp) other) { this->ebo_alloc_t::get() = ::boost::move(other.ebo_alloc_t::get()); return *this; } //! <b>Effects</b>: Returns m_alloc. allocator_type &get_allocator() { return this->ebo_alloc_t::get(); } //! <b>Effects</b>: Returns m_alloc. const allocator_type &get_allocator() const { return this->ebo_alloc_t::get(); }
//std::cout << "deleting array" << std::endl; } T& operator()(std::size_t i, std::size_t j) { return data[i+j*height]; } T const & operator()(std::size_t i, std::size_t j)const { return data[i+j*height]; } Matrix(const Matrix& p) // Copy constructor (as usual) : height(p.height),width(p.width),data(p.data) { //std::cout<<"Copy constructor"<<std::endl; } Matrix& operator=(BOOST_COPY_ASSIGN_REF(Matrix) p) // Copy assignment { if (this != &p){ height = p.height; width = p.width; data = p.data; } //std::cout<<"Copy assignment"<<std::endl; return *this; } //Move semantics... Matrix(BOOST_RV_REF(Matrix) p) //Move constructor { height = p.height; width = p.width;
#else #define BOOST_PP_LOCAL_MACRO(n) \ template<class U, BOOST_PP_ENUM_PARAMS(n, class P)> \ pair(BOOST_CONTAINER_PP_PARAM(U, u) \ ,BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ : first(::lslboost::forward<U>(u)) \ , second(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \ {} \ //! #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) #include BOOST_PP_LOCAL_ITERATE() #endif */ //pair copy assignment pair& operator=(BOOST_COPY_ASSIGN_REF(pair) p) { first = p.first; second = p.second; return *this; } //pair move assignment pair& operator=(BOOST_RV_REF(pair) p) { first = ::lslboost::move(p.first); second = ::lslboost::move(p.second); return *this; } template <class D, class S>
record_view m_record; enqueued_record(enqueued_record const& that) : m_timestamp(that.m_timestamp), m_record(that.m_record) { } enqueued_record(BOOST_RV_REF(enqueued_record) that) : m_timestamp(that.m_timestamp), m_record(boost::move(that.m_record)) { } explicit enqueued_record(record_view const& rec) : m_timestamp(boost::log::aux::get_timestamp()), m_record(rec) { } enqueued_record& operator= (BOOST_COPY_ASSIGN_REF(enqueued_record) that) { m_timestamp = that.m_timestamp; m_record = that.m_record; return *this; } enqueued_record& operator= (BOOST_RV_REF(enqueued_record) that) { m_timestamp = that.m_timestamp; m_record = boost::move(that.m_record); return *this; } }; typedef std::priority_queue< enqueued_record,
//! //! @par Complexity //! Linear O(N). template <std::size_t C> varray(varray<value_type, C> const& other) : base_t(other) {} //! @brief Copy assigns Values stored in the other varray to this one. //! //! @param other The varray which content will be copied to this one. //! //! @par Throws //! If Value's copy constructor or copy assignment throws. //! //! @par Complexity //! Linear O(N). varray & operator=(BOOST_COPY_ASSIGN_REF(varray) other) { base_t::operator=(static_cast<base_t const&>(other)); return *this; } //! @pre <tt>other.size() <= capacity()</tt> //! //! @brief Copy assigns Values stored in the other varray to this one. //! //! @param other The varray which content will be copied to this one. //! //! @par Throws //! If Value's copy constructor or copy assignment throws. //! //! @par Complexity
#endif json_string() {} json_string(json_string const& rhs) : rep_t(rhs) { LOG("json_string copy"); } template <class Iterator> json_string(Iterator begin, Iterator end) : rep_t(begin, end) { } json_string& operator=(BOOST_COPY_ASSIGN_REF(json_string) rhs) // Copy assignment { LOG("json_string copy assign"); rep_t::operator=(rhs); return *this; } // Move constructor json_string(BOOST_RV_REF(json_string) rhs) //Move constructor : rep_t(boost::move(rhs)) { LOG("json_string move"); } json_string& operator=(BOOST_RV_REF(json_string) rhs) //Move assignment {
// move constructor protected_bind(BOOST_RV_REF(protected_bind) other) : f_(boost::move(other.f_)) { } explicit protected_bind(F const & f) : f_(f) {} explicit protected_bind(BOOST_RV_REF(F) f) : f_(boost::move(f)) {} protected_bind& operator=(BOOST_COPY_ASSIGN_REF(protected_bind) rhs) { if (this != &rhs) f_ = rhs.f_; return *this; } protected_bind& operator=(BOOST_RV_REF(protected_bind) rhs) { if (this != &rhs) f_ = boost::move(rhs.f_); return *this; } template <typename This> struct result<This()>
*p = t; } template <typename Archive> void serialize(Archive &, unsigned) {} }; template <typename T, typename A0> struct ctor_fun<T, A0> { typedef void result_type; ctor_fun() {} template <typename Arg0> ctor_fun(BOOST_FWD_REF(Arg0) arg0) : a0(boost::forward<Arg0>(arg0)) {} ctor_fun(BOOST_COPY_ASSIGN_REF(ctor_fun) rhs) : a0(rhs. a0) {} ctor_fun(BOOST_RV_REF(ctor_fun) rhs) : a0(boost::move(rhs. a0)) {} ctor_fun& operator=(BOOST_COPY_ASSIGN_REF(ctor_fun) rhs) { if (this != &rhs) { a0 = rhs.a0; } return *this; } ctor_fun& operator=(BOOST_RV_REF(ctor_fun) rhs) { if (this != &rhs) {
, ctr_moves_(0) , assign_copies_(0) , assign_moves_(0) , swaps_(0) {} propagation_test_allocator(BOOST_RV_REF(propagation_test_allocator) x) : id_(x.id_) , ctr_copies_(x.ctr_copies_) , ctr_moves_(x.ctr_moves_ + 1) , assign_copies_(x.assign_copies_) , assign_moves_(x.assign_moves_) , swaps_(x.swaps_) {} propagation_test_allocator &operator=(BOOST_COPY_ASSIGN_REF(propagation_test_allocator) x) { id_ = x.id_; ctr_copies_ = x.ctr_copies_; ctr_moves_ = x.ctr_moves_; assign_copies_ = x.assign_copies_+1; assign_moves_ = x.assign_moves_; swaps_ = x.swaps_; return *this; } propagation_test_allocator &operator=(BOOST_RV_REF(propagation_test_allocator) x) { id_ = x.id_; ctr_copies_ = x.ctr_copies_; ctr_moves_ = x.ctr_moves_;
template<typename K, class C = std::less<const K> > class range { BOOST_COPYABLE_AND_MOVABLE(range) public: typedef C comparator_type; range(const K& min,const K& max): min_(min), max_(max) { comparator_type cmp; assert( cmp( min_ , max_ ) ); } range(BOOST_COPY_ASSIGN_REF(range) rhs): min_(rhs.min_), max_(rhs.max_) {} inline range& operator=(BOOST_COPY_ASSIGN_REF(range) rhs) { range tmp(rhs); tmp.swap(*this); return *this; } range(BOOST_RV_REF(K) min,BOOST_RV_REF(K) max) BOOST_NOEXCEPT: min_( BOOST_MOVE_BASE(K,min) ), max_( BOOST_MOVE_BASE(K,max) ) {}
load(lib_path, mode, ec); } //! \overload shared_library(const boost::filesystem::path& lib_path, boost::system::error_code& ec, load_mode::type mode = load_mode::default_mode) shared_library(const boost::filesystem::path& lib_path, load_mode::type mode, boost::system::error_code& ec) { load(lib_path, mode, ec); } /*! * Copy assign a shared_library object. If this->is_loaded() then calls this->unload(). Does not invalidate existing symbols and functions loaded from lib. * * \param lib A shared_library to copy. * \post lib == *this * \throw boost::system::system_error, std::bad_alloc in case of insufficient memory. */ shared_library& operator=(BOOST_COPY_ASSIGN_REF(shared_library) lib) { boost::system::error_code ec; assign(lib, ec); if (ec) { boost::dll::detail::report_error(ec, "boost::dll::shared_library::operator= failed"); } return *this; } /*! * Move assign a shared_library object. If this->is_loaded() then calls this->unload(). Does not invalidate existing symbols and functions loaded from lib. * * \param lib A shared_library to move from. * \post lib.is_loaded() returns false. * \throw Nothing.
struct X { X() : id(instances++) { std::cout << "X" << id << ": construct\n"; } X(X const& rhs) : id(instances++) { std::cout << "X" << id << ": <- " << "X" << rhs.id << ": **copy**\n"; ++copies; } // This particular test doesn't exercise assignment, but for // completeness: X& operator=(BOOST_COPY_ASSIGN_REF(X) rhs) { std::cout << "X" << id << ": <- " << "X" << rhs.id << ": assign\n"; return *this; } #ifndef NO_MOVE X& operator=(BOOST_RV_REF(X) rhs) { std::cout << "X" << id << ": <- " << "X" << rhs.id << ": move assign\n"; return *this; } X(BOOST_RV_REF(X) rhs) : id(instances++) { std::cout << "X" << id << ": <- " << "X" << rhs.id << ": ..move construct..\n";
, typename util::decay<Functor>::type >::type >::type * = 0 ) : base_type(boost::forward<Functor>(f)) {} function(function const & other) : base_type(static_cast<base_type const &>(other)) {} function(BOOST_RV_REF(function) other) : base_type(boost::move(static_cast<BOOST_RV_REF(base_type)>(other))) {} function& operator=(BOOST_COPY_ASSIGN_REF(function) t) { this->base_type::operator=(t); return *this; } function& operator=(BOOST_RV_REF(function) t) { this->base_type::operator=(boost::move(static_cast<BOOST_RV_REF(base_type)>(t))); return *this; } void clear() { reset(); } private: BOOST_COPYABLE_AND_MOVABLE(function)