« first day (2143 days earlier)      last day (693 days later) » 

2:58 AM
Has anybody used Andriod ADB from C++? Is there any library could be used to achieve this goal?
 
 
5 hours later…
7:40 AM
Can someone explain to me what is this in winnt.h
typedef _Return_type_success_(return >= 0) long HRESULT;
how can I read that line of code_ what does it do_
 
that looks like SAL annotation
so just read it as
typedef long HRESULT; and you're good
 
why is this so completed my gof
 
 
1 hour later…
8:47 AM
@PeterT Thanks, I went out and read about it. so the "_Return_type_success_(return >= 0)" is nothing but mombo jumbo with no efect, just a texr
 
It's there for static analysis in some compilers
but ignoring it shouldn't change behavior
 
nwp
9:13 AM
9 messages moved from Lounge<C++>
 
 
3 hours later…
11:57 AM
hey all, can anyone tell why my set of tuples is not working? std::tuple<int, int> t (1, 2); std::unordered_set <std::tuple<int, int>> {t};
something like std::unordered_set <int> {1, 2}; works for set of integers, so I tried to use the same for set of tuples
 
nwp
There probably is no hash function defined for tuples.
Even though there should.
Add that function and it should work.
Sadly the hash interface is bad, so combining hashes correctly with std::hash is impossible.
 
this just got a lot difficult that I assumed it would be
 
nwp
Welcome to C++
Personally I'd just remove unordered_ and call it a day.
Because unlike std::hash, operator < can be combined correctly just fine.
 
you gotta be kidding me, that actually worked
I understand I lost the constant lookup but meh
 
nwp
It's not actually constant lookup, it's just a lie that keeps perpetuating, so you didn't really lose anything.
If performance really matters you will probably not be able to use standard containers anyways.
 
12:12 PM
worst case linear, yeah? but the average is still constant ain't it
 
nwp
It's not. It turns out random array access is not constant and hash tables rely on that.
 
so how does one figure out, that not using unordered is the solution
looking at docs I assume
 
nwp
It's one of the solutions. It's also arguably the lazy solution. The proper solution is that you know that std::unordered_set is a type of hash table, that hash tables rely on a hash function, that the error message tells you that no such hash function exists and that you can supply your own.
 
makes sense, but tbh, I had a hard time figuring out where the error is in that huge message I got
but thanks, looks like I am not getting this done by today lol
 
nwp
From the docs you'd read the documentation on std::unordered_set, note that it has std::hash<Key> as a template argument and then see that std::hash has no default implementation for std::tuple.
 
12:19 PM
is deleted the right word there? "use of deleted function" that makes it seem like it is something that is deleted, I would expect missing / not implemented
I am not questioning the error message, that would take me no where, its just that I cant wrap my head
the designers surely had a reason which I fail to understand
 
nwp
Those are different things. Deleted functions are functions that are explicitly deleted. They take part in overload resolution but cause an error when you try to call them.
 
ok, now I am getting somewhere with this explanation
 
nwp
An example would be void f(int){} and void f(double) = delete;. If you try to call f(3.14); it will fail to compile. If the second overload doesn't exist you instead get an implicit conversion from double to int.
They probably just did template <class T> std::hash(T) = delete; in order to improve the error message. Otherwise you would get a linker error telling you that it didn't find std::hash<T> at a later time.
 
so this is more like blacklisting?
may not be the right technical word
 
nwp
Basically, yeah. It originated from classes. C++ wanted to be backwards compatible with C, and in C you can assign structs, so in C++ you have to be able to do that too. So they gave structs default copy constructors and then the question comes up how you would get rid of those, so they added this = delete syntax which is also sometimes useful for other things.
One could argue that C++ is a series of unfortunate accidents that made sense at the time.
 
12:27 PM
so its not one of those languages where you can just learn the current version and hope things make sense
most things I google I am left with 10+ tabs on the topic and I just close them
 
system(“canberra-gtk-play -f mySoundFile.ogg”);
Leads to an error saying: “failed to play sound: Not available”
Any ideas?
 
nwp
Hmm, I wouldn't say that and I would definitely not learn older versions.
 
I am doing this call as sudo inside my application
 
thanks for the solution and your replies nwp
 
@LandonZeKepitelOfGreytBritn don't use system
 
12:29 PM
what else? I just want to quickly play a tone, nothing fancy and I dont care about cybersecurity here
 
nwp
Depending on what type of learner you are you might be happy enough to know that deleted functions exist and how and when to use them. Or you try to look up why they exist in order to remember them better.
 
Having a library like gstreamer or whatever is absolute overkill here
 
nwp
The latter tends to be difficult though. Often times "because the standard says so" is the best you get outside meeting minutes and then things become a lot of effort for not much gain.
@LandonZeKepitelOfGreytBritn Does it work in a terminal?
 
Yes, but not when I am sudo
 
@nwp I guess for now I am going to go with they exist and do something
 
12:32 PM
yet everybody has all accessess to this soundfile
 
nwp
So it has nothing to do with your application, it's just that canberra-gtk-play refuses to run under root privileges?
 
 
9 hours later…
9:58 PM
What exactly does initializing git-flow do? If you are cloning a repo, why would it be a necessary step since wouldn't the repo already be structured in the appropriate way?
 

« first day (2143 days earlier)      last day (693 days later) »