Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bartoszklonowski/extendedvector
C++17 version of std::vector, but much more extended and provided with all the features available in List<T> from .NET Framework.
https://github.com/bartoszklonowski/extendedvector
cpp extendedvector foreach list std vector
Last synced: 25 days ago
JSON representation
C++17 version of std::vector, but much more extended and provided with all the features available in List<T> from .NET Framework.
- Host: GitHub
- URL: https://github.com/bartoszklonowski/extendedvector
- Owner: BartoszKlonowski
- License: mit
- Created: 2021-01-11T22:33:32.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-11T16:59:42.000Z (almost 2 years ago)
- Last Synced: 2024-10-01T23:16:42.206Z (about 1 month ago)
- Topics: cpp, extendedvector, foreach, list, std, vector
- Language: C++
- Homepage:
- Size: 184 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ExtendedVector
Increase your productivity and vector handling with just one header.
This project is the extension of `std::vector` from STL but based on .NET Framework `List`.
It means, that all of features and methods provided by `List` should also be available in the implemented `std::vector` extension: `Cx::Vector`.The goal of this project was to create the tool which will make the usage of standard `std::vector` even easier when it comes to complex yet typical operations done on collections which are currently not a part of the *vector* header, but require more includes and more LOC.
Please check the official documentation of [std::vector\](https://en.cppreference.com/w/cpp/container/vector) and [System.Collections.Generic.List\](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1?view=netframework-4.8) to see the two bases of this product and how it connects both of them.
---
## Installation & Usage ##To use this tool:
* Download the archived release package,
* Unpack the release package and place the main implementation's header (which is *Vector.hpp*) in any directory within your project (for example "*Dependencies*" or "*3rdParties*"),
* Include the *Vector.hpp* header in your implementation and call the `Cx::Vector` to instantiate the container.**NOTE:**
ExtendedVector already uses several other includes from standard library, such as the following:
*vector*, *iostream*, *algorithm*, *functional*, *array*---
## Documentation ##
This project fills the gap between the `std::vector` and `System.Collections.Generic.List` which means that it brings all the features already available in the `List` to the `std::vector`, making a `Cx::Vector` in result.
Each method implemented within the `Cx::Vector` corresponds to the same method in the `List` from .NET.
So to check the method's documentation in details please check the .NET's official documentation of `List` [methods](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1?view=netframework-4.8#methods) section.
The methods already available in the original `std::vector` are still available unchanged when using `Cx::Vector`.**NOTE:** Each method implemented in the *Vector.hpp* header are also covered with the *doxygen* comments (`///`), so each code editor supporting displaying them will show the method documented each time it is called within your code.
The presentation of some of the Cx::Vector abilities is done in the *Examples* project's source code files.
So to fully check the abilities of the ExtendedVector utility, please go to the [Examples](https://github.com/BartoszKlonowski/ExtendedVector/tree/main/Examples) directory.Below you can find just a short demo of what the *ExtendedVector* project is all about and what are the example benefits of using it:
```cpp
Cx::Vector vector;
vector.push_back( "Hello" );
vector.push_back( "World!" );
Print( vector );vector.clear();
Print( vector );vector = { "Elephant", "Cat", "Mouse", "Wolf", "Dinosaur", "Tiger", "Dog", "Eagle", "Cow", "Snake" };
Print( vector );auto animalsByCLetter = vector.FindAll( []( const std::string& animal )->bool
{
return animal[0] == 'C';
} );
Print( animalsByCLetter );vector.RemoveAll( []( const std::string& element )->bool
{
return element.length() > 4;
} );
Print( vector );vector.ForEach( []( std::string& element )
{
element = std::string("Animal:") + element;
} );
Print( vector );if( vector.Contains("Animal:Dog") )
std::cout << "\nIndex of 'Animal:Dog' is: " << vector.IndexOf( "Animal:Dog" ) << std::endl;auto indexOfCow = vector.IndexOf( "Animal:Cow" );
vector.RemoveAt( indexOfCow );
Print( vector );
```which gives the following output:
```
Printing Cx::Vector with 2 elements inside:
Hello World!Printing Cx::Vector with 0 elements inside:
Printing Cx::Vector with 10 elements inside:
Elephant Cat Mouse Wolf Dinosaur Tiger Dog Eagle Cow SnakePrinting Cx::Vector with 2 elements inside:
Cat CowPrinting Cx::Vector with 4 elements inside:
Cat Wolf Dog CowPrinting Cx::Vector with 4 elements inside:
Animal:Cat Animal:Wolf Animal:Dog Animal:CowIndex of 'Animal:Dog' is: 2
Printing Cx::Vector with 3 elements inside:
Animal:Cat Animal:Wolf Animal:Dog
```---
## Contributing ##
If you would like to contribute to the *ExtendedVector* project, you are more than welcome!
Any contribution is to make the project better and to improve the developer's experience.
So if you'd like to contribute, you can do this in one of the following ways:* Create an [Issue](https://github.com/BartoszKlonowski/ExtendedVector/issues/new) and let the author handle it
Each issue created in the [Issues](https://github.com/BartoszKlonowski/ExtendedVector/issues) section gives a chance of improving the project and make it even more useful.
* Create the [Pull Request](https://github.com/BartoszKlonowski/ExtendedVector/compare) with the desired changes
After a detailed review it will be merged.
Please remember to give the detailed description of why such change is needed, what is the test plan and what are the details of your implementation. This will make the review easier and quicker.
Please also remember to check the unit tests and implement additional tests in case of providing the project with some new features/new code.---
## Thank you! ##
If you like this project, or you find it helpful, please share your opinion with the author or just give it a star!