Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- adt Twine{
- Null
- CStr(cstr:ptr u8)
- StringView(view:string_view)
- Twine(lhs rhs:ref Twine)
- method length(self:ref Twine):uword{
- switch(self){
- case Null: return 0;
- case CStr(cstr): return strlen(cstr);
- case StringView(view): return view.size();
- case Twine(lhs, rhs): return lhs.length() + rhs.length();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement