Java/C# std::vector<bool> workarounds for clang
Workaround clang++ 9.1.0 error not knowing std::vector<bool>::const_reference
is actually typedef to bool:
li_std_vector_wrap.cxx:1838:40: error: no matching constructor for initialization of 'std::vector<bool>::const_reference'
Workaround is use
const value_type& getitem(int index) throw (std::out_of_range) { ...
// bool specialization:
bool getitem(int index) throw (std::out_of_range) { ...
instead of
const_reference_type getitem(int index) throw (std::out_of_range) { ...
Although the following would be better, it would require a more
complicated implementation:
const_reference_type getitem(int index) throw (std::out_of_range) { ...
// bool specialization:
bool getitem(int index) throw (std::out_of_range) { ...
This commit is contained in:
parent
77f075b6e8
commit
d67c133c4a
2 changed files with 2 additions and 2 deletions
|
|
@ -129,7 +129,7 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
|
|||
}
|
||||
}
|
||||
|
||||
const_reference doGet(jint index) throw (std::out_of_range) {
|
||||
CONST_REFERENCE doGet(jint index) throw (std::out_of_range) {
|
||||
jint size = static_cast<jint>(self->size());
|
||||
if (index >= 0 && index < size)
|
||||
return (*self)[index];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue