Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Implementation of Vector::Add()
Re: Implementation of Vector::Add() [message #52204 is a reply to message #52203] Fri, 09 August 2019 08:50 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13986
Registered: November 2005
Ultimate Member
Novo wrote on Fri, 09 August 2019 04:26
Vector::Add() (and similar methods) can be implemented via Vector::Add(T&& x=T()). That reduces amount of code.

Similar methods include:

Array::Add()
BiVector::AddHead(), BiVector::AddTail()
AMap::Add(K&& k), Add(const K& k), FindAdd(const K& k), FindAdd(K&& k), Put(const K& k), e.t.c.
ArrayMap::Add(const K& k), Add(K&& k)
FixedAMap::Add(const K& k)

It looks like half of methods of AMap can be eliminated ...

Just my two cents ...


That AFAIK requires that T has defined move constructor. Add() only requires default constructor.

Mirek
 
Read Message
Read Message
Read Message
Previous Topic: [SOLVED] Why long long int seems to be 32 bit longer?
Next Topic: Vector< Vector<int> > compilation error
Goto Forum:
  


Current Time: Tue Jun 18 09:15:14 CEST 2024

Total time taken to generate the page: 0.02340 seconds