SmallVector::insert() fix
Howard Hinnant
hhinnant at apple.com
Fri Jun 7 10:23:31 PDT 2013
On Jun 7, 2013, at 1:11 PM, David Blaikie <dblaikie at gmail.com> wrote:
>> Using C++11 template aliases you could even implement llvm::SmallVector<T, N> as a std::vector<T, llvm::stack_allocator<T, N>>
>
> This would be slightly problematic - is there anything we could do for
> C++98 compatibility that would keep the terse naming we already have?
It's ugly:
template <class T, size_t N>
struct SmallVector
{
typedef std::vector<T, stack_allocator<T, N> > type;
};
SmallVector<T, N> has to become SmallVector<T, N>::type. If T is a dependent template parameter, add a typename in front of SmallVector.
The only other option I see (without template aliases) is:
template <class T, size_t N>
class SmallVector
{
std::vector<T, stack_allocator<T, N> > data_;
public:
// Replicate the interface here
};
C++11 is worth migrating to. :-)
Howard
More information about the llvm-commits
mailing list