Вот сижу делаю ревью чужого кода:
template <class Item>
class SafeVector : public std::vector<Item>
{
static Item m_FakeItem;
public:
std::vector<Item>::const_reference operator[](
std::vector<Item>::size_type Index) const
{
if (Index < 0 || Index >= size())
return m_FakeItem;
return (*(begin() + Index));
}
std::vector<Item>::reference operator[](
std::vector<Item>::size_type Index)
{
if (Index < 0 || Index >= size())
return m_FakeItem;
return (*(begin() + Index));
}
};
Как вам такое? Я вот думаю как бы помягче обьяснить человеку, что он не прав.