remove std::set from new extended functions, as
it was failing due to non-assignable iterator. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9774 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
1c46a18c50
commit
f92ebdbe07
5 changed files with 73 additions and 39 deletions
|
|
@ -18,7 +18,7 @@ require 'newobject2'
|
||||||
include Newobject2
|
include Newobject2
|
||||||
|
|
||||||
GC.track_class = Foo
|
GC.track_class = Foo
|
||||||
GC.stats
|
GC.stats if $VERBOSE
|
||||||
100.times { foo1 = makeFoo }
|
100.times { foo1 = makeFoo }
|
||||||
GC.stats if $VERBOSE
|
GC.stats if $VERBOSE
|
||||||
swig_assert( 'fooCount == 100', nil, "but is #{fooCount}" )
|
swig_assert( 'fooCount == 100', nil, "but is #{fooCount}" )
|
||||||
|
|
|
||||||
|
|
@ -200,5 +200,42 @@ namespace std {
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fragment that contains traits to properly deal with GC_VALUE.
|
||||||
|
// These functions may be invoked as a need of the from(), asval(),
|
||||||
|
// asptr() and as() template functors, usually used in %typemaps.
|
||||||
|
//
|
||||||
|
%fragment(SWIG_Traits_frag(swig::GC_VALUE),"header",fragment="StdTraits") {
|
||||||
|
namespace swig {
|
||||||
|
template <> struct traits<GC_VALUE > {
|
||||||
|
typedef value_category category;
|
||||||
|
static const char* type_name() { return "GC_VALUE"; }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct traits_from<GC_VALUE> {
|
||||||
|
typedef GC_VALUE value_type;
|
||||||
|
static VALUE from(const value_type& val) {
|
||||||
|
return static_cast<VALUE>(val);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct traits_check<GC_VALUE, value_category> {
|
||||||
|
static bool check(GC_VALUE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct traits_asval<GC_VALUE > {
|
||||||
|
typedef GC_VALUE value_type;
|
||||||
|
static int asval(VALUE obj, value_type *val) {
|
||||||
|
if (val) *val = obj;
|
||||||
|
return SWIG_OK;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} // swig
|
||||||
|
} // %fragment(traits for swig::GC_VALUE)
|
||||||
|
|
||||||
|
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -36,36 +36,6 @@
|
||||||
|
|
||||||
%include <std_except.i>
|
%include <std_except.i>
|
||||||
|
|
||||||
%fragment(SWIG_Traits_frag(swig::GC_VALUE),"header",fragment="StdTraits") {
|
|
||||||
namespace swig {
|
|
||||||
template <> struct traits<GC_VALUE > {
|
|
||||||
typedef value_category category;
|
|
||||||
static const char* type_name() { return "GC_VALUE"; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct traits_from<GC_VALUE> {
|
|
||||||
typedef GC_VALUE value_type;
|
|
||||||
static VALUE from(const value_type& val) {
|
|
||||||
return static_cast<VALUE>(val);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct traits_check<GC_VALUE, value_category> {
|
|
||||||
static bool check(GC_VALUE) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct traits_asval<GC_VALUE > {
|
|
||||||
typedef GC_VALUE value_type;
|
|
||||||
static int asval(VALUE obj, value_type *val) {
|
|
||||||
if (val) *val = obj;
|
|
||||||
return SWIG_OK;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} // swig
|
|
||||||
} // %fragment(traits for swig::GC_VALUE)
|
|
||||||
|
|
||||||
%fragment("RubySequence_Base","header")
|
%fragment("RubySequence_Base","header")
|
||||||
{
|
{
|
||||||
|
|
@ -425,6 +395,10 @@ namespace swig
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Macros used to typemap an STL iterator -> SWIGIterator conversion.
|
||||||
|
*
|
||||||
|
*/
|
||||||
%define %swig_sequence_iterator(Sequence...)
|
%define %swig_sequence_iterator(Sequence...)
|
||||||
#if defined(SWIG_EXPORT_ITERATOR_METHODS)
|
#if defined(SWIG_EXPORT_ITERATOR_METHODS)
|
||||||
class iterator;
|
class iterator;
|
||||||
|
|
@ -514,6 +488,11 @@ namespace swig
|
||||||
|
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Macro used to define common Ruby printing methods for STL container
|
||||||
|
*
|
||||||
|
*/
|
||||||
%define %swig_sequence_printing_methods(Sequence...)
|
%define %swig_sequence_printing_methods(Sequence...)
|
||||||
|
|
||||||
%extend {
|
%extend {
|
||||||
|
|
@ -569,6 +548,10 @@ namespace swig
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Macro used to add common methods to all STL sequence-type containers
|
||||||
|
*
|
||||||
|
*/
|
||||||
%define %swig_sequence_methods_common(Sequence...)
|
%define %swig_sequence_methods_common(Sequence...)
|
||||||
%swig_container_methods(%arg(Sequence))
|
%swig_container_methods(%arg(Sequence))
|
||||||
%swig_sequence_iterator(%arg(Sequence))
|
%swig_sequence_iterator(%arg(Sequence))
|
||||||
|
|
@ -674,6 +657,11 @@ namespace swig
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Macro used to add functions for back insertion of values in
|
||||||
|
* STL Sequence containers
|
||||||
|
*
|
||||||
|
*/
|
||||||
%define %swig_sequence_back_inserters( Sequence... )
|
%define %swig_sequence_back_inserters( Sequence... )
|
||||||
%extend {
|
%extend {
|
||||||
|
|
||||||
|
|
@ -705,6 +693,11 @@ namespace swig
|
||||||
}
|
}
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Macro used to add functions for Sequences
|
||||||
|
*
|
||||||
|
*/
|
||||||
%define %swig_sequence_methods(Sequence...)
|
%define %swig_sequence_methods(Sequence...)
|
||||||
%swig_sequence_methods_common(%arg(Sequence));
|
%swig_sequence_methods_common(%arg(Sequence));
|
||||||
%swig_sequence_back_inserters(%arg(Sequence));
|
%swig_sequence_back_inserters(%arg(Sequence));
|
||||||
|
|
@ -842,6 +835,11 @@ namespace swig
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Macro used to add functions for front insertion of
|
||||||
|
* elements in STL sequence containers that support it.
|
||||||
|
*
|
||||||
|
*/
|
||||||
%define %swig_sequence_front_inserters( Sequence... )
|
%define %swig_sequence_front_inserters( Sequence... )
|
||||||
|
|
||||||
%extend {
|
%extend {
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@
|
||||||
* @brief This file contains additional functions that make containers
|
* @brief This file contains additional functions that make containers
|
||||||
* behave closer to ruby primitive types.
|
* behave closer to ruby primitive types.
|
||||||
* However, some of these functions place some restrictions on
|
* However, some of these functions place some restrictions on
|
||||||
* the underlying object inside of the container (that it has
|
* the underlying object inside of the container and the iterator
|
||||||
* an == comparison function, that it has an = assignment
|
* (that it has to have an == comparison function, that it has to have
|
||||||
* operator, etc).
|
* an = assignment operator, etc).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// map!
|
// map! -- the equivalent of std::transform
|
||||||
//
|
//
|
||||||
Container< Type >* map_bang() {
|
Container< Type >* map_bang() {
|
||||||
|
|
||||||
|
|
@ -134,7 +134,6 @@
|
||||||
|
|
||||||
|
|
||||||
%__swig_container_extend_primtypes( std::vector );
|
%__swig_container_extend_primtypes( std::vector );
|
||||||
%__swig_container_extend_primtypes( std::set );
|
|
||||||
%__swig_container_extend_primtypes( std::list );
|
|
||||||
%__swig_container_extend_primtypes( std::deque );
|
%__swig_container_extend_primtypes( std::deque );
|
||||||
|
%__swig_container_extend_primtypes( std::list );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
* Users can derive form the RubySwigIterator to implemet their
|
* Users can derive form the RubySwigIterator to implemet their
|
||||||
* own iterators. As an example (real one since we use it for STL/STD
|
* own iterators. As an example (real one since we use it for STL/STD
|
||||||
* containers), the template RubySwigIterator_T does the
|
* containers), the template RubySwigIterator_T does the
|
||||||
* implementation for genereic C++ iterators.
|
* implementation for generic C++ iterators.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
%include <std_common.i>
|
%include <std_common.i>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue