1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: re-apply C++ support

This commit is contained in:
Uwe Krüger
2020-05-18 21:38:06 +02:00
committed by GitHub
parent 895cefe351
commit 2635be511f
33 changed files with 261 additions and 150 deletions

View File

@ -122,8 +122,8 @@ fn (a string) clone_static() string {
pub fn (a string) clone() string {
mut b := string{
len: a.len
str: malloc(a.len + 1)
len: a.len
}
for i in 0..a.len {
b.str[i] = a.str[i]
@ -399,8 +399,8 @@ fn (s string) ge(a string) bool {
fn (s string) add(a string) string {
new_len := a.len + s.len
mut res := string{
len: new_len
str: malloc(new_len + 1)
len: new_len
}
for j in 0..s.len {
res.str[j] = s.str[j]
@ -537,8 +537,8 @@ pub fn (s string) substr(start, end int) string {
}
len := end - start
mut res := string{
len: len
str: malloc(len + 1)
len: len
}
for i in 0..len {
res.str[i] = s.str[start + i]
@ -1284,8 +1284,8 @@ pub fn (s string) reverse() string {
return s
}
mut res := string{
len: s.len
str: malloc(s.len)
len: s.len
}
for i := s.len - 1; i >= 0; i-- {
res.str[s.len - i - 1] = s[i]