Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Reference

Header <boost/move/adl_move_swap.hpp>
Header <boost/move/algo/adaptive_merge.hpp>
Header <boost/move/algo/adaptive_sort.hpp>
Header <boost/move/algo/predicate.hpp>
Header <boost/move/algo/unique.hpp>
Header <boost/move/algorithm.hpp>
Header <boost/move/core.hpp>
Header <boost/move/default_delete.hpp>
Header <boost/move/iterator.hpp>
Header <boost/move/make_unique.hpp>
Header <boost/move/move.hpp>
Header <boost/move/algo/move.hpp>
Header <boost/move/traits.hpp>
Header <boost/move/unique_ptr.hpp>
Header <boost/move/utility.hpp>
Header <boost/move/utility_core.hpp>
namespace boost {
  template<typename T> void adl_move_swap(T &, T &);
  template<typename ForwardIt1, typename ForwardIt2> 
    ForwardIt2 adl_move_swap_ranges(ForwardIt1, ForwardIt1, ForwardIt2);
  template<typename BidirIt1, typename BidirIt2> 
    BidirIt2 adl_move_swap_ranges_backward(BidirIt1 first1, BidirIt1 last1, 
                                           BidirIt2 last2);
  template<typename ForwardIt1, typename ForwardIt2> 
    void adl_move_iter_swap(ForwardIt1 a, ForwardIt2 b);
}
namespace boost {
  namespace movelib {
    template<typename RandIt, typename Compare> 
      void adaptive_merge(RandIt, RandIt, RandIt, Compare, 
                          typename iterator_traits< RandIt >::value_type * = 0, 
                          std::size_t = 0);
  }
}
namespace boost {
  namespace movelib {
    template<typename RandIt, typename RandRawIt, typename Compare> 
      void adaptive_sort(RandIt, RandIt, Compare, RandRawIt, std::size_t);
    template<typename RandIt, typename Compare> 
      void adaptive_sort(RandIt first, RandIt last, Compare comp);
  }
}
namespace boost {
  namespace movelib {
    template<typename Comp> struct antistable;

    template<typename Comp> class negate;
    template<typename Comp> class inverse;
  }
}
namespace boost {
  namespace movelib {
    template<typename ForwardIterator, typename BinaryPredicate> 
      ForwardIterator 
      unique(ForwardIterator, ForwardIterator, BinaryPredicate);
  }
}
namespace boost {
  template<typename I, typename F> 
    F uninitialized_copy_or_move(I f, I l, F r, unspecified = 0);
  template<typename I, typename F> 
    F copy_or_move(I f, I l, F r, unspecified = 0);
  template<typename I, typename F> F uninitialized_copy_or_move(I, I, F);
  template<typename I, typename F> F copy_or_move(I, I, F);
}

This header implements macros to define movable classes and move-aware functions


BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)
BOOST_COPYABLE_AND_MOVABLE(TYPE)
BOOST_RV_REF(TYPE)
BOOST_RV_REF_BEG
BOOST_RV_REF_END
BOOST_RV_REF_BEG_IF_CXX11
BOOST_RV_REF_END_IF_CXX11
BOOST_COPY_ASSIGN_REF(TYPE)
BOOST_FWD_REF(TYPE)
BOOST_MOVE_RET(RET_TYPE, REF)
BOOST_MOVE_BASE(BASE_TYPE, ARG)
namespace boost {
  template<typename T> struct has_move_emulation_enabled;
  template<typename T> struct has_move_emulation_disabled;
}

Describes the default deleter (destruction policy) of unique_ptr: default_delete.

namespace boost {
  namespace movelib {
    template<typename T> struct default_delete;
  }
}
namespace boost {
  template<typename It> class move_iterator;
  template<typename C> class back_move_insert_iterator;
  template<typename C> class front_move_insert_iterator;
  template<typename C> class move_insert_iterator;
  template<typename It> move_iterator< It > make_move_iterator(const It &);
  template<typename C> back_move_insert_iterator< C > back_move_inserter(C &);
  template<typename C> 
    front_move_insert_iterator< C > front_move_inserter(C &);
  template<typename C> 
    move_insert_iterator< C > move_inserter(C &, typename C::iterator);
}

Defines "make_unique" functions, which are factories to create instances of unique_ptr depending on the passed arguments.

This header can be a bit heavyweight in C++03 compilers due to the use of the preprocessor library, that's why it's a a separate header from unique_ptr.hpp

namespace boost {
  namespace movelib {
    template<typename T, class... Args> 
      unique_ptr< T > make_unique(Args &&...);
    template<typename T, class... Args> 
      unique_ptr< T > make_unique_nothrow(Args &&...);
    template<typename T> unique_ptr< T > make_unique_definit();
    template<typename T> unique_ptr< T > make_unique_nothrow_definit();
    template<typename T> unique_ptr< T > make_unique(std::size_t);
    template<typename T> unique_ptr< T > make_unique_nothrow(std::size_t);
    template<typename T> unique_ptr< T > make_unique_definit(std::size_t);
    template<typename T> 
      unique_ptr< T > make_unique_nothrow_definit(std::size_t);
    template<typename T, class... Args> unspecified make_unique(Args &&);
    template<typename T, class... Args> 
      unspecified make_unique_definit(Args &&);
    template<typename T, class... Args> 
      unspecified make_unique_nothrow(Args &&);
    template<typename T, class... Args> 
      unspecified make_unique_nothrow_definit(Args &&);
  }
}

