« first day (2122 days earlier)      last day (2829 days later) » 

1:41 PM
Heey.
My __PRETTY_FUNCTION__ demangling isn't too shabby.
Maybe I can ditch using RTTI for this part too.
Well, er. FUNCSIG for VC++. Still have to do __PRETTY_FUNCTION__
What do I replace anonymous namespace with though?
Maybe I just delete it and make it so there's a double ::
That's kind of a crappy indicator though.
Accurate, but crappy.
Oh, wait. I'm not testing a template class inside of a template class.
> muh_namespace::'anonymous-namespace'::ns_anon_test_t<muh_namespace::'anonymous namespace'::ns_anon_test_t<int> >
Seems accurate
 
<anonymous-namespace> would look nicer, IMHO
 
I just ended up deleting it.
So there's a bunch of :::: in there.
 
Confusing. :P
 
Probably... but.
 
Make it at least <anon-ns> or something.
 
1:52 PM
Shrug
 
(If you think that the whole thing is too long.)
 
It's not really about being long, so much as those characters can't be vomited out into a C++ source file and be accurate.
Huh... I wonder how you add an anonymous namespace in a nested namespace id
namespace a::::b {} ... ?
Sounds like that'll trip a bunch of compilers up.
 
2:08 PM
@ThePhD I've been more wondering about inline namespaces with that syntax. :D
namespace a::b::inline _v1::foo {}? :D
(I admit to never having read the proposal for this nested syntax thing.)
 
Ell
aghh
I keep making mistakes in my matrix calculations :V
 
2:23 PM
Not too shabby.
Let's hope clang/gcc keep their PRETTY_FUNCTION consistent between versions...
 
Xeo
> name.erase(name.begin(), ++name.begin());
please use std::next and std::prev for that...
 
Is that really so heinous?
 
Xeo
it seems weird, since you're modifying an rvalue
also, there's the single-position erase form too, so yeah.
 
TIL.
 
Xeo
while (!name.empty() && std::isblank(name.front())) name.erase(name.begin());
while (!name.empty() && std::isblank(name.back())) name.pop_back();
eww, are those tabs?
 
2:28 PM
M... Maaaaybe?
 
Xeo
better idea instead of the loops and single-erase is prolly to scan for the last occurence from the beginning / end and range-erase that
 
Uugh, but then I have to rewriiite.
Besides I don't think find_last_of takes a pred...
 
@ThePhD find_if with reverse iterators?
 
Xeo
also, is there even a chance of there being blanks in the front / back?
 
Yes, unfortunately.
This code is written as a gradual evolution of dealing with the different mangled schemes.
 
Xeo
2:32 PM
In all your tests, there's a single one in the front
which could easily be eliminated in other ways, I'd think.
 
Probably. Maybe I could better target the start/end spaces when I first pull out the initial typename chunk.
The good news is, I don't need cxxabi.h or cstdio in this header anymore.
Cross platform-ness++
 
Xeo
if (start < name.size() - 2)
    start += 2;
:P
although that part in general is increadibly dirty
 
Won't that overshoot for the ones that don't have the extra space?
 
Xeo
are there ones that don't?
 
I am unsure.
So far, no.
 
Xeo
2:36 PM
you should prolly just look for the T = part and start directly after that (note the space at the end)
 
user406009
@ThePhD But it's not cross platform or cross compiler at all really.
 
user406009
I mean, why are you even trying to do this?
 
user406009
Putting this sort of thing anywhere in a codebase is just asking for things to fail without much warning.
 
Because using cxxabi.h on Windows with Clang can lead to nightmares where __clang__ is detected but it doesn't have cxxabi.h.
 
user406009
Yeah, but why do you need the full name of the class?
 
user406009
2:38 PM
Why can't users just specify it themselves?
 
They can.
But for the lazy, they play Russian Roulette with the system.
 
user406009
I still think this is horrible.
 
user406009
It is going to break at the most inopportune time.
 
It also makes errors easier to diagnose when user types go wrong ("ns_a::ns_b::my_class indexing failed").
@Lalaland cxxabi and clang have already been broken.
Not just on Windows
But because Apple can't stop themselves from introducing retarded regressions in the code.
 
user406009
@ThePhD There are much better ways to deal with this.
 
2:41 PM
Luwra takes the easy way out and does Luwra#<Some Big Ol' Integer> to name classes, but nobody knows WTF that is and it makes debugging harder.
 
user406009
Like you could show errors at the point where they insert/create the class if possible.
 
user406009
Or let people specify the names themselves.
 
