Comments (9)
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)
):
cista/include/cista/containers/string.h
Line 301 in 4977b90
cista/include/cista/containers/string.h
Line 323 in 4977b90
cista/include/cista/containers/string.h
Line 83 in 4977b90
etc.
We should also add tests to verify everything is working with the "new" string.
from cista.
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.
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.
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.
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.
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.
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.
I'll look into it.
Maybe for now, you can use cista::vector<char16_t>
?
from cista.
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)
- Discussion: STL containers can actually be supported ? HOT 3
- Help: Serialization and inheritance (with standard layout classes) HOT 22
- Wiki Typo HOT 1
- Any plans for c++20? HOT 2
- cista_members() approach: serialize tuples properly HOT 2
- nigiri Branch entfernt HOT 1
- Dealing with Data Pointer Offset in Checked Mode HOT 4
- Documentation request: how to build and run tests HOT 6
- Silence clang specific #pragma directives for other compilers ? HOT 2
- Static type hashing of std::complex HOT 5
- Create a stable release branch HOT 5
- Missing const& specifier for return type
- Cleanup: static_cast for `adjustment` should be `offset_t` since `start` is that type
- Support storing trailing \0 byte at the end of string HOT 5
- Support for `resize` [perhaps also `capacity` and `reserve`] for cista::generic_string/basic_string HOT 2
- String gives different size at "empty" input for short/non_short HOT 1
- MSVC v14.1x build error: C2296,C2297 HOT 3
- How can I serialize a struct which contains anonymous union member HOT 2
- Bug in std_vector_test.cc HOT 1
- Support for std::visit HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cista.