Sam
Jesvi
www.google.com
Mohit
Hi friends how to create our own header file?
Anonymous
Isn't first one requires is requires-clause and the second one is requires-expression?
Asdew
#ot
Anonymous
/get cppbookguide
Anonymous
hey im taking a class in mutithreaded programming and i have an exercise where i dont have any clue to what i should calculate there.
Anonymous
Anonymous
if somebody could tell me what is meant by average delay there that would be great :)
Anonymous
What i did for now is just to program both cases out and perform benchmarks for various things lilk the total computing time, the time it takes to switch threads etc. but when i had a second look this doenst seem to be what was asked for
Francisco
Isn't first one requires is requires-clause and the second one is requires-expression?
Yes, but if you're going to use a requires-xpression along with a requires-clause, you'd better define a concept for that requires-expression
Francisco
For example, I'd do: template <typename T> concept dereferenceable = requires (T t) { t.dereference(); };
Francisco
Yeah, that's what I'm saying
Francisco
For me it's more readable defining a concept than using an inline requires-expression
Anonymous
Ohhhh thanks. Got that completely wrong
Anonymous
Yeah that isnt possible unfortunately :/. But thats the way i saw it at first but that would be the administration time right? And in the exercise there is stated that we should ignore that. But since i already calculated that i can inclufe that as well as a footnote. Again thank you so much for your 1st interpretation. I think that is what he meant :)
Dima
/ban @KMRSOFT_9 python + ad + not approved + read the rules
Dima
I warned you already, but python people can’t read it seems
Emir
Is this work on mac os, but it isn’t work on windows, why is that? https://paste.ubuntu.com/p/ZrHSCkCGTb/ studentx txt file is 8 line, in windows loop just one cycle
Dima
maybe because of file format?
Dima
I mean next lines etc
Emir
Emir
File is this
Emir
File is this
windows just created VIANNEY.txt and it’s empty. Mac os 8 files created
Emir
Emir
These are other files
ʎpoqǝɯos ǝʞɐℲ
Say hi if I r not dumb
Anonymous
Код: template <typename T> void foo (T arg) requires { arg.method(); } {} Компилятор (GCC 10.1 с -std=c++20): source>:2:10: error: missing additional 'requires' to start a requires-expression 2 | requires { arg.method(); } | ^ | requires Так что тот товарищ неправ
Anonymous
Francisco
Which parenthesis?
Anonymous
int main(int argc, char **argv) { return argc; }
Anonymous
Done what was so difficult?
Anonymous
If you want to avoid a compiler warning
Anonymous
int main(int argc, char **argv) { (void)argv; return argc; }
Anonymous
template <typename T> void foo (T arg) requires arg.method(); {} vvv <source>:2:13: error: use of parameter outside function body before '.' token 2 | requires arg.method(); | ^ <source>:2:13: error: expected initializer before '.' token <source>:3:1: error: expected unqualified-id before '{' token 3 | {} | ^
Francisco
I think this is the way when defining a concept, as there's no variable name yet, in contrast with a function, where you already have the argument name
Anonymous
template <typename T> void foo (T arg) requires (T arg) { arg.method(); } {} vvv <source>:2:13: error: expected primary-expression before 'arg' 2 | requires (T arg) { arg.method(); } | ^~~ <source>:2:12: error: expected ')' before 'arg' 2 | requires (T arg) { arg.method(); } | ~ ^~~~ | )
Nameful
Do you guys know any high-level crypto libraries usable with C++ that have decent documentation?
Nameful
GPGME's is lacking in examples
Anonymous
Is there any short way to prepend to a string without using a second variable?
Anonymous
str_to_prepend_to.insert(0, prefix)
error: request for member 'insert' in something not a structure or union
Francisco
error: request for member 'insert' in something not a structure or union
So you are using C, right? And you're talking about const char*, right?
Francisco
Then you have to use strcat
Anonymous
Then you have to use strcat
But it's for appending. I want to prepend.
Francisco
But it's for appending. I want to prepend.
You can shift right as many positions as characters are in the string you want to prepend in the original string, and then do a memcpy
Francisco
The problem is if b is not a variable but a pure c-string
Francisco
For example, doing strcat(str, str2); or strcat(str2, str); is okay, but strcat(str, "Some string"); is okay while strcat("Some string", str); is a compile error
Anonymous
You can't exactly edit it
Anonymous
Nothing different from what @fgallego96 said. char st[100] = "world"; char st1[10]= "hello "; Trying to prepend so that st stores "hello world". Cannot append to st1 because it's too small.
Francisco
I guess in the memmove you wanted to write strlen(st1), am I right?
Francisco
Okay
Anonymous
Okay thanks
Anonymous
/get ide
NXiss7
Hey everyone. Is there a reasonable way to store sensitive data in memory?
Anonymous
/get eBook
Anonymous
/get cbook
NXiss7
Encryption
On memory? I'll store user password.
Francisco
On memory? I'll store user password.
Yes. If the data in sensitive, and you don't want people to read it easily, your best option is to encrypt the data, so a potential attacker can't get the original message without masive computational power
NXiss7
Yeah, thanks. Does OpenSSL AES objects store keys encrypted?
Francisco
I have no idea because I haven't used it, but OpenSSL is pretty common in security stuff, so you may find what you want in the official documentation
NXiss7
Yeah, thanks. Does OpenSSL AES objects store keys encrypted?
I couldn't decide if memory encryption worth the effort or not. If OpenSSL stores the key in plaintext it has no meaning...
Francisco
I couldn't decide if memory encryption worth the effort or not. If OpenSSL stores the key in plaintext it has no meaning...
The point is not where it is stored, but how. It may be stored in plaintext (as everything in an OS), but is not the same storing "my_password1234" as "vnu93n0b4h", for example
MᏫᎻᎯᎷᎷᎬᎠ
How does if constexpr really works internally?! Is there any generation of function when the second constant boolean expression takes a new branch?
Anonymous
When it's not used it can ill-formed code of some kind (not too much ill-formed)
MᏫᎻᎯᎷᎷᎬᎠ
When it's not used it can ill-formed code of some kind (not too much ill-formed)
I mean If two branches are meant to be generated Does that mean one function has a two set of instructions for execution determined at compile-time?!
MᏫᎻᎯᎷᎷᎬᎠ
Is that even possible It's like saying:"I'm bad but Good"
Anonymous
Because if constexpr is just а good-looking sfinae
MᏫᎻᎯᎷᎷᎬᎠ
I think there just two separate functions
Yeah The only logical explanation I can think of Two overloaded functions
MᏫᎻᎯᎷᎷᎬᎠ
Because if constexpr is just а good-looking sfinae
And it eases the use of variadic templates
MᏫᎻᎯᎷᎷᎬᎠ
Past you need to overload the function in a recursive manner