Describe the bug
I tried to reproduce that example from the documentation, but it didn't compile.
auto email = sz::concatenate(name, "@", domain, ".", tld); // 0 allocations
auto email = name | "@" | domain | "." | tld; // 0 allocations
sz::string email = name | "@" | domain | "." | tld; // 1 allocations
Steps to reproduce
That source not compiled.
#include <stringzilla/stringzilla.hpp>
namespace sz = ashvardanian::stringzilla;
void stringzilla_concat(sz::string_view name, sz::string_view domain, sz::string_view tld) {
auto email = sz::concatenate(name, "@", domain, ".", tld);
sz::string result = email;
}
Error:
error: type 'ashvardanian::stringzilla::basic_string_slice<const char> &' cannot be used prior to '::' because it has no members
| using value_type = typename first_type_::value_type;
Need std::remove_cvref_t<first_type_>::value_type;.
That sources not comiled too
void stringzilla_concat(sz::string_view name, sz::string_view domain, sz::string_view tld) {
auto email = name | "@" | domain | "." | tld;
sz::string result = email;
}
Error:
error: invalid operands to binary expression ('sz::string_view' (aka 'basic_string_slice<const char>') and 'const char[2]')
| auto email = name | "@" | domain | "." | tld;
And that
void stringzilla_concat(sz::string name, sz::string_view domain, sz::string_view tld) {
auto email = name | "@" | domain | "." | tld;
sz::string result = email;
}
Error:
error: no viable conversion from 'concatenation<concatenation<concatenation<concatenation<basic_string_slice<const char>,
basic_string_slice<const char>>, basic_string_slice<const char> &>, const char (&)[2]>, basic_string_slice<const char> &>'
to 'sz::string' (aka 'basic_string<char, std::allocator<char>>')
And that
void stringzilla_concat(sz::string name, sz::string_view domain, sz::string_view tld) {
auto email = name | "@" | domain | "." | tld;
sz::string result{email};
}
Error
error: member reference base type 'const char[2]' is not a structure or union
| std::size_t size() const noexcept { return first.size() + second.size(); }
Expected behavior
Can compiled only that:
void stringzilla_concat(sz::string name, sz::string_view domain, sz::string_view tld) {
auto email = name | sz::string_view{"@"} | domain | sz::string_view{"."} | tld;
sz::string result{email};
}
or
void stringzilla_concat(sz::string_view name, sz::string_view domain, sz::string_view tld) {
auto email = sz::concatenate(sz::string_view{name}, sz::string_view{"@"}, sz::string_view{domain}, sz::string_view{"."}, sz::string_view{tld});
sz::string result{email};
}
StringZilla version
v4.6
Operating System
Windows 10, Clang19, C++20. Ubuntu 22.4, GCC-13
Hardware architecture
x86
Which interface are you using?
C++ bindings
Contact Details
orefkov@gmail.com
Are you open to being tagged as a contributor?
Is there an existing issue for this?
Code of Conduct
Describe the bug
I tried to reproduce that example from the documentation, but it didn't compile.
Steps to reproduce
That source not compiled.
Error:
Need
std::remove_cvref_t<first_type_>::value_type;.That sources not comiled too
Error:
And that
Error:
And that
Error
Expected behavior
Can compiled only that:
or
StringZilla version
v4.6
Operating System
Windows 10, Clang19, C++20. Ubuntu 22.4, GCC-13
Hardware architecture
x86
Which interface are you using?
C++ bindings
Contact Details
orefkov@gmail.com
Are you open to being tagged as a contributor?
.githistory as a contributorIs there an existing issue for this?
Code of Conduct