#compacting macros
146 messages ยท Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
I think repr has a cursed macro for that
o nvm it's not finished https://github.com/Tsche/repr/blob/master/include/librepr/reflection/detail/visit_aggregate.h but I think @tawdry badger had a godbolt with some macros intended for it
o
@tawdry badger can you share pls?
might of been @dapper garnet 's
haha yes bring in more people to this thread
@empty marlin show them
lol
No, I use empy to codegen the nasty shit. The only macro ways are either the boost pp way (hand written incdec macros to count up) or a beautiful but exp time solution baconheadcrab came up with that counts in unary
my goal here is to be able to generate as many overloads of this function as is reasonable using only macros
because no external tools or prior configuration >:(
If you care about compile times the only good way is to codegen beforehand
well i did once
but the file took up like 3 megabytes?
this is already a big improvement but i think it could be even less
i just wrote a codegen thing for it
is it not possible to automatically detect the number of elements?
you can automatically count a lot of aggregates members https://godbolt.org/z/odovb4ers
Fwiw https://github.com/Tsche/repr/blob/master/include/librepr/reflection/detail/visit_aggregate.h.in this is the codegen source for repr
Reconstructable string representations and more. Contribute to Tsche/repr development by creating an account on GitHub.
https://github.com/Tsche/repr/blob/master/tools/codegen.py and the codegen script
Sorry about the embeds, can't seem to remove them on mobile
I wrote some absolute spaghetti codegen for a thing like this ๐
Hey, that's @noble plover 's algo 
I knew I should have patented it
Mfw genuinely advanced c++ auto-reflection out of stubborness on a lol
ooo
"some_fairly_long_complex_identifier"
Not that I care but I don't think that's an appropriate way to use otherwise licensed code @merry storm - that algorithm was committed under MIT license, so you need to at least mark it as such - just stating which project you lifted it from isn't sufficient afaik
is it limited in identifier name length?
gib source
Especially given this looks more like an exact copy than a reimplementation ๐
is hardly a copy paste but ya I'm no legal expert
https://github.com/Tsche/repr/blob/master/include/librepr/reflection/detail/arity.h that link isn't going to be stable btw, been considering restructuring a bit sometime soon
aa
If you find someone who knows please let me know, would be good to actually know ig
But yeah same here, pretty much just guessing
so if i reimplement this, who do i credit?
me of course
uhh ya prolly him ๐
aha
I'd probably copy the license header from the project and place a permlink to the specific commit
ya commit perma link would be an improvement at least
what should i include? i generally just put something like ```cpp
// Thanks to lapinozz (https://github.com/lapinozz) for original code
too bad you used such a permissive license on your mom
Where you've taken it from ๐
aha
internet decided to die :)
from godbolt link
also wait this requires boost?
@proven totem you can use Boost.pp to implement the iteration
no boost >:(
Then, open the library files, study how they work
the arity/member counters shouldn't require boost
boost is included in the godbolt link for some reaosn
It doesn't, but it's a starting point to understand arithmetic with the preprocessor
when I made it it had 0 dependency
o I'm not using any boost headers/boost code here
I'm not sure why the library was ticked on in the godbolt ๐
I'm not sure I understand this sentence
It still has zero dependencies in repr

I think I only did some slight refactorings to it
But yeah, repr is zero required dependencies
my lawyers will contact your shortly
I apparently had a library on in the godbolt (though I'm not using it) https://godbolt.org/z/odovb4ers
The only thing you can prevent me from doing is change license
can't even give you a kiss?
Illegal
no, just doing some scatter tests
@noble plover should i link a particular repository of yours here? do i include its license?
link to repr
i'm in the process of rewriting it completely
the arity thing?
yeah
got it ๐
you can link to the original commit
pretty much
u only need it in one place
and expanding the macros takes up unnecessary time
i may have found a better solution
if i can detect the number of elements at compiletime, i just need one overload
and so far it seems like it wont limit me to 256 elements?
oh excellent, my library already has a requirement of c++26
wonder if gcc has implemented it yet though
a chain of if constexpr's was limited to 121 in some compilers, though seems like an overload-approach accepts more
its cool how far this has come
is that pack indexing?
https://github.com/8ightfold/godbolt-embeds/blob/main/deserializer/extended_bindings.hpp this was my original arity detection method for clang lmao
i can just make a fold expression i think
shouldnt use static_cast<void>
it surely has absolutely no downsides
why
thats the convention
i still use c style casts in certain places
just not in templates
unless its a base cast
@proven totem Has your question been resolved? If so, type !solved :)
no
you use size_t outside the std namespace ๐คฎ
ong
you're right, I should include stdint.h ๐
owait that's stddef.h in C

but ya that is one thing I'm not in the strong habit of qualifying and probably should be
now this convo is dragging me away from the project I want to be finishing to fix some things in reflection ๐ฆ
lucky it died...
for now
i dont see that
only attribute specifiers in c++26
what's the phrase...
structured bindings can introduce a pack?
something something https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p1061r5.html
o
probably not finished yet if it is going to make it in
i see
well
it should work here https://godbolt.org/z/vv3ssTMP5
but it just crashes lmao
doesn't even work with a normal struct smh