Python C++11 hash tables compilation fixes
- std::unordered_map compilation fix when just using std_unordered_map.i standalone - std::unordered_multimap compilation fix when just using std_unordered_multimap.i standalone - Add in the standalone unordered STL test cases Closes #1319
This commit is contained in:
parent
c33f352069
commit
2f31c3e94e
4 changed files with 65 additions and 47 deletions
|
|
@ -7,6 +7,14 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.0.0 (in progress)
|
Version 4.0.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2018-08-31: wsfulton
|
||||||
|
[Python] #1319 C++11 hash tables support:
|
||||||
|
std::unordered_map
|
||||||
|
std::unordered_set
|
||||||
|
std::unordered_multimap
|
||||||
|
std::unordered_multiset
|
||||||
|
is now compiling and working (sorting using -builtin not fully functional yet though).
|
||||||
|
|
||||||
2018-08-20: wkalinin
|
2018-08-20: wkalinin
|
||||||
#1305 Fix nested structure symbol tables in C mode to fix member name conflicts
|
#1305 Fix nested structure symbol tables in C mode to fix member name conflicts
|
||||||
in different structs with the same nested struct member name.
|
in different structs with the same nested struct member name.
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,10 @@ CPP11_TEST_CASES = \
|
||||||
cpp11_shared_ptr_nullptr_in_containers \
|
cpp11_shared_ptr_nullptr_in_containers \
|
||||||
cpp11_shared_ptr_overload \
|
cpp11_shared_ptr_overload \
|
||||||
cpp11_shared_ptr_upcast \
|
cpp11_shared_ptr_upcast \
|
||||||
|
cpp11_std_unordered_map \
|
||||||
|
cpp11_std_unordered_multimap \
|
||||||
|
cpp11_std_unordered_multiset \
|
||||||
|
cpp11_std_unordered_set \
|
||||||
|
|
||||||
C_TEST_CASES += \
|
C_TEST_CASES += \
|
||||||
file_test \
|
file_test \
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,59 @@
|
||||||
/*
|
/*
|
||||||
Unordered Maps
|
Unordered Maps
|
||||||
*/
|
*/
|
||||||
|
%include <std_map.i>
|
||||||
|
|
||||||
%fragment("StdUnorderedMapTraits","header",fragment="StdSequenceTraits")
|
%fragment("StdUnorderedMapForwardIteratorTraits","header")
|
||||||
|
{
|
||||||
|
namespace swig {
|
||||||
|
template<class OutIterator, class FromOper, class ValueType = typename OutIterator::value_type>
|
||||||
|
struct SwigPyMapForwardIterator_T : SwigPyForwardIteratorClosed_T<OutIterator, ValueType, FromOper>
|
||||||
|
{
|
||||||
|
SwigPyMapForwardIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||||
|
: SwigPyForwardIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class OutIterator,
|
||||||
|
class FromOper = from_key_oper<typename OutIterator::value_type> >
|
||||||
|
struct SwigPyMapKeyForwardIterator_T : SwigPyMapForwardIterator_T<OutIterator, FromOper>
|
||||||
|
{
|
||||||
|
SwigPyMapKeyForwardIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||||
|
: SwigPyMapForwardIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename OutIter>
|
||||||
|
inline SwigPyIterator*
|
||||||
|
make_output_key_forward_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
|
||||||
|
{
|
||||||
|
return new SwigPyMapKeyForwardIterator_T<OutIter>(current, begin, end, seq);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class OutIterator,
|
||||||
|
class FromOper = from_value_oper<typename OutIterator::value_type> >
|
||||||
|
struct SwigPyMapValueForwardIterator_T : SwigPyMapForwardIterator_T<OutIterator, FromOper>
|
||||||
|
{
|
||||||
|
SwigPyMapValueForwardIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||||
|
: SwigPyMapForwardIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<typename OutIter>
|
||||||
|
inline SwigPyIterator*
|
||||||
|
make_output_value_forward_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
|
||||||
|
{
|
||||||
|
return new SwigPyMapValueForwardIterator_T<OutIter>(current, begin, end, seq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%fragment("StdUnorderedMapTraits","header",fragment="StdMapCommonTraits",fragment="StdUnorderedMapForwardIteratorTraits")
|
||||||
{
|
{
|
||||||
namespace swig {
|
namespace swig {
|
||||||
template <class SwigPySeq, class K, class T >
|
template <class SwigPySeq, class K, class T >
|
||||||
|
|
@ -73,51 +124,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class OutIterator, class FromOper, class ValueType = typename OutIterator::value_type>
|
|
||||||
struct SwigPyMapForwardIterator_T : SwigPyForwardIteratorClosed_T<OutIterator, ValueType, FromOper>
|
|
||||||
{
|
|
||||||
SwigPyMapForwardIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
|
||||||
: SwigPyForwardIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<class OutIterator,
|
|
||||||
class FromOper = from_key_oper<typename OutIterator::value_type> >
|
|
||||||
struct SwigPyMapKeyForwardIterator_T : SwigPyMapForwardIterator_T<OutIterator, FromOper>
|
|
||||||
{
|
|
||||||
SwigPyMapKeyForwardIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
|
||||||
: SwigPyMapForwardIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename OutIter>
|
|
||||||
inline SwigPyIterator*
|
|
||||||
make_output_key_forward_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
|
|
||||||
{
|
|
||||||
return new SwigPyMapKeyForwardIterator_T<OutIter>(current, begin, end, seq);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class OutIterator,
|
|
||||||
class FromOper = from_value_oper<typename OutIterator::value_type> >
|
|
||||||
struct SwigPyMapValueForwardIterator_T : SwigPyMapForwardIterator_T<OutIterator, FromOper>
|
|
||||||
{
|
|
||||||
SwigPyMapValueForwardIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
|
||||||
: SwigPyMapForwardIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename OutIter>
|
|
||||||
inline SwigPyIterator*
|
|
||||||
make_output_value_forward_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
|
|
||||||
{
|
|
||||||
return new SwigPyMapValueForwardIterator_T<OutIter>(current, begin, end, seq);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
%include <std_unordered_map.i>
|
%include <std_unordered_map.i>
|
||||||
|
|
||||||
%fragment("StdUnorderedMultimapTraits","header",fragment="StdSequenceTraits")
|
%fragment("StdUnorderedMultimapTraits","header",fragment="StdMapCommonTraits",fragment="StdUnorderedMapForwardIteratorTraits")
|
||||||
{
|
{
|
||||||
namespace swig {
|
namespace swig {
|
||||||
template <class SwigPySeq, class K, class T >
|
template <class SwigPySeq, class K, class T >
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue