#828 Warnings when using std library

closed-fixed
5
2009-11-14
2007-05-29
Luke Moore
No

When using std_vector.i or std_map.i with Python (and probably other languages that have no concept of const), swig generates warnings such as:

/usr/share/swig1.3/std/std_vector.i:93: Warning(512): Overloaded begin() const ignored. Non-const method at /usr/share/swig1.3/std/std_vector.i:93 used.
/usr/share/swig1.3/std/std_vector.i:93: Warning(512): Overloaded end() const ignored. Non-const method at /usr/share/swig1.3/std/std_vector.i:93 used.
/usr/share/swig1.3/std/std_vector.i:93: Warning(512): Overloaded rbegin() const ignored. Non-const method at /usr/share/swig1.3/std/std_vector.i:93 used.
/usr/share/swig1.3/std/std_vector.i:93: Warning(512): Overloaded rend() const ignored. Non-const method at /usr/share/swig1.3/std/std_vector.i:93 used.

This is because Lib/std/std_container.i contains both
iterator begin();
iterator end();
reverse_iterator rbegin();
reverse_iterator rend();
and
const_iterator begin() const;
const_iterator end() const;
const_reverse_iterator rbegin() const;
const_reverse_iterator rend() const;

Removing the const versions of begin(), end(), rbegin(), and rend() from Lib/std/std_container.i removes the warnings.

Using std_map.i generates similar warnings about the const versions of find(), lower_bound(), and upper_bound().

For a test case that illustrates the warnings, see #1727629.

Discussion

  • William Fulton

    William Fulton - 2009-11-14

    This was fixed in swig-1.3.35.

     
  • William Fulton

    William Fulton - 2009-11-14
    • assigned_to: beazley --> wsfulton
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks