I am working on a rather large C++ library that has been ported to iOS some time ago against GCC and libstd++. I want to migrate it to LLVM 4.1 and libc++.
Note the "aka"'s are the same and the actual type differ only by their scope.
Note also that this same code compiles just fine with the same compiler (LLVM 4.1) but choosing libstc++ as the target's standard C++ library setting.
Past history has shown that the library is usually wrong when disagreeing with Clang. However, here Clang doesn't see a problem with the GNU version of the standard library. Unfortunately, my C++ template-fu is not first class, and I don't quite know what
I can do to investigate this.
I can provide more detail, but I am not sure what would be relevant.
template<class T>
class KVector :
public vector<T>
{
public:
bool IsNull() const {return(vector<T>::size() ==
0);};
void SetNull() {vector<T>::clear();};
typename vector<T>::iterator erase(int row)
{
if((row < 0) || ((size_t)row >=
vector<T>::size()))
{
return(vector<T>::end());
}
return(vector<T>::erase(vector<T>::begin() + row));
}
typename vector<T>::iterator erase(size_t row)
{
if(row >= vector<T>::size())
{
return(vector<T>::end());
}
return(vector<T>::erase(vector<T>::begin() + row));
}
typename vector<T>::iterator erase(typename
vector<T>::const_iterator it)
{
return(vector<T>::erase(it));
}
typename vector<T>::iterator erase(T* ptr)
{
typename vector<T>::const_iterator it = const_iterator(ptr,
this);
return(vector<T>::erase(it));
}
void erase()
{
vector<T>::clear();
}
typename vector<T>::iterator insert(int row,
const T& val)
{
return(vector<T>::insert(vector<T>::begin() + row, val));
}
typename vector<T>::iterator insert(size_t row,
const T& val)
{
return(vector<T>::insert(vector<T>::begin() + row, val));
}
typename vector<T>::iterator insert(typename
vector<T>::const_iterator pos,
const T& val)
{
return(vector<T>::insert(pos, val));
}
typename vector<T>::iterator insert(T* ptr,
const T& val)
{
typename vector<T>::const_iterator pos = const_iterator(ptr,
this);
return(vector<T>::insert(pos, val));
}
void insert(typename
vector<T>::const_iterator pos, typename
vector<T>::size_type n,
const T& val)
{
return(vector<T>::insert(pos, n, val));
}
void insert(T* ptr, typename
vector<T>::size_type n, const T& val)
{
typename vector<T>::const_iterator it = const_iterator(ptr,
this);
return(vector<T>::insert(it, n, val));
}
void Inflate(size_t maxIndex)
{
if(maxIndex > vector<T>::size()) insert(vector<T>::end(), maxIndex -
vector<T>::size(), T());
};
};