Giter Club home page Giter Club logo

Comments (9)

felixguendling avatar felixguendling commented on May 18, 2024

I think the first step would be to go through string.h and replace each char occurrence by a template parameter indicating the character type. Then, it should be easy to defined a cista::raw::u16string as cista::generic_string<char16_t, char16_t*>.

Hardcoded positions like 15 as the last character should of course be computed depending on how many characters can be placed inline (within sizeof(generic_string)):

auto const pos = static_cast<char const*>(std::memchr(s_.s_, '\0', 15));

char s_[15]{0};

s_.is_short_ = (len <= 15);

etc.

We should also add tests to verify everything is working with the "new" string.

from cista.

Gringoniceguy avatar Gringoniceguy commented on May 18, 2024

I have looked into and this seems pretty complex and i dont know how to only say pass in const char* but also get char* and char, but why dont we just use std::basic_string and genric string dont they serve the same purpose?
They are able to create all the standard strings and would be much easier

from cista.

felixguendling avatar felixguendling commented on May 18, 2024

why dont we just use std::basic_string and genric string dont they serve the same purpose?

Basically, yes. However, it is possible that std::string in the libstdc++, MSVC std lib and libc++ have each a different binary layout. This makes it impossible to use as a serialization format which should be independent from the compiler and standard library combination you use. For serialization we need access to internal pointers, fields, etc. which may change in upcoming versions. The serialization approach of Cista can only be implemented in a stable and highly performant way for data structures owned by Cista itself.

from cista.

Gringoniceguy avatar Gringoniceguy commented on May 18, 2024

So what do you say to taking and modifying the code of the standard libary for highly fast and tried and tested motheoed and then remove any things that we dont need?

from cista.

felixguendling avatar felixguendling commented on May 18, 2024

Of which standard library? There are several implementations. They are all quite complex. I think this would be a lot of work. It would certainly be easier to just do some small changes to support u16string, etc. in Cista itself.

from cista.

Gringoniceguy avatar Gringoniceguy commented on May 18, 2024

Hm probably but i am not really sure how the libary works i have tried to change it but it seems quite difficult, i dont really know how to.

from cista.

Gringoniceguy avatar Gringoniceguy commented on May 18, 2024

Or well i do know how to the issue is i might need another template which would require alot of changes, Because i need the template also contain the base type i.e template<typename Ptr = const char*, typename Base = char> idk how to do this.

from cista.

felixguendling avatar felixguendling commented on May 18, 2024

I'll look into it.

Maybe for now, you can use cista::vector<char16_t>?

from cista.

Gringoniceguy avatar Gringoniceguy commented on May 18, 2024

Yeah i have tested this before just annoying having to use a vector and make a string from it instead of built in types, this will be fine for the time being i will just add todos foreach line.

from cista.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.