aboutsummaryrefslogtreecommitdiff
path: root/src/prevector.h
Commit message (Collapse)AuthorAgeFilesLines
* Implement prevector::fill onceBen Woosley2018-11-141-5/+1
| | | | | Now that the implementation is identical, we can use a default value to distinguish them.
* Drop defunct IS_TRIVIALLY_CONSTRUCTIBLE handling from prevector.hBen Woosley2018-11-141-2/+0
| | | | | It's now only referenced from the bench, so leave it there. This allows us to drop the associated includes as well.
* warnings: Compiler warning on memset usage for non-trivial typeLenny Maiorani2018-11-041-13/+3
| | | | | | | | | | | | Problem: - IS_TRIVIALLY_CONSTRUCTIBLE macro does not work correctly resulting in `memset()` usage to set a non-trivial type to 0 when `nontrivial_t` is passed in from the tests. - Warning reported by GCC when compiling with `--enable-werror`. Solution: - Use the standard algorithm `std::fill_n()` and let the compiler determine the optimal way of looping or using `memset()`.
* Explicitly initialize prevector _unionBen Woosley2018-08-271-5/+5
|
* Remove default argument to prevector constructor to remove ambiguityBen Woosley2018-08-231-1/+1
| | | | The call with this default argument is redundant with prevector(size_type).
* Update copyright headers to 2018DrahtBot2018-07-271-1/+1
|
* Use memset() to optimize prevector::resize()Evan Klitzke2018-02-271-6/+25
| | | | | | Further optimize prevector::resize() (which is called by a number of other prevector methods) to use memset to initialize memory when the prevector contains trivial types.
* Reduce redundant code of prevector and speed it upAkio Nakamura2018-02-271-49/+42
| | | | | | | | | | | | | | | | In prevector.h, the code which like item_ptr(size()) apears in the loop. Both item_ptr() and size() judge whether values are held directly or indirectly, but in most cases it is sufficient to make that judgement once outside the loop. This PR adds 2 private function fill() which has the loop to initialize by specified value (or iterator of the other prevector's element), but don't call item_ptr() in their loop. Other functions(assign(), constructor, operator=(), insert()) that has similar loop, call fill() instead of original loop. Also, resize() was changed like fill(), but it calls the default constructor for that element each time.
* Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa2018-01-031-1/+1
|
* Fix header guards using reserved identifiersDan Raviv2017-08-261-3/+3
| | | | Identifiers beginning with an underscore followed immediately by an uppercase letter are reserved.
* scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift2017-08-071-1/+1
| | | | | | | | | | | | | instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
* Explicitly initialize prevector::_union to avoid new warningMatt Corallo2017-07-141-1/+1
| | | | | | Warning from gcc 7.1 is ./prevector.h:450:25: warning: '*((void*)(&<anonymous>)+8).prevector<28, unsigned char>::_union.prevector<28, unsigned char>::direct_or_indirect::<anonymous>.prevector<28, unsigned char>::direct_or_indirect::<unnamed struct>::indirect' may be used uninitialized in this function [-Wmaybe-uninitialized]
* Fix const_reverse_iterator constructor (pass const ptr)Jorge Timón2017-06-221-1/+1
|
* Clarify prevector::erase and avoid swap-to-clearPieter Wuille2017-06-091-0/+6
|
* Merge #9505: Prevector Quick DestructWladimir J. van der Laan2017-03-141-5/+12
|\ | | | | | | | | | | | | 45a5aaf Only call clear on prevector if it isn't trivially destructible and don't loop in clear (Jeremy Rubin) aaa02e7 Add prevector destructor benchmark (Jeremy Rubin) Tree-SHA512: 52bc8163b65b71310252f2d578349d0ddc364a6c23795c5e06e101f5449f04c96cbdca41c0cffb1974b984b8e33006471137d92b8dd4a81a98e922610a94132a
| * Only call clear on prevector if it isn't trivially destructible and don't ↵Jeremy Rubin2017-01-101-5/+12
| | | | | | | | loop in clear
* | prevector: assert successful allocationCory Fields2017-02-271-0/+6
|/
* Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
| | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* Make CScript (and prevector) c++11 movable.Pieter Wuille2016-12-211-0/+9
| | | | | Such moves are used when reallocating vectors that contain them, for example.
* serialize: Deprecate `begin_ptr` / `end_ptr`Wladimir J. van der Laan2016-10-021-1/+1
| | | | | | | Implement `begin_ptr` and `end_ptr` in terms of C++11 code, and add a comment that they are deprecated. Follow-up to developer notes update in 654a21162252294b7dbd6c982fec88008af7335e.
* prevector: add C++11-like data() methodWladimir J. van der Laan2016-09-301-0/+8
| | | | This returns a pointer to the beginning of the vector's data.
* prevector::swap: fix (unreached) data corruptionKaz Wesley2016-04-161-6/+1
| | | | | | | | | | swap was using an incorrect condition to determine when to apply an optimization (not swapping the full direct[] when swapping two indirect prevectors). Rather than correct the optimization I'm removing it for simplicity. Removing this optimization minutely improves performance in the typical (currently only) usage of member swap(), which is swapping with a freshly value-initialized object.
* prevector: destroy elements only via erase()Kaz Wesley2016-04-161-8/+4
| | | | | | | | | Fixes a bug in which pop_back did not call the deleted item's destructor. Using the most general erase() implementation to implement all the others prevents similar bugs because the coupling between deallocation and destructor invocation only needs to be maintained in one place. Also reduces duplication of complex memmove logic.
* Add missing copyright headersMarcoFalke2016-01-051-0/+4
|
* Name union to prevent compiler warningPavel Janík2015-12-021-1/+1
|
* Prevector typePieter Wuille2015-11-131-0/+486