Код: Выделить всё
size_t size()
T& operator[](size_t index)
const T& operator[](size_t index)
< /code>
И я хочу написать функцию шаблона, которая принимает конкретную версию MyContainer, например, любой контейнер, который индексирует значения int и значения плавания < /p>
float add(const MyContainer &left, const MyContainer &right);
< /code>
и используйте его как < /p>
vector a;
some_custom_vector b;
float res = add(a, b);
Код: Выделить всё
// can not specify inner type
template
float add(const MyContainer &left, const MyContainer &right);
// can not specify inner type either
auto add(const auto &left, const auto &right);
Подробнее здесь: https://stackoverflow.com/questions/767 ... -as-functi
Мобильная версия