Nils
works! Thx!
Artöm
Note that if base is virtual neither is correct
Anonymous
String parsing algorithm
https://en.cppreference.com/w/cpp/header/functional#Searchers
Sasuke
Static segment
And thats Data segment?
Artöm
Sorry I thought that was a question
Sasuke
I never heard about static segment There is only text, data,bss,stack and heap
Anonymous
https://en.cppreference.com/w/cpp/header/functional#Searchers
Thanks alot man, imma modify them according to my embedded needs
Nils
Hi, how do I specify C++ version in QT Creator?
Artöm
Or bss if a static varible is zero initialized
Anonymous
https://en.cppreference.com/w/cpp/language/reinterpret_cast#Explanation paragraph 5 "In any case, the resulting pointer may only be dereferenced safely if allowed by the type aliasing rules" https://en.cppreference.com/w/cpp/language/reinterpret_cast#Type_aliasing neither similar, signed/unsigned variant, nor is the aliased type char family/std::byte
Nils
Hi, how do I convert a C++ string to 'const unsigned char *'?
Anonymous
Hi, how do I convert a C++ string to 'const unsigned char *'?
std::basic_string<unsigned char> instead of std::string edit: this won't compile. char_traits doesn't have specialisation for unsigned char
Nils
I am using that it and it says it wants a 'const char *' to 'const lxb_char_t *' (aka 'const unsigned char *') for 2nd argument
Anonymous
then this
Nils
okay…
Nils
std::basic_string<unsigned char> instead of std::string edit: this won't compile. char_traits doesn't have specialisation for unsigned char
std::basic_string<unsigned char> rawhtml = httpcontent.str(); parsestatus = lxb_html_document_parse(document, rawhtml.c_str(), rawhtml.size()); Like this?
Nils
I am trying to 😅
Anonymous
scratch that. i was wrong.
Anonymous
What would I have to change?
you need to provide a custom specialisation of char_traits for your lxb_char_t type. then change the string to std::basic_string<lxb_char_t, char_traits<lxb_char_t>> or something like this. (the traits class is used for locale, comparison, searching etc)
Nils
ouch
Anonymous
neither did i 😖
Anonymous
i don't know much about inheritance yet. just started the chapter of C++ Primer. ;-;
Nils
Good idea!
Dima
I think we should ban for such links
Dima
/ban Mike tg link
Bunyamin
help please
Bunyamin
[Error] qualified-id in declaration before '(' token
Dima
which line?
Nils
is it okay to do variable.str().c_str() on a stringstream?
Nils
thank you…
Artöm
char8_t is not unsigned char
Nils
Hi, how do I pass a std::vector<GumboNode> without copying the object?
Nils
(How do I have to define the function thjat it should be passed to)
Nils
gumbo_search_by_class(std::vector<GumboNode> &elemvect, GumboNode* node, std::string searchword) Does not work
Nils
/home/nils/Programme/OSS/CommSyFuse/main.cpp:77: Fehler: invalid initialization of reference of type ‘std::vector<std::__cxx11::basic_string<char> >&’ from expression of type ‘std::vector<GumboInternalNode>’ 77 | gumbo_search_by_class(posts, document->root, "uk-comment-title"); | ^~~~~
Nils
No, the function expects std::vector<GumboNode>
Nils
gumbo_search_by_class(posts, document->root, "uk-comment-title");
Nils
posts is a std::vector<GumboNode>
Nils
I convert nowhere at all
Nils
I can send the source code if you want, probably I am doing stuff I am not supposed to…
Nils
But I see no conversion about it
Nils
https://hastebin.com/pewetacaga.cpp
Nils
yes.
Nils
OK I'll send full code now…
Nils
https://hastebin.com/ujosojoqor.cpp
Nils
https://hastebin.com/ujosojoqor.cpp
Try compiling this and you'll see the error. I have litterally no idea
Nils
That's what I tried before…
Nils
libcurlpp-dev libgumbo-dev 😉 But don't bother I'll continue asking in more C++ groups…
Nils
:-/
Nils
But how?
Francisco
libcurlpp-dev libgumbo-dev 😉 But don't bother I'll continue asking in more C++ groups…
They'll likely say the same. Unless you provide us a minimal complete example that reproduces your problem, that we can compile ourselves directly, you have no choice but debug yourself
Francisco
Or pay, you can always pay and someone would happily find the bug for you
Nils
Found! I just removed the "static" keyword and see there; error is gone
Nils
?
Nils
I'm too young 🙃
Francisco
No, I can't
Then you'll have to do it yourself, or craft a MCVE for us to help
Anonymous
oh
Katya
ppl don't you know what has happened with http://libchl.ml/ library?
Nils
thx
Artöm
With that said they are different types
Artöm
So traits specialization will be provided for char8_t abd not for unsigned char
Anonymous
is this wrong? Limited_bulk_quote inherits from Bulk_quote which in turn inherits from Quote
Dima
that notation o.O
Anonymous
Dima
that one is combined lol
Anonymous
that one is combined lol
nu ;-;. snake_case for everything. Snake_case for class names
Anonymous
oh okay
Anonymous
there is an alternative - there is a protected member in Quote called price and since I used public inheritance throughout the chain, it should be accessible in Limited_bulk_quote. Now technically price is a protected member of Limited_bulk_quote but in reality, to use that member I have to look up the inheritance chain anyway
Anonymous
so I was wondering how different it would be using price instead of Quote::net_price()
Anonymous
> So technically everything that you need in Limited_bulk_quote would be available either in that class itself or from Bulk_quote. but that is my question. price is protected in Quote and Bulk_quote uses public inheritance to inherit Quote, this means that price is a protected member of Bulk_quote too. but do i consider it as a member coming from Bulk_quote when using it in Limited_bulk_quote? or do I consider it coming from Quote?
Anonymous
no. it is a variable (double) only defined in Quote
Anonymous
no. net_price() is the virtual function that i am overriding double Quote::net_price(std::size_t n) const { return n * price; } double Bulk_quote::net_price(std::size_t cnt) const { if (cnt >= min_qty) { return Quote::net_price(cnt) * (1 - discount); } else { return Quote::net_price(cnt); } } double Limited_bulk_quote::net_price(std::size_t cnt) const { if (cnt <= max_qty) { return Bulk_quote::net_price(cnt); } else { return Bulk_quote::net_price(max_qty) + Quote::net_price(cnt - max_qty); } }