Commit Graph

6 Commits

Author SHA1 Message Date
William S Fulton 280b3a908e Java STL changes to use Java int, support 64-bit size_t
std::vector::capacity and std::vector::reserve signature changes.

Java api changes from:
  public long capacity() { ... }
  public void reserve(long n) { ... }
to:
  public int capacity() { ... }
  public void reserve(int n) { ... }
to fit in with the usual Java convention of using int for container
indexing and sizing.

The original api for std::vector::reserve can be also be made available via
%extend to add in an overloaded method as follows:

  %include <std_vector.i>
  %extend std::vector {
    void reserve(jlong n) throw (std::length_error, std::out_of_range) {
      if (n < 0)
        throw std::out_of_range("vector reserve size must be positive");
      self->reserve(n);
    }
  }

This change is partially driven by the need to seamlessly support the full
64-bit range for size_t generically, apart from the customisations for the
STL containers, by using:

  %apply unsigned long long { size_t };
  %apply const unsigned long long & { const size_t & };

Similarly for std::array::size.

Also enhance docs for applying unsigned long long typemaps for 64-bit
size_t.
2023-10-06 19:42:39 +01:00
William S Fulton f87182ad98 Improve backwards compatibility in C#/Java std::array wrappers
For users who have typemaps for the parameters in the setitem or set methods.
2019-04-19 11:06:24 +01:00
William S Fulton 40d7f4137e typedef declaration corrections for std::array 2019-02-14 07:38:49 +00:00
William S Fulton b41fdba9ef Cosmetic changes for Java std::array wrappers 2017-09-12 08:36:53 +01:00
William S Fulton fdca8e9829 Better variable naming consistency in STL containers 2017-05-26 22:37:29 +01:00
William S Fulton 870b814f5e Add C++11 std::array container support for Java 2016-03-14 20:46:56 +00:00