Ну, с push_back понятно.
От: psi_fan  
Дата: 18.05.05 13:30
Оценка:
Что же касается индексирования то хотелось бы что-то вроде:
template <class U> U const & operator[]( int index )
{
//returns reference to the index-th inserted element, casted to its native type.
}
Re: Сорри, это был ответ Chez'у
От: psi_fan  
Дата: 18.05.05 13:31
Оценка:
Здравствуйте, psi_fan, Вы писали:

_>Что же касается индексирования то хотелось бы что-то вроде:

_>template <class U> U const & operator[]( int index )
_>{
_>//returns reference to the index-th inserted element, casted to its native type.
_>}
Re: Ну, с push_back понятно.
От: Chez Россия  
Дата: 18.05.05 14:45
Оценка:
Здравствуйте, psi_fan, Вы писали:

_>Что же касается индексирования то хотелось бы что-то вроде:

_>template <class U> U const & operator[]( int index )
_>{
_>//returns reference to the index-th inserted element, casted to its native type.
_>}
так нельзя. рантйм не может влиять на компайл-тайм.

Chez, ICQ#161095094

Posted via:RSDN@Home;version:1.1.3;muzikstamp:Orplid — Inneres Heer

Re: Ну, с push_back понятно.
От: MaximE Великобритания  
Дата: 19.05.05 10:11
Оценка:
psi_fan wrote:

> Что же касается индексирования то хотелось бы что-то вроде:

> template <class U> U const & operator[]( int index )
> {
> //returns reference to the index-th inserted element, casted to its native type.
> }

template<class T>
struct index
{
     index(size_t n) : n(n) {}
     size_t n;
};

template<class T>
T const& operator[](index<T> i);

xxx[index<whatever>(1)];


--
Maxim Yegorushkin
Posted via RSDN NNTP Server 1.9
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.