Fixes #222 ("Fix incomplete type error when using list with pair")

This commit is contained in:
Ion Gaztañaga
2022-06-25 19:40:05 +02:00
parent 8a4620da17
commit d3ec5c677d
4 changed files with 14 additions and 7 deletions

View File

@@ -1338,6 +1338,13 @@ use [*Boost.Container]? There are several reasons for that:
[section:release_notes Release Notes] [section:release_notes Release Notes]
[section:release_notes_boost_1_80_00 Boost 1.80 Release]
* Fixed bugs/issues:
* [@https://github.com/boostorg/container/issues/222 GitHub #222: ['"Fix incomplete type error when using list with pair"]].
[endsect]
[section:release_notes_boost_1_79_00 Boost 1.79 Release] [section:release_notes_boost_1_79_00 Boost 1.79 Release]
* The library now compiles without warnings with GCC's -Wcast-align=strict * The library now compiles without warnings with GCC's -Wcast-align=strict

View File

@@ -93,7 +93,7 @@ struct hash_table_internal_data_type< std::pair<T1, T2> >
}; };
template <class T, class VoidPointer, bool StoreHash> template <class T, class VoidPointer, bool StoreHash>
struct iiterator_node_value_type< base_node<T, intrusive_hash_table_hook<VoidPointer, StoreHash> > > struct iiterator_node_value_type< base_node<T, intrusive_hash_table_hook<VoidPointer, StoreHash>, true > >
{ {
typedef T type; typedef T type;
}; };
@@ -185,7 +185,7 @@ struct intrusive_hash_table_type
typedef typename boost::container:: typedef typename boost::container::
allocator_traits<Allocator>::size_type size_type; allocator_traits<Allocator>::size_type size_type;
typedef base_node<value_type, intrusive_hash_table_hook typedef base_node<value_type, intrusive_hash_table_hook
<void_pointer, StoreHash> > node_t; <void_pointer, StoreHash>, true > node_t;
//Deducing the hook type from node_t (e.g. node_t::hook_type) would //Deducing the hook type from node_t (e.g. node_t::hook_type) would
//provoke an early instantiation of node_t that could ruin recursive //provoke an early instantiation of node_t that could ruin recursive
//hash_table definitions, so retype the complete type to avoid any problem. //hash_table definitions, so retype the complete type to avoid any problem.

View File

@@ -54,7 +54,7 @@ namespace container {
//This trait is used to type-pun std::pair because in C++03 //This trait is used to type-pun std::pair because in C++03
//compilers std::pair is useless for C++11 features //compilers std::pair is useless for C++11 features
template<class T, bool = dtl::is_pair<T>::value > template<class T, bool>
struct node_internal_data_type struct node_internal_data_type
{ {
typedef T type; typedef T type;
@@ -68,13 +68,13 @@ struct node_internal_data_type< T, true>
type; type;
}; };
template <class T, class HookDefiner> template <class T, class HookDefiner, bool PairBased = false>
struct base_node struct base_node
: public HookDefiner::type : public HookDefiner::type
{ {
public: public:
typedef T value_type; typedef T value_type;
typedef typename node_internal_data_type<T>::type internal_type; typedef typename node_internal_data_type<T, PairBased && dtl::is_pair<T>::value>::type internal_type;
typedef typename HookDefiner::type hook_type; typedef typename HookDefiner::type hook_type;
typedef typename dtl::aligned_storage<sizeof(T), dtl::alignment_of<T>::value>::type storage_t; typedef typename dtl::aligned_storage<sizeof(T), dtl::alignment_of<T>::value>::type storage_t;

View File

@@ -122,7 +122,7 @@ struct tree_internal_data_type< std::pair<T1, T2> >
}; };
template <class T, class VoidPointer, boost::container::tree_type_enum tree_type_value, bool OptimizeSize> template <class T, class VoidPointer, boost::container::tree_type_enum tree_type_value, bool OptimizeSize>
struct iiterator_node_value_type< base_node<T, intrusive_tree_hook<VoidPointer, tree_type_value, OptimizeSize> > > struct iiterator_node_value_type< base_node<T, intrusive_tree_hook<VoidPointer, tree_type_value, OptimizeSize>, true > >
{ {
typedef T type; typedef T type;
}; };
@@ -231,7 +231,7 @@ struct intrusive_tree_type
typedef typename boost::container:: typedef typename boost::container::
allocator_traits<Allocator>::void_pointer void_pointer; allocator_traits<Allocator>::void_pointer void_pointer;
typedef base_node<value_type, intrusive_tree_hook typedef base_node<value_type, intrusive_tree_hook
<void_pointer, tree_type_value, OptimizeSize> > node_t; <void_pointer, tree_type_value, OptimizeSize>, true > node_t;
//Deducing the hook type from node_t (e.g. node_t::hook_type) would //Deducing the hook type from node_t (e.g. node_t::hook_type) would
//provoke an early instantiation of node_t that could ruin recursive //provoke an early instantiation of node_t that could ruin recursive
//tree definitions, so retype the complete type to avoid any problem. //tree definitions, so retype the complete type to avoid any problem.