gagolews / gagolews/DataStructures

Nice interface by classes

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Description

I think it would be nice to have something more convenient than bunch of methods like vector_push_back() or queue_pop(), where external pointer is needed as an argument. More readable would be something like vector.push_back(6).

And my proposition is like that:

```

dsVector <- setRefClass("Vector",
fields=c("vec"
),
methods = list(
initialize=function(n=0)
{
vec <<- vector_create(n)

},

push_back=function(obj)
{
vector_push_back(vec, obj)
},

back=function(obj)
{
vector_back(vec)
},

front=function(obj)
{
vector_front(vec)
},

size=function()
{
vector_size(vec)
}

))
```

and usage;

```
vec2 <- dsVector$new(5)
vec2$size()
vec2$push_back(1)
vec2$front()
vec2$back()
```

My only concern is how to make indexer, like "vec2[3] = 5", but I think it is possible in one way or another.

OK, maybe another concern: how to do something like as.character(vector) or print(vector).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.