user406009
Or allow people to pass in an error callback when they register the class.
 
People can do all of the above. This is the fallback case.
 
how do i get the currently used member of a boost::variant?
 
user406009
2:44 PM
Then it seems like an unnecessary foot-gun which will add complexity and chances of failure at no benefit. But that's your choice.
 
Xeo
read the docs?
 
visitors only return one type, but i want to return the object inside the variant
@Xeo i wish it was there
i can't boost::get<this->type()> since templates arguments must be known at compile time
 
switch (variantobj.current_index()) {
     case 0: // is first type
     break;
     case 1: // is second type
     break;
}
 
Xeo
Wait, you want something like auto var = variant.get_active()?
Because that's not possible.
 
user406009
@ChemiCalChems You use boost::get. See boost.org/doc/libs/1_61_0/doc/html/variant/…
 
2:45 PM
Not sure if current_index() is the name of the function.
 
Xeo
types are determined at compile-time, active member is determined at run-time
@ThePhD which
 
@ThePhD it's v.which() yeah
@Lalaland i know i use boost::get, but that's only if i statically know the type i want to get
 
Either use a visitor to narrow it down or a switch.
Either way, you need to make a runtime decision and then do the compile-time stuff with boost::get when you figure it out.
 
@ThePhD can the visitor return different types based on what the type is?
 
No.
 
Xeo
2:47 PM
No.
 
@Xeo Already said this.
 
Xeo
What you want is not possible directly
 
well fuck
it can't be done at all?
 
Nope.
 
Xeo
Think about it. And then think some more.
 
2:49 PM
if fucking templates didn't need their arguments at compile time...
 
then they wouldnt be templates
 
Xeo
@ChemiCalChems Templates don't matter.
Types matter.
 
making an auto returning function doesn't work either
cause it can't figure out the type
 
Xeo
4 mins ago, by Xeo
types are determined at compile-time, active member is determined at run-time
You're trying to make a type-decision at run-time, it can't work.
 
@Xeo well, i just need get the damn active member
 
2:50 PM
You only know that at run time
 
Xeo
And you can't get it out of the variant / visitor mechanic. Now think. And then some more.
 
i know i can do a switch with v.which, but i want to wrap that somewhere
 
I smell an X/Y problem.
 
Visitor?
 
@ThePhD no, because that won't return more than one type
 
Xeo
2:52 PM
why do you want to return it
do what you want inside the visitor
 
@Xeo because i want to work with the object
 
you work with the object by applying the visitor
 
@Xeo i did think about that, but i'd need a lot of different visitors
 
so?
 
Xeo
well duh
 
2:53 PM
vOv
 
Xeo
do all types have the same interface?
if so, make the visitor templated
 
@Xeo they do have the same interface, yes
@Xeo how to do so?
 
Xeo
Well, problem solved!
 
oh shit
got it got it
no i dont got this
 
you template the operator() of the visitor
 
2:55 PM
No, you template the operator() of the visitor!
 
I think my short_demangle_once is broken.
 
@Borgleader what good would that do?
 
Xeo
[](auto& v){ /* do stuff */ } even, if your compiler is up-to-date enough
 
@Xeo IIRC boost requires result_type typedef on class and such.
 
Xeo
@ThePhD no
 
2:56 PM
Oh, well nevermind then. :B
 
Xeo
@ChemiCalChems okay, at this point, you either provide a self-contained example or I'm out.
 
^
@Xeo you can apply visitor witha lambda?
 
std::vector<boost::variant<A,B,C>> test; //All A, B and C have a member called position
 
Xeo
self-contained example
 
@Xeo i'm on it
 
Xeo
2:58 PM
aka write actual code on coliru or somewhere
 
ok brb
 
GDI
I need to smart parse for the short name.
 
Xeo
lol
 
So I need to parse from the back.
 
Xeo
hf with that
 
3:01 PM
If i detect I'm in a <>, I stop parsing until I reach the <
I turn it back on again after and when I see the first :, I return everything to the right.
Okay, shouldn't be too har- waait, what if it's nested?
 
Xeo
@ThePhD remember the level
 
Aww man I have to keep a running count of <>
@Xeo Yeah
 
Xeo
No compiler sees test_t<(a < b)> and keeps the a < b part for demangling, right?
 
It gets turned into boolean and coerced to whatever template value test_t asks for, yeah.
 
Xeo
hmmm
now I'm curious...
 
3:04 PM
@Xeo Nooo, don't spend your Sunday on this!
 
Xeo
 
