|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi
why in STL vector donot have thier sort function while List have ? we have to use function provided by algorthim ..........sort( ) defined outside vector class Thanks |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Pallav singh wrote:
> Hi > > why in STL vector donot have thier sort function while List have ? > we have to use function provided by algorthim ..........sort( ) > defined outside vector class > > The C++ <algorithm> library sort template requires random access iterators. Vector iterators satisfy this. List does not have random access, only sequential (bidirectional at least). It needs a special sort algorithm as a result. |
|
![]() |
| Outils de la discussion | |
|
|