File tree Expand file tree Collapse file tree 4 files changed +19
-10
lines changed Expand file tree Collapse file tree 4 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ CPP_TEST_CASES = \
26
26
fortran_naming \
27
27
fortran_onlywrapped \
28
28
fortran_overloads \
29
+ fortran_std_span \
29
30
fortran_subroutine \
30
31
li_std_set \
31
32
complextest \
Original file line number Diff line number Diff line change @@ -11,16 +11,16 @@ class span
11
11
typedef int index_type;
12
12
typedef _Tp* pointer;
13
13
14
- span () : d_ptr (NULL ), d_size (0 ) {}
15
- span (pointer d, index_type s) : d_ptr (d), d_size (s) {}
16
- span (pointer first, pointer last) : d_ptr (first), d_size (last - first) {}
14
+ span () : ptr_ (NULL ), size_ (0 ) {}
15
+ span (pointer d, index_type s) : ptr_ (d), size_ (s) {}
16
+ span (pointer first, pointer last) : ptr_ (first), size_ (last - first) {}
17
17
18
- pointer data () const { return d_ptr ; }
19
- index_type size () const { return d_size ; }
18
+ pointer data () const { return ptr_ ; }
19
+ index_type size () const { return size_ ; }
20
20
21
21
private:
22
- pointer d_ptr ;
23
- index_type d_size ;
22
+ pointer ptr_ ;
23
+ index_type size_ ;
24
24
};
25
25
} // namespace std
26
26
@@ -30,6 +30,8 @@ class span
30
30
31
31
%template () std::span<int >;
32
32
%template () std::span<const int >;
33
+ %template () std::span<unsigned int >;
34
+ %template () std::span<const unsigned int >;
33
35
34
36
%inline %{
35
37
std::span<int > get_by_value () {
Original file line number Diff line number Diff line change @@ -97,7 +97,8 @@ end subroutine}
97
97
%typemap(imtype) CPPTYPE& = CPPTYPE;
98
98
%typemap(ctype) CPPTYPE& = CPPTYPE;
99
99
100
- // Update the resulting Fortran pointer.
101
- //%typemap(fargout, match="argout", noblock=1) CPPTYPE& = VTYPE[]&;
100
+ // Update the resulting Fortran pointer, but only by reference (not const ref)
101
+ %typemap(fargout, match="fin", noblock=1) CPPTYPE& = VTYPE ARRAY[];
102
+ %typemap(fargout, noblock=1) const CPPTYPE& {};
102
103
%enddef
103
104
Original file line number Diff line number Diff line change @@ -203,7 +203,10 @@ end subroutine}
203
203
204
204
// Define proxy code typemaps for an array of this type
205
205
%fortran_typemap_finout(CTYPE[], CTYPE ARRAY[])
206
-
206
+ %typemap(fargout, fragment="SWIG_fout"{CTYPE[]}, noblock=1) CTYPE ARRAY[] {
207
+ call %fortrantm(fout, CTYPE[])($1, $input)
208
+ }
209
+ %typemap(fargout) CTYPE const ARRAY[] = CTYPE ARRAY[];
207
210
%enddef
208
211
209
212
/*!
@@ -225,6 +228,8 @@ end subroutine}
225
228
226
229
%typemap(fin) DSTTYPE ARRAY[] = SRCTYPE ARRAY[];
227
230
%typemap(fout) DSTTYPE ARRAY[] = SRCTYPE ARRAY[];
231
+ %typemap(fargout) DSTTYPE ARRAY[] = SRCTYPE ARRAY[];
232
+ %typemap(fargout) DSTTYPE const ARRAY[] = SRCTYPE const ARRAY[];
228
233
%enddef
229
234
230
235
/* -------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments