Add new documentation macros and tested in vector.

This commit is contained in:
Ion Gaztañaga
2014-09-20 17:28:41 +02:00
parent 3025cc41b6
commit d2bd31e4d0
3 changed files with 39 additions and 26 deletions

View File

@@ -37,7 +37,11 @@ doxygen autodoc
\"BOOST_COPY_ASSIGN_REF(T)=const T &\" \\ \"BOOST_COPY_ASSIGN_REF(T)=const T &\" \\
\"BOOST_FWD_REF(a)=a &&\" \\ \"BOOST_FWD_REF(a)=a &&\" \\
\"BOOST_INTRUSIVE_OPTION_CONSTANT(OPTION_NAME, TYPE, VALUE, CONSTANT_NAME) = template<TYPE VALUE> struct OPTION_NAME{};\" \\ \"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{};\" " \"BOOST_INTRUSIVE_OPTION_TYPE(OPTION_NAME, TYPE, TYPEDEF_EXPR, TYPEDEF_NAME) = template<class TYPE> struct OPTION_NAME{};\"
\"BOOST_CONTAINER_DOC1ST(T1, T2)=T1\" \\
\"BOOST_CONTAINER_DOCIGN(T) \"\\
\"BOOST_CONTAINER_DOCONLY(T) T\"\\
"
<xsl:param>"boost.doxygen.reftitle=Boost.Container Header Reference" <xsl:param>"boost.doxygen.reftitle=Boost.Container Header Reference"
; ;

View File

@@ -58,6 +58,11 @@
#define BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL #define BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL
#endif #endif
#define BOOST_CONTAINER_DOC1ST(TYPE1, TYPE2) TYPE2
#define BOOST_CONTAINER_I ,
#define BOOST_CONTAINER_DOCIGN(T) T
#define BOOST_CONTAINER_DOCONLY(T)
#include <boost/container/detail/config_end.hpp> #include <boost/container/detail/config_end.hpp>
#endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP #endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP

View File

@@ -294,6 +294,9 @@ struct vector_alloc_holder
{ {
if(initial_size){ if(initial_size){
m_start = this->allocation_command(allocate_new, initial_size, initial_size, m_capacity, m_start).first; m_start = this->allocation_command(allocate_new, initial_size, initial_size, m_capacity, m_start).first;
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
++this->num_alloc;
#endif
} }
} }
@@ -307,6 +310,9 @@ struct vector_alloc_holder
if(initial_size){ if(initial_size){
m_start = this->allocation_command m_start = this->allocation_command
(allocate_new, initial_size, initial_size, m_capacity, m_start).first; (allocate_new, initial_size, initial_size, m_capacity, m_start).first;
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
++this->num_alloc;
#endif
} }
} }
@@ -325,6 +331,9 @@ struct vector_alloc_holder
if(cap){ if(cap){
m_start = this->allocation_command m_start = this->allocation_command
(allocate_new, cap, cap, m_capacity, m_start).first; (allocate_new, cap, cap, m_capacity, m_start).first;
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
++this->num_alloc;
#endif
} }
} }
@@ -529,11 +538,7 @@ struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsign
//! //!
//! \tparam T The type of object that is stored in the vector //! \tparam T The type of object that is stored in the vector
//! \tparam Allocator The allocator used for all internal memory management //! \tparam Allocator The allocator used for all internal memory management
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED template <class T, class Allocator BOOST_CONTAINER_DOCONLY(= std::allocator<T>) >
template <class T, class Allocator = std::allocator<T> >
#else
template <class T, class Allocator>
#endif
class vector class vector
{ {
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -567,7 +572,7 @@ class vector
typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type; typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
typedef Allocator allocator_type; typedef Allocator allocator_type;
typedef Allocator stored_allocator_type; typedef Allocator stored_allocator_type;
#if defined BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if defined BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
typedef BOOST_CONTAINER_IMPDEF(pointer) iterator; typedef BOOST_CONTAINER_IMPDEF(pointer) iterator;
typedef BOOST_CONTAINER_IMPDEF(const_pointer) const_iterator; typedef BOOST_CONTAINER_IMPDEF(const_pointer) const_iterator;
#else #else
@@ -909,14 +914,11 @@ class vector
//! <b>Complexity</b>: Linear to n. //! <b>Complexity</b>: Linear to n.
template <class InIt> template <class InIt>
void assign(InIt first, InIt last void assign(InIt first, InIt last
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_I typename container_detail::enable_if_c
, typename container_detail::enable_if_c < !container_detail::is_convertible<InIt BOOST_CONTAINER_I size_type>::value &&
< !container_detail::is_convertible<InIt, size_type>::value &&
( container_detail::is_input_iterator<InIt>::value || ( container_detail::is_input_iterator<InIt>::value ||
container_detail::is_same<alloc_version, allocator_v0>::value ) container_detail::is_same<alloc_version BOOST_CONTAINER_I allocator_v0>::value )
>::type * = 0 >::type * = 0) )
#endif
)
{ {
//Overwrite all elements we can from [first, last) //Overwrite all elements we can from [first, last)
iterator cur = this->begin(); iterator cur = this->begin();
@@ -957,13 +959,11 @@ class vector
//! <b>Complexity</b>: Linear to n. //! <b>Complexity</b>: Linear to n.
template <class FwdIt> template <class FwdIt>
void assign(FwdIt first, FwdIt last void assign(FwdIt first, FwdIt last
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_I typename container_detail::enable_if_c
, typename container_detail::enable_if_c < !container_detail::is_convertible<FwdIt BOOST_CONTAINER_I size_type>::value &&
< !container_detail::is_convertible<FwdIt, size_type>::value &&
( !container_detail::is_input_iterator<FwdIt>::value && ( !container_detail::is_input_iterator<FwdIt>::value &&
!container_detail::is_same<alloc_version, allocator_v0>::value ) !container_detail::is_same<alloc_version BOOST_CONTAINER_I allocator_v0>::value )
>::type * = 0 >::type * = 0)
#endif
) )
{ {
//For Fwd iterators the standard only requires EmplaceConstructible and assignable from *first //For Fwd iterators the standard only requires EmplaceConstructible and assignable from *first
@@ -973,8 +973,11 @@ class vector
if(input_sz > old_capacity){ //If input range is too big, we need to reallocate if(input_sz > old_capacity){ //If input range is too big, we need to reallocate
size_type real_cap = 0; size_type real_cap = 0;
std::pair<pointer, bool> ret = std::pair<pointer, bool> ret =
this->m_holder.allocation_command(allocate_new, input_sz, input_sz, real_cap, this->m_holder.start()); this->m_holder.allocation_command(allocate_new|expand_fwd, input_sz, input_sz, real_cap, this->m_holder.start());
if(!ret.second){ //New allocation, just emplace new values if(!ret.second){ //New allocation, just emplace new values
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
++this->num_alloc;
#endif
pointer const old_p = this->m_holder.start(); pointer const old_p = this->m_holder.start();
if(old_p){ if(old_p){
this->priv_destroy_all(); this->priv_destroy_all();
@@ -987,6 +990,9 @@ class vector
return; return;
} }
else{ else{
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
++this->num_expand_fwd;
#endif
//Forward expansion, use assignment + back deletion/construction that comes later //Forward expansion, use assignment + back deletion/construction that comes later
} }
} }
@@ -1519,12 +1525,10 @@ class vector
//! <b>Complexity</b>: Linear to std::distance [first, last). //! <b>Complexity</b>: Linear to std::distance [first, last).
template <class InIt> template <class InIt>
iterator insert(const_iterator pos, InIt first, InIt last iterator insert(const_iterator pos, InIt first, InIt last
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_I typename container_detail::enable_if_c
, typename container_detail::enable_if_c < !container_detail::is_convertible<InIt BOOST_CONTAINER_I size_type>::value
< !container_detail::is_convertible<InIt, size_type>::value
&& container_detail::is_input_iterator<InIt>::value && container_detail::is_input_iterator<InIt>::value
>::type * = 0 >::type * = 0)
#endif
) )
{ {
const size_type n_pos = pos - this->cbegin(); const size_type n_pos = pos - this->cbegin();