A general library header that includes the rest of top-level headers.

namespace boost {
  template<typename I, typename O> O move(I, I, O);
  template<typename I, typename O> O move_backward(I, I, O);
  template<typename I, typename F> F uninitialized_move(I, I, F);
}
namespace boost {
  template<typename T> struct has_trivial_destructor_after_move;
  template<typename T> struct has_nothrow_move;
}

Describes the smart pointer unique_ptr, a drop-in replacement for std::unique_ptr, usable also from C++03 compilers.

Main differences from std::unique_ptr to avoid heavy dependencies, specially in C++03 compilers:

  • operator < uses pointer operator < instead of std::less<common_type>. This avoids dependencies on std::common_type and std::less (<type_traits>/<functional> headers). In C++03 this avoid pulling Boost.Typeof and other cascading dependencies. As in all Boost platforms operator < on raw pointers and other smart pointers provides strict weak ordering in practice this should not be a problem for users.

  • assignable from literal 0 for compilers without nullptr

  • unique_ptr<T[]> is constructible and assignable from unique_ptr<U[]> if cv-less T and cv-less U are the same type and T is more CV qualified than U.

namespace boost {
  namespace movelib {
    template<typename T, typename D = default_delete<T> > class unique_ptr;
    template<typename T, typename D> 
      void swap(unique_ptr< T, D > &, unique_ptr< T, D > &);
    template<typename T1, typename D1, typename T2, typename D2> 
      bool operator==(const unique_ptr< T1, D1 > &, 
                      const unique_ptr< T2, D2 > &);
    template<typename T1, typename D1, typename T2, typename D2> 
      bool operator!=(const unique_ptr< T1, D1 > &, 
                      const unique_ptr< T2, D2 > &);
    template<typename T1, typename D1, typename T2, typename D2> 
      bool operator<(const unique_ptr< T1, D1 > &, 
                     const unique_ptr< T2, D2 > &);
    template<typename T1, typename D1, typename T2, typename D2> 
      bool operator<=(const unique_ptr< T1, D1 > &, 
                      const unique_ptr< T2, D2 > &);
    template<typename T1, typename D1, typename T2, typename D2> 
      bool operator>(const unique_ptr< T1, D1 > &, 
                     const unique_ptr< T2, D2 > &);
    template<typename T1, typename D1, typename T2, typename D2> 
      bool operator>=(const unique_ptr< T1, D1 > &, 
                      const unique_ptr< T2, D2 > &);
    template<typename T, typename D> 
      bool operator==(const unique_ptr< T, D > &, std::nullptr_t);
    template<typename T, typename D> 
      bool operator==(std::nullptr_t, const unique_ptr< T, D > &);
    template<typename T, typename D> 
      bool operator!=(const unique_ptr< T, D > &, std::nullptr_t);
    template<typename T, typename D> 
      bool operator!=(std::nullptr_t, const unique_ptr< T, D > &);
    template<typename T, typename D> 
      bool operator<(const unique_ptr< T, D > &, std::nullptr_t);
    template<typename T, typename D> 
      bool operator<(std::nullptr_t, const unique_ptr< T, D > &);
    template<typename T, typename D> 
      bool operator>(const unique_ptr< T, D > &, std::nullptr_t);
    template<typename T, typename D> 
      bool operator>(std::nullptr_t, const unique_ptr< T, D > &);
    template<typename T, typename D> 
      bool operator<=(const unique_ptr< T, D > &, std::nullptr_t);
    template<typename T, typename D> 
      bool operator<=(std::nullptr_t, const unique_ptr< T, D > &);
    template<typename T, typename D> 
      bool operator>=(const unique_ptr< T, D > &, std::nullptr_t);
    template<typename T, typename D> 
      bool operator>=(std::nullptr_t, const unique_ptr< T, D > &);
  }
}

This header includes core utilities from <boost/move/utility_core.hpp> and defines some more advanced utilities such as:

namespace boost {
  template<typename T> 
    rvalue_reference_or_const_lvalue_reference 
    move_if_noexcept(input_reference);
}

This header defines core utilities to ease the development of move-aware functions. This header minimizes dependencies from other libraries.

namespace boost {
  template<typename T> struct enable_move_utility_emulation;
  template<typename T> rvalue_reference move(input_reference);
  template<typename T> output_reference forward(input_reference);
  template<typename T> 
    output_reference move_if_not_lvalue_reference(input_reference);
}

PrevUpHomeNext