Removed allocator from constructors.

Added copy constructors to stack/queue.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9780 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Gonzalo Garramuno 2007-05-06 05:54:48 +00:00
commit 8622de7595
8 changed files with 45 additions and 49 deletions

View file

@ -22,6 +22,8 @@ CPP_TEST_CASES = \
li_std_map \ li_std_map \
li_std_set \ li_std_set \
li_std_functors \ li_std_functors \
li_std_stack \
li_std_queue \
naming \ naming \
primitive_types \ primitive_types \
std_containers \ std_containers \

View file

@ -1,6 +1,6 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# #
# A simple std::stack test # A simple std::queue test
# #
# Author:: # Author::
# Copyright:: # Copyright::

View file

@ -114,7 +114,7 @@ namespace std {
%typemap_traits_ptr(SWIG_TYPECHECK_MAP, std::map<_Key, _Tp, _Compare, _Alloc >); %typemap_traits_ptr(SWIG_TYPECHECK_MAP, std::map<_Key, _Tp, _Compare, _Alloc >);
map( const _Compare&, const _Alloc& a = allocator_type() ); map( const _Compare& );
#ifdef %swig_map_methods #ifdef %swig_map_methods
// Add swig/language extra methods // Add swig/language extra methods

View file

@ -75,7 +75,7 @@ namespace std {
%typemap_traits_ptr(SWIG_TYPECHECK_MULTIMAP, std::multimap<_Key, _Tp, _Compare, _Alloc >); %typemap_traits_ptr(SWIG_TYPECHECK_MULTIMAP, std::multimap<_Key, _Tp, _Compare, _Alloc >);
multimap( const _Compare&, const _Alloc& a = allocator_type() ); multimap( const _Compare& );
#ifdef %swig_multimap_methods #ifdef %swig_multimap_methods
// Add swig/language extra methods // Add swig/language extra methods

View file

@ -71,7 +71,7 @@ namespace std {
%typemap_traits_ptr(SWIG_TYPECHECK_MULTISET, std::multiset<_Key, _Compare, _Alloc >); %typemap_traits_ptr(SWIG_TYPECHECK_MULTISET, std::multiset<_Key, _Compare, _Alloc >);
multiset( const _Compare&, const _Alloc& a = allocator_type() ); multiset( const _Compare& );
#ifdef %swig_multiset_methods #ifdef %swig_multiset_methods
// Add swig/language extra methods // Add swig/language extra methods

View file

@ -12,6 +12,9 @@
// Queue // Queue
%define %std_queue_methods(queue...) %define %std_queue_methods(queue...)
queue();
queue( const _Sequence& );
bool empty() const; bool empty() const;
size_type size() const; size_type size() const;
const value_type& front() const; const value_type& front() const;
@ -54,25 +57,22 @@
namespace std { namespace std {
template<class _Tp, class _Alloc = allocator<_Tp> > template<class _Tp, class _Sequence = std::deque<_Tp> >
class queue { class queue {
public: public:
typedef size_t size_type; typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp value_type; typedef _Tp value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference; typedef value_type& reference;
typedef const value_type& const_reference; typedef const value_type& const_reference;
typedef _Alloc allocator_type; typedef _Sequence container_type;
%traits_swigtype(_Tp); %traits_swigtype(_Tp);
%fragment(SWIG_Traits_frag(std::queue<_Tp, _Alloc >), "header", %fragment(SWIG_Traits_frag(std::queue<_Tp, _Sequence >), "header",
fragment=SWIG_Traits_frag(_Tp), fragment=SWIG_Traits_frag(_Tp),
fragment="StdQueueTraits") { fragment="StdQueueTraits") {
namespace swig { namespace swig {
template <> struct traits<std::queue<_Tp, _Alloc > > { template <> struct traits<std::queue<_Tp, _Sequence > > {
typedef pointer_category category; typedef pointer_category category;
static const char* type_name() { static const char* type_name() {
return "std::queue<" #_Tp " >"; return "std::queue<" #_Tp " >";
@ -81,35 +81,32 @@ namespace std {
} }
} }
%typemap_traits_ptr(SWIG_TYPECHECK_QUEUE, std::queue<_Tp, _Alloc >); %typemap_traits_ptr(SWIG_TYPECHECK_QUEUE, std::queue<_Tp, _Sequence >);
#ifdef %swig_queue_methods #ifdef %swig_queue_methods
// Add swig/language extra methods // Add swig/language extra methods
%swig_queue_methods(std::queue<_Tp, _Alloc >); %swig_queue_methods(std::queue<_Tp, _Sequence >);
#endif #endif
%std_queue_methods(queue); %std_queue_methods(queue);
}; };
template<class _Tp, class _Alloc > template<class _Tp, class _Sequence >
class queue<_Tp*, _Alloc > { class queue<_Tp*, _Sequence > {
public: public:
typedef size_t size_type; typedef size_t size_type;
typedef ptrdiff_t difference_type; typedef _Tp value_type;
typedef _Tp* value_type; typedef value_type& reference;
typedef value_type* pointer; typedef const value_type& const_reference;
typedef const value_type* const_pointer; typedef _Sequence container_type;
typedef value_type reference;
typedef value_type const_reference;
typedef _Alloc allocator_type;
%traits_swigtype(_Tp); %traits_swigtype(_Tp);
%fragment(SWIG_Traits_frag(std::queue<_Tp*, _Alloc >), "header", %fragment(SWIG_Traits_frag(std::queue<_Tp*, _Sequence >), "header",
fragment=SWIG_Traits_frag(_Tp), fragment=SWIG_Traits_frag(_Tp),
fragment="StdQueueTraits") { fragment="StdQueueTraits") {
namespace swig { namespace swig {
template <> struct traits<std::queue<_Tp*, _Alloc > > { template <> struct traits<std::queue<_Tp*, _Sequence > > {
typedef value_category category; typedef value_category category;
static const char* type_name() { static const char* type_name() {
return "std::queue<" #_Tp " * >"; return "std::queue<" #_Tp " * >";
@ -118,14 +115,14 @@ namespace std {
} }
} }
%typemap_traits_ptr(SWIG_TYPECHECK_QUEUE, std::queue<_Tp*, _Alloc >); %typemap_traits_ptr(SWIG_TYPECHECK_QUEUE, std::queue<_Tp*, _Sequence >);
#ifdef %swig_queue_methods_val #ifdef %swig_queue_methods_val
// Add swig/language extra methods // Add swig/language extra methods
%swig_queue_methods_val(std::queue<_Tp*, _Alloc >); %swig_queue_methods_val(std::queue<_Tp*, _Sequence >);
#endif #endif
%std_queue_methods_val(std::queue<_Tp*, _Alloc >); %std_queue_methods_val(std::queue<_Tp*, _Sequence >);
}; };
} }

View file

@ -91,7 +91,7 @@ namespace std {
%typemap_traits_ptr(SWIG_TYPECHECK_SET, std::set<_Key, _Compare, _Alloc >); %typemap_traits_ptr(SWIG_TYPECHECK_SET, std::set<_Key, _Compare, _Alloc >);
set( const _Compare&, const _Alloc& a = allocator_type() ); set( const _Compare& );
#ifdef %swig_set_methods #ifdef %swig_set_methods
// Add swig/language extra methods // Add swig/language extra methods

View file

@ -12,6 +12,9 @@
// Stack // Stack
%define %std_stack_methods(stack...) %define %std_stack_methods(stack...)
stack();
stack( const _Sequence& );
bool empty() const; bool empty() const;
size_type size() const; size_type size() const;
const value_type& top() const; const value_type& top() const;
@ -53,25 +56,22 @@
namespace std { namespace std {
template<class _Tp, class _Alloc = allocator<_Tp> > template<class _Tp, class _Sequence = std::deque<_Tp> >
class stack { class stack {
public: public:
typedef size_t size_type; typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp value_type; typedef _Tp value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference; typedef value_type& reference;
typedef const value_type& const_reference; typedef const value_type& const_reference;
typedef _Alloc allocator_type; typedef _Sequence container_type;
%traits_swigtype(_Tp); %traits_swigtype(_Tp);
%fragment(SWIG_Traits_frag(std::stack<_Tp, _Alloc >), "header", %fragment(SWIG_Traits_frag(std::stack<_Tp, _Sequence >), "header",
fragment=SWIG_Traits_frag(_Tp), fragment=SWIG_Traits_frag(_Tp),
fragment="StdStackTraits") { fragment="StdStackTraits") {
namespace swig { namespace swig {
template <> struct traits<std::stack<_Tp, _Alloc > > { template <> struct traits<std::stack<_Tp, _Sequence > > {
typedef pointer_category category; typedef pointer_category category;
static const char* type_name() { static const char* type_name() {
return "std::stack<" #_Tp " >"; return "std::stack<" #_Tp " >";
@ -80,35 +80,32 @@ namespace std {
} }
} }
%typemap_traits_ptr(SWIG_TYPECHECK_STACK, std::stack<_Tp, _Alloc >); %typemap_traits_ptr(SWIG_TYPECHECK_STACK, std::stack<_Tp, _Sequence >);
#ifdef %swig_stack_methods #ifdef %swig_stack_methods
// Add swig/language extra methods // Add swig/language extra methods
%swig_stack_methods(std::stack<_Tp, _Alloc >); %swig_stack_methods(std::stack<_Tp, _Sequence >);
#endif #endif
%std_stack_methods(stack); %std_stack_methods(stack);
}; };
template<class _Tp, class _Alloc > template<class _Tp, class _Sequence >
class stack<_Tp*, _Alloc > { class stack<_Tp*, _Sequence > {
public: public:
typedef size_t size_type; typedef size_t size_type;
typedef ptrdiff_t difference_type; typedef _Sequence::value_type value_type;
typedef _Tp* value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type reference; typedef value_type reference;
typedef value_type const_reference; typedef value_type const_reference;
typedef _Alloc allocator_type; typedef _Sequence container_type;
%traits_swigtype(_Tp); %traits_swigtype(_Tp);
%fragment(SWIG_Traits_frag(std::stack<_Tp*, _Alloc >), "header", %fragment(SWIG_Traits_frag(std::stack<_Tp*, _Sequence >), "header",
fragment=SWIG_Traits_frag(_Tp), fragment=SWIG_Traits_frag(_Tp),
fragment="StdStackTraits") { fragment="StdStackTraits") {
namespace swig { namespace swig {
template <> struct traits<std::stack<_Tp*, _Alloc > > { template <> struct traits<std::stack<_Tp*, _Sequence > > {
typedef value_category category; typedef value_category category;
static const char* type_name() { static const char* type_name() {
return "std::stack<" #_Tp " * >"; return "std::stack<" #_Tp " * >";
@ -117,14 +114,14 @@ namespace std {
} }
} }
%typemap_traits_ptr(SWIG_TYPECHECK_STACK, std::stack<_Tp*, _Alloc >); %typemap_traits_ptr(SWIG_TYPECHECK_STACK, std::stack<_Tp*, _Sequence >);
#ifdef %swig_stack_methods_val #ifdef %swig_stack_methods_val
// Add swig/language extra methods // Add swig/language extra methods
%swig_stack_methods_val(std::stack<_Tp*, _Alloc >); %swig_stack_methods_val(std::stack<_Tp*, _Sequence >);
#endif #endif
%std_stack_methods_val(std::stack<_Tp*, _Alloc >); %std_stack_methods_val(std::stack<_Tp*, _Sequence >);
}; };
} }