« first day (434 days earlier)      last day (2643 days later) » 

08:52
@sehe That I did :)
(I didn't just wake up btw)
 
2 hours later…
11:08
stackoverflow.com/questions/46276811/… Someone said that this was a "known problem with no solution", is this true?
If so how did boost do it?
nwp
nwp
Do what? Throw away type information and then recover it?
I think what n.m. means there is that you must have n*n overloads for operators for n types. You don't need to write them though.
That said I don't think implementing dynamic typing is the way to go.
@nwp You don't need n*n overloads, just n*n pieces of code to implement the operator. Can also be done with 1 function and n*n cases.
11:24
and maybe a few implicit conversions
@nwp What do you mean by "don't need to write them"?
nwp
nwp
@OneRaynyDay Use templates.
 
1 hour later…
nwp
nwp
12:48
@OneRaynyDay I made a thing for you that shows the template idea. That is one part of turning static typing into dynamic typing so that you lose efficiency and turn compile time errors into runtime errors.
I had fun making it, but I would not recommend actually using something like that.
You can regain some performance by replacing the map with a vector and you don't have to use std::tuple, but I'm fairly sure the compiler will not be able to inline any of the operators so that adding 2 ints will have like a 10000% performance penalty.
13:35
@nwp Dang, starred, that was a ton of effort man
Sorry for the late response, I was out :P I'm reading through it right now, but have a general idea of what you did :)
Okay before I really understand this, I need to understand decltype, declval, and what the heck "abi::__cxa_demangle" is
After looking at your code I feel like I know 0 C++
nwp
nwp
@OneRaynyDay The abi::__cxa_demangle is the "//not necessary" part. It makes it so you turn i into int and NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE into std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > which somewhat helps readability.
@nwp oooh huh I see :O
 
3 hours later…
nwp
nwp
16:39
How do I get colored text input? Say, running ls prints directories in blue and files in black. I can read the text output of ls using any of QProcess, fork, popen, ... but none of them seem to allow me to read the color.
@nwp ls is using isatty to detect whether it's sending output to the terminal or redirected, and so it decides whether to output formatted text or a plain newline separated list
You need to pass a flag to ls so it will always assume a terminal
nwp
nwp
Thanks, I'll try to research it.
Ideally it should work with any program.
I assume a way that would work with any program would involve emulating a terminal somehow and getting its output
nwp
nwp
In theory one could just look at the source of zsh/bash/... and see how they get output from programs.
13
Q: Write program that pretends to be a TTY

EthanI'm writing a program that reads input from stdin, manipulates the input, and writes output to stdout. However, many programs check whether stdin is a terminal or a pipe (by calling a function like isatty), and generate output differently. How do I have my program pretend to be a TTY? The soluti...

^ seems useful
nwp
nwp
16:49
cool, I'll try that
Apparently the magic lies in forkpty/openpty, at least in linux.
 
4 hours later…
nwp
nwp
21:05
Somehow this isn't enough. forkpty makes it so that isatty returns 1 and I mimicked the termios settings of zsh so that tcgetattr(STDOUT_FILENO returns the same settings, but I still only get plain text without any color control characters.

« first day (434 days earlier)      last day (2643 days later) »