@Xeo sobbing noises
Why, though?!
 
Xeo
wahahaha
@ChemiCalChems gimme a minute, and then I'll take a look at it
 
@Xeo sure, thanks
 
user406009
3:08 PM
@ThePhD I mean,` __PRETTY_FUNCTION__` is pretty much the definition of implementation defined.
 
@Xeo That's not even remotely fair.
 
user406009
Trying to use it for anything is asking for everything to break.
 
Xeo
there's two problems even
 
@ChemiCalChems Earlier you said they had the same interface
they dont
 
Xeo
clang drops the scopes, and then the operator< itself for g++
 
3:09 PM
@Borgleader ok, no they don't i fucked up because i didn't know what you were talking about and i assumed i did
excuse me
 
boost::apply_visitor
 
Xeo
Yeah, that one's only solvable with a visitor, really.
You need to discriminate on the types.
 
@Xeo so make a boost::static_visitor<void>?
 
Xeo
visitor with two overloads for A and B
 
@Xeo yeah, makes sense
oh well
thanks a lot everyone
 
and sorry for my stupidity
 
^ That's the simplest one.
With just a plain switch.
 
terrible
 
:B
 
Xeo
@milleniumbug make_lambda_visitor is basically overload, i.e. aggregates all operator() passed?
 
3:12 PM
@Xeo yep
 
Xeo
Then I'd name it overload :P
 
@ThePhD No! You need to be punished :3
Bad! :3
 
Sob it's just a switch...!
 
Its just a goto... until the SSL bug happens
 
3:14 PM
thanks bois
let's make about 3000 visitors
meh, maybe 10
 
its code youd have to write anyway, its just wrapped in a type now
 
@Xeo it also provides result_type member type, but that's a minor point
 
Xeo
what you should really do is rethink your code structure
 
@Borgleader true
 
Xeo
@milleniumbug not necessary in C++14, so eh.
 
3:15 PM
@ChemiCalChems and if they do have the same interface, you could template the operator()
 
Xeo
actually even in C++11 it shouldn't be necessary
 
well fuck
 
Xeo
why for example do you stuff them in a single vector and erase type-information, if they need to do different stuff anyways?
 
Grumbles.
How many different operators include < on it?
 
@Xeo because they are all soldiers
 
Xeo
3:17 PM
@ThePhD 2?
 
but some soldiers have flame throwers and others dont
 
Xeo
operator< and operator<=
 
@Xeo Just < and <<?
 
that's basically it
 
Oh right <=, crap.
 
Xeo
3:17 PM
oh, that too
 
This parser is getting nuts.
 
Xeo
<, <=, <<, <<=
4 then
 
... The fuck is <<= for?
 
Xeo
assignment?
 
Rightshift assignment?!
 
Xeo
3:17 PM
lshift assign
 
I've almost never seen that.
 
Xeo
a <<= b
but it's there
chat is throttling me
why chat
 
@ThePhD a <<= b is a = a << b where a is evaluated once
 
Xeo
> You can perform this action again in 6 seconds
 
assuming for built-in types
 
Xeo
3:18 PM
@ThePhD btw, operator> and co. will pose the same problem
it will make your parser think you're a level deeper than you are
 
@Xeo So I need to look-ahead for 8 different operators.
 
Xeo
maybe you, too, should rethink your approach :P
 
Unnnnfgh.
But C++ doesn't have a plain type name getter anywhere. :<
And cxxabi is bugged on claaaang.
 
Xeo
Doesn't solve the problem that Clang only gives Y for the nested type anyways
 
What am I supposed to dooo.
 
Xeo
3:20 PM
@ThePhD Cry in a corner :>
 
user406009
@ThePhD Try not supporting this feature?
 
user4959035
Hey, C++ guys! What do you think about C#? Do you like it? Is better, than C++ or worse? I want to hear your opinion.
 
I like C#
but you can't always use C# when you can use C++, so you can't say it's "better"
 
@MatthewTipton Oh. I actually already wrote about what I think of C#. The link is here.
 
user4959035
@milleniumbug What are there situations exactly? Driver development?
 
3:25 PM
Bare-metal programming is a good example, yes
so is OSdev
and all the low-level stuff
 
user4959035
@ThePhD Not visible, can you review your link? Seems to be it's broken.
 
+ writing C# on non-windows systems, while not impossible, is awkward
 
user4959035
@milleniumbug dotnet core is cross-platform
 
user4959035
it's not classic .net
 
user4959035
and it's not a mono
 
