Skip to content

Commit

Permalink
adding some member types to vector container
Browse files Browse the repository at this point in the history
  • Loading branch information
RidaEn-nasry committed Sep 20, 2022
1 parent 6e930a1 commit dff6e36
Show file tree
Hide file tree
Showing 7 changed files with 2,783 additions and 12 deletions.
1 change: 1 addition & 0 deletions .#Makefile
2,725 changes: 2,725 additions & 0 deletions Doxyfile

Large diffs are not rendered by default.

Binary file added a.out
Binary file not shown.
1 change: 1 addition & 0 deletions containers/.#Vector.hpp
42 changes: 30 additions & 12 deletions containers/Vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,46 @@
/* */
/* ************************************************************************** */

/*
* @file Vector.hpp
* @author rida ennasry
* @brief Vector container re-implementation.
* @date 2022/09/20
*/


#ifndef VECTOR_HPP
# define VECTOR_HPP

# include <iostream>

/* The vector conatainer is implemented i
*
*
*/

namespace ft
{
template <class T, class Alloc = std::allocator<T> >
template <typename T, typename Alloc = std::allocator<T> >

class vector {
public:
// iterator class
class iterator {
public:
typedef T value_type;
/* value type member type */
typedef T value_type;
/* allocator type member type */
typedef Alloc allocator_type;
/* reference to allocator type member type */
typedef typename allocator_type::reference reference;
/* const reference to allocator type member type */
typedef typename allocator_type::const_reference const_reference;



private:
/* underlying array */
T* _array;
/* size of the vector */
size_t _size;
/* capacity of the vector */
size_t _capacity;


private:
T* _ptr;


}
private:
Expand Down
4 changes: 4 additions & 0 deletions notes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@



* member types defines the types used by the underlying container .
22 changes: 22 additions & 0 deletions practice.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

#include <iostream>

template <typename T, typename Alloc = std::allocator<T> >
class vector {
public:
typedef T value_type;
typedef Alloc allocator_type;

};
int main ( void )
{


//vector<int> v;
vector<int>::allocator_type alloc;
std::cout << "allocator type is : " << typeid(alloc).name() << std::endl;
return 0;

}


0 comments on commit dff6e36

Please sign in to comment.