summaryrefslogtreecommitdiff
path: root/core/vector.h
AgeCommit message (Collapse)Author
2020-01-02Merge pull request #34618 from qarmin/vector_please_dont_crashRémi Verschelde
Don't use constant reference in Vector push_back, insert and append_array
2020-01-01Update copyright statements to 2020Rémi Verschelde
Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
2019-12-26Don't use constant reference in Vector push_back, insert and append_arrayRafał Mikrut
2019-06-11Fix error macro calls not ending with semicolonRémi Verschelde
It's not necessary, but the vast majority of calls of error macros do have an ending semicolon, so it's best to be consistent. Most WARN_DEPRECATED calls did *not* have a semicolon, but there's no reason for them to be treated differently.
2019-02-12Core: Ensure classes match their header filenameRémi Verschelde
Also drop some unused files. Renamed: - `core/dvector.h` -> `pool_vector.h` - `core/io/resource_import.h` -> `resource_importer.h` - `core/sort.h` -> `sort_array.h` - `core/string_db.h` -> `string_name.h` Dropped: - `core/allocators.h` - `core/os/shell.h` - `core/variant_construct_string.cpp`
2019-01-07Repair String lstrip and rstrip.Ibrahn Sahir
Background: lstrip and rstrip were broken by changes to String in: 0e29f7974b59e4440cf02e1388fb9d8ab2b5c5fd which removed it's access to Vector::find(CharType). Moved Vector's find up into CowData so it can be shared by Vector and String. Added String::find_char using CowData::find. Implemented rstrip and lstrip using find_char. Added a few tests for String rstrip and lstrip.
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-12-14Don't allocate in Vector's ctorHein-Pieter van Braam
By relying on the fact that a struct or class's first member has the same address as the struct itself we can cast VectorWriteProxy<T> to Vector<T> and access the CowData field. This allows a Vector to be moved in memory without invalidating the pointer to the cowdata field.
2018-09-12Make core/ includes absolute, remove subfolders from include pathRémi Verschelde
This allows more consistency in the manner we include core headers, where previously there would be a mix of absolute, relative and include path-dependent includes.
2018-07-29Fix nested VectorsHein-Pieter van Braam
When a Vector of Vectors gets resized the 'this' pointer of the Vectors change. This means that the VectorWriteProxy _parent references get invalidated. Thanks a lot to @ibrahn for finding the root cause of this. To fix this we now create a pointer to CowData in Vector (which won't change when the vectors move) and pass that to the write proxy also. This fixes #20475
2018-07-26Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam
This commit makes operator[] on Vector const and adds a write proxy to it. From now on writes to Vectors need to happen through the .write proxy. So for instance: Vector<int> vec; vec.push_back(10); std::cout << vec[0] << std::endl; vec.write[0] = 20; Failing to use the .write proxy will cause a compilation error. In addition COWable datatypes can now embed a CowData pointer to their data. This means that String, CharString, and VMap no longer use or derive from Vector. _ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug builds. This is a lot faster for Vector in the editor and while running tests. The reason why this difference used to exist is because force-inlined methods used to give a bad debugging experience. After extensive testing with modern compilers this is no longer the case.
2018-07-23Added function append_array to vectorAndreaCatania
2018-01-05Add missing copyright headers and fix formattingRémi Verschelde
Using `misc/scripts/fix_headers.py` on all Godot files. Some missing header guards were added, and the header inclusion order was fixed in the Bullet module.
2018-01-01Update copyright statements to 2018Rémi Verschelde
Happy new year to the wonderful Godot community!
2017-11-25Made Vector::ptrw explicit for writing, compiler was sometimes using the ↵Juan Linietsky
wrong function, leading to unnecesary copy on writes and reduced performance.
2017-08-27Use HTTPS URL for Godot's website in the headersRémi Verschelde
2017-08-17Add closest_power_of_2 func and implement mix_rate/latency on OS XMarcelo Fernandez
2017-08-14Use const reference where favorableWilson E. Alvarez
2017-07-05Implement well-defined handling of unrecoverable errorsPedro J. Estébanez
Plus the addition of some convenience CRASH_* error macros. Plus transient avoidance of the flood of warnings emitted by Clang when checking 'this' for NULL. Plus explanation about the do-while(0) loop in some error macros.
2017-04-08Add "Godot Engine contributors" copyright lineRémi Verschelde
2017-03-05A Whole New World (clang-format edition)Rémi Verschelde
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
2017-02-01Enable WebGL2 in web export, start fixing buildeska
Will not yet compile
2017-01-07Memory pool vectors (DVector) have been enormously simplified in code, and ↵Juan Linietsky
renamed to PoolVector
2017-01-06-Changed memory functions, Memory::alloc_static*, simplified them, made them ↵Juan Linietsky
aligned to 16 -Changed Vector<> template to fit this.
2017-01-01Welcome in 2017, dear changelog reader!Rémi Verschelde
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer with state-of-the-art rendering techniques tuned to work as low as middle end handheld devices - without compromising with the possibilities given for higher end desktop games of course. Great times ahead for the Godot community and the gamers that will play our games!
2016-06-10Add 'from' argument to Array.find()George Marques
2016-04-11Use non-templated nearest_power_of_2punto-
Works around #4262 and likely #4190. (cherry picked from commit 3a390e9b44cb196aa4b4843dd8b3a7875bbc3a3f)
2016-03-09remove trailing whitespaceHubert Jarosz
2016-02-19Fix allocation bug if compiled with modern clang or gccest31
* Add overflow checked intrinsic abstractions that check on overflow. * Use them for memory allocation code. * Use size_t type for memory allocation code to support full platform dependent width. Fixes #3756.
2016-01-01Update copyright to 2016 in headersGeorge Marques
2015-12-04Vector<>::_ptr is now typed and points to the beginning of array rather than ↵koalefant
reference count block
2015-06-29Several performance improvements, mainly in loading and instancing scenes ↵Juan Linietsky
and resources. A general speedup should be apparent, with even more peformance increase when compiling optimized. WARNING: Tested and it seems to work, but if something breaks, please report.
2015-06-06-fixed many memory initialization issuesJuan Linietsky
-fixed deadlock on previews thread -fixed compilation errors on unix
2015-04-18Updated copyright year in all headersJuan Linietsky
2015-03-24Use Vector for storing areasFabio Alessandrelli
2014-02-09GODOT IS OPEN SOURCEJuan Linietsky