Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make static_vector<T,N> trivially relocatable when T is trivially relocatable #263

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ doxygen autodoc
\"BOOST_COPY_ASSIGN_REF(T)=const T &\" \\
\"BOOST_FWD_REF(a)=a &&\" \\
\"BOOST_CONTAINER_ATTRIBUTE_NODISCARD=[[nodiscard]] \" \\
\"BOOST_CONTAINER_ATTRIBUTE_TRIVIALLY_RELOCATABLE_IF=\" \\
\"BOOST_NORETURN=[[noreturn]] \" \\
\"BOOST_INTRUSIVE_OPTION_CONSTANT(OPTION_NAME, TYPE, VALUE, CONSTANT_NAME) = template<TYPE VALUE> struct OPTION_NAME{};\" \\
\"BOOST_INTRUSIVE_OPTION_TYPE(OPTION_NAME, TYPE, TYPEDEF_EXPR, TYPEDEF_NAME) = template<class TYPE> struct OPTION_NAME{};\" \\
Expand Down
8 changes: 8 additions & 0 deletions include/boost/container/detail/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ using ::boost::move_detail::natN;
using ::boost::move_detail::max_align_t;
using ::boost::move_detail::is_convertible;

// TODO: Move this trait into <boost/move/detail/type_traits.hpp>

#if __cpp_lib_trivially_relocatable
using ::std::is_trivially_relocatable;
#else
template <class T> struct is_trivially_relocatable : std::is_trivially_copyable<T> {};
#endif

} //namespace dtl {
} //namespace container {
} //namespace boost {
Expand Down
2 changes: 1 addition & 1 deletion include/boost/container/static_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ struct get_static_vector_allocator
//!@tparam Options A type produced from \c boost::container::static_vector_options. If no option
//! is specified, by default throw_on_overflow<true> option is set.
template <typename T, std::size_t Capacity, class Options BOOST_CONTAINER_DOCONLY(= void) >
class static_vector
class BOOST_CONTAINER_ATTRIBUTE_TRIVIALLY_RELOCATABLE_IF(dtl::is_trivially_relocatable<T>::value) static_vector
: public vector<T, typename dtl::get_static_vector_allocator< T, Capacity, Options>::type>
{
public:
Expand Down