user4959035
3:27 PM
also there is something called .net native (but I don't understand, does it relate to the dotnet core or not)
 
@MatthewTipton and it's a subset of .NET features
 
user4959035
3:47 PM
@milleniumbug Also, interesting. How do C++ developers implement IoC (Inversion of Control)? You're able to do this using interfaces in C#.
 
WTB break N;
 
user406009
@MatthewTipton Uh, you can have interfaces in C++ as well.
 
@ThePhD No you don't
 
@milleniumbug I do.
 
@ThePhD its called return
 
3:55 PM
return is break MAX;
 
@MatthewTipton Uh, you don't "implement IoC". IoC is not the goal, IoC is a mean of achieving the goal.
 
And I don't feel like making a lambda just for some extra scope.
 
@MatthewTipton Also what Lalaland said
there's no need to have a distinction between abstract class and an interface if you can derive from multiple abstract classes
 
user4959035
@Lalaland As I remember, native C++ implementation doesn't have interfaces. I has virtual classes as I remember. And Visual C++ (CLI/C++ or Managed C++) does have the interfaces.
 
In C++ you can have "interfaces" by not having data members inside your abstract class
 
user4959035
3:58 PM
@milleniumbug I don't now about the C++ variant, but in C# if you use abstract class instead of inteface, then your will ruin composition
 
u w0t m8
@MatthewTipton well because you can derive from one class and implement multiple interfaces in C#
 
Ell
@MatthewTipton why does that ruin composition?
 
wow this code is shit
just as I expected
 
qq
 
4:05 PM
@ThePhD why are you not using regex?
 
I'm not dragging in a regex dependency for this.
 
@ThePhD #include <regex>?
 
> not draggin in a regex dependency for this
I support compiler versions as far back as 4.6
Regex is terrible on those machines.
 
@ThePhD ok, gotcha
 
<regex> and Boost.Regex are a no-go.
 
Ell
4:07 PM
Inb4 I'll write my own regex library
 
does overloading operator-> on an object affect its pointer type or just the object?
 
you cant overload operators on basic types, that includes pointers
 
@Borgleader thanks
 
@Xeo I DID IT!
HAH! There will be no corner-curling-up for me!
I AM DAS CHAMP.
 
Xeo
@ChemiCalChems hahaha, there's another operator with an angle bracket cc @ThePhD
 
4:21 PM
@ThePhD curling curling curling curling curling curling
 
@Xeo .... Fffffffffffffffffff
 
@Xeo lol
 
Xeo
and psst, there's yet another one
operator->*
 
Ell
eh
what are you doing @ThePhD?
 
... What the hell operator is that.
 
Xeo
4:22 PM
mem-ptr
 
Ell
I mean, why are you demangling stuff?
 
Xeo
btw, what does your parsing code do if there's an operator[] in there?
 
Uh. Nothing?
 
why the flying fuck are you trying to demangle mangled names?
 
Xeo
std::size_t start = name.find_last_of('[');
that would prolly fail :D
or if there's an array type, too
 
4:23 PM
@Puppy They're not exactly mangled...
They're just implementation-specific doodads.
 
wat.
 
user406009
@Puppy He wants to provide good error messages to the user.
 
why should this involve demangling names?
 
4:28 PM
At least it's correct on VC++.
 
user406009
@Puppy Because all other options would require a slightly worse API.
 
Ugh. How do I make sure I do this right...
BETTER
Okay.
I think that's all the corner cases.
 
user406009
@ThePhD Did you try the intel compiler yet?
 
>_>
No.
 
4:37 PM
And the Intel Compiler isn't officially supported.
Because fuck them. D:<
 
user406009
Well, that's the game of relying on implementation defined behavior.
 
4:49 PM
@ThePhD Why no Boost demangle?
 
@Morwenn Can't take dependency.
 
Copy-paste the fuck out of it then?
 
Xeo
@ThePhD You seem to be dropping some scopes in the GCC case, mate: coliru.stacked-crooked.com/a/62c2f0402ee36b91
oh wait, that's the short demange, isn't it
 
Yeah.
Short just gets the final typename.
 
Xeo
Hmm
 
4:52 PM
Er. Final... shortest...
 
Xeo
okay, back to the drawing board on how to break this
 
Most un-qualified name?
Nooo, stoppit, my poor heart. ;~;
 
I mean, demangle is in Boost.Core. The code shouldn't have dependencies (maybe Boost.Predef or Boost.Assert) so copy-pasting it should be triavial.
 

« first day (2122 days earlier)      last day (2829 days later) »