Nils
works! Thx!
Artöm
Note that if base is virtual neither is correct
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
Artöm
Nils
Hi, how do I specify C++ version in QT Creator?
Artöm
Or bss if a static varible is zero initialized
Sasuke
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 *'?
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
I am trying to 😅
Anonymous
scratch that. i was wrong.
Anonymous
Nils
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 😖
Nils
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
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
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
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
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
Nils
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
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);
}
}