#xieite

1947 messages · Page 2 of 2 (latest)

fringe beacon
#

fancy, why are x and y wrapped in parentheses?

late ore
#

So the preprocessor can treat them differently

fringe beacon
#

hm

late ore
#

I'm not sure if this is doable with templates alone. I used PP to split the args into strings and non-strings

fringe beacon
#

why not just make the preprocessor treat every other argument differently?

late ore
#

Eh. It can start with a variable

#

You could have two variables in a row

#

But that's an interesting idea thonk

fringe beacon
#

ok i think i've thought of a way to fix my function

fringe beacon
#

@pearl cliff your branch is 999 commits out of date btw

pearl cliff
#

I'll catch up eventually

fringe beacon
#

hehehe

karmic gull
#

I am making news aggregator this website provides specifically news from a single source for UPSC aspirants I am using the mern stack, if someone can talk to me for a while it will be appreciated.

fringe beacon
wicked mural
#

xieite has that feature builtin

glad coral
#

XIETE_MAKE_NEWS_AGGREGATOR macro

fringe beacon
#

ah yes

#

working on issue 41 currently

fringe beacon
fringe beacon
fringe beacon
#

@late ore i implemented your suggestion

fringe beacon
#

this

#
xieite::dump<"{}">(1, 2, 3);
```will now print```
1{}2{}3
late ore
#

Ahhh

fringe beacon
#

it took all day

#

and i separated the formatting and printing stuff for xieite::dump

fringe beacon
#

i want to maybe make a post on reddit

#

to showcase the library and ask for feedback/suggestions

#

what should i write?

night abyss
fringe beacon
wicked mural
#

like dump and intercalation is combined into one

#

but it looks fine to me Clueless

fringe beacon
#

i just extended it

night abyss
#

intercalate (in haskell) is a generalization of intersperse - you intersperse some list with another list instead of a single element. Strings are listy

night abyss
fringe beacon
wicked mural
#

123
{}{}{}
1{}2{}3{}

fringe beacon
#

well i liked the idea

night abyss
#

seems pretty useless to me, just use cout at that point

fringe beacon
#

that's all there is to it

night abyss
#

You don't need to write format strings for streams

fringe beacon
#

surely you can see the usecase ```cpp
std::println("{} {} {} {}", a, b, c, d);

fringe beacon
night abyss
#

¯_(ツ)_/¯

fringe beacon
#

hah

wicked mural
#

ig u can have a separate helper function for intercalation, or “joining”

fringe beacon
#
std::FILE* operator<<(std::FILE* f, auto&& x) {
    std::print(f, "{}", x);
    return f;
}

stdout << 1 << ' ' << 2 << ' ' << 3;
#

oh god i hate it

fringe beacon
wicked mural
#

ok

fringe beacon
#

should i rename it to intercalate?

night abyss
#

Fwiw this entire functionality becomes utterly pointless as soon as we get proper reification or interpolated string literals (what python calls fstrings)

wicked mural
#

is it always a template parameter?

fringe beacon
fringe beacon
night abyss
wicked mural
fringe beacon
#

"a"s + "b"s

#

??

wicked mural
#

fmt_join(“,”, 1, 2, 3)

night abyss
fringe beacon
night abyss
#

Is this ", 1 2 3" or "1,2,3"?

wicked mural
fringe beacon
#

you'd use it like ```cpp
template<xieite::fixed_str delim, typename... Args>
std::string join(Args&&... args) {
return std::format(xieite::fmt_join<delim, Args...>, XIEITE_FWD(args)...);
}

wicked mural
#

like pythons .join

night abyss
#

Yes, but that reads badly

fringe beacon
#

actually i should just add that to the library as well

night abyss
#

Fwiw just use std::views::join

fringe beacon
#

yeah sure

fringe beacon
#

args aren't always the same type

night abyss
#

After stringization they are

fringe beacon
#

hmm

fringe beacon
#
intercalate<"+">(1, 2.0, "3") // "1+2+3"
night abyss
#

Depends on what you want to express

wicked mural
#

intercalate(“+”, 1, 2, 3)

fringe beacon
wicked mural
#

what if the delimiter is unknown

night abyss
#

Intercalate is a generalization of intersperse - it works with lists. I would expect intercalate to intercalate with any list, not just strings

wicked mural
#

compile time

fringe beacon
#

hm

wicked mural
night abyss
#

Or just call it join if you do string stuff

fringe beacon
#

maybe

fringe beacon
#

join isn't descriptive enough

wicked mural
#

i agree cause it sounds similar to append in functionality

night abyss
#

The same as intercalate but inserting a scalar instead of the contents of a list

fringe beacon
night abyss
#

As in a single element

fringe beacon
#

ah

#

intersperse seems appropriate for this function then

fringe beacon
#

it exists now

fringe beacon
fringe beacon
#

;compile gsnapshot -std=c++26 -include/opt/compiler-explorer/libs/xieite/main/include/xieite/io/dump.hpp ```cpp
xieite::dump<"{}">(1, 2, 3);

steel beaconBOT
#
Program Output
1{}2{}3
fringe beacon
#

works :)

sweet apex
fringe beacon
#

also it's just based on the proposal i linked earlier

#

so i called it the same as that

sweet apex
#

intersperse or intercalate

#

i agree with the suggestions above

fringe beacon
#

but that doesn't at all mention anything related to printing

sweet apex
#

intercalate_str

fringe beacon
#

still

#

maybe intercalate_print

sweet apex
#

i prefer that

#

over dump

#

which can be literally anything

fringe beacon
#

but like

#

the delimiter is completely optional

#

it's a minor feature

sweet apex
#

uhhhh

fringe beacon
#

it defaults to a space

#

;compile gsnapshot -std=c++26 -include/opt/compiler-explorer/libs/xieite/main/include/xieite/data/intersperse.hpp ```cpp
std::println("{}", xieite::intersperse<"+">(1, 2, 3));

#

anyway i added this

steel beaconBOT
#
Program Output
1+2+3
sweet apex
#

intersperse is still a better name

fringe beacon
#

if you need a string, there it is

#

fitting name too :)

sweet apex
#

can i put anything

#

like a big string

fringe beacon
#

anything formattable

#

;compile gsnapshot -std=c++26 -include/opt/compiler-explorer/libs/xieite/main/include/xieite/data/intersperse.hpp ```cpp
std::println("{}", xieite::intersperse<"qwertyuioplkjhgfdsazxcvbnm">(1, 2, 3));

steel beaconBOT
#
Program Output
1qwertyuioplkjhgfdsazxcvbnm2qwertyuioplkjhgfdsazxcvbnm3
sweet apex
#

its funny that its a template parameter

fringe beacon
sweet apex
fringe beacon
#

it's easier to put the delimiter directly into the format string

fringe beacon
sweet apex
fringe beacon
sweet apex
fringe beacon
fringe beacon
#

you can now get the surface area of a cube

#

and the implementation is simpler

fringe beacon
agile crest
fringe beacon
#

good

agile crest
fringe beacon
agile crest
#

wha-

#

huh

wicked mural
#
std::unordered_map<std::string, std::vector<std::pair<std::string, std::string>>> something() {
  decltype(return) result{};
  …
  return result;
}
late ore
fringe beacon
#
template<xieite::end..., typename Return = /* ... */>
Return something() {
    Return result {};
    return result;
}
#

@late ore ^

#

wdym drakenah??

wicked mural
#

but dexltype(return) is more fun sadge

fringe beacon
late ore
#

;compile clang_trunk -Wno-undefined-internal -std=c++26

template <typename Key>
struct Reader
{
    friend auto foo(Reader<Key>);
};

template <typename Key, typename Value>
struct Writer
{
    friend auto foo(Reader<Key>) {return Value{};}
};

template <typename Key>
struct AutoWriter
{
    template <typename T, typename = decltype(void(Writer<Key, T>{}))> operator T();
};

#define GUESS_RET_TYPE \
    using ReturnKey = decltype([]{}); \
    if (false) \
        return AutoWriter<ReturnKey>{}; \
    using ReturnType = decltype(foo(Reader<ReturnKey>{}));

// ---

int blah()
{
    GUESS_RET_TYPE
    ReturnType ret = 42;
    return ret;
}

int main() {}
steel beaconBOT
#
Compilation successful
wicked mural
fringe beacon
#

my solution is the simplest

late ore
#

Yes, but where's the fun in that?!

wicked mural
#

R(Ts…)

agile crest
#

@fringe beacon just wondering in your library do you have a way to iterate over a std::tuple

agile crest
#

thanks tho, forgot that existed kekw

fringe beacon
#
auto tuple = std::make_tuple(1, 2.0, '3');

xieite::repeat<3>([&]<std::size_t i> {
    std::println("{}", std::get<i>(tuple));
});
#

as opposed to making a fold expression with std::apply

agile crest
#

ahh

#

thanks

fringe beacon
#

i really need tests

fringe beacon
#

i really need tests

glad coral
#

test in production

late ore
fringe beacon
#

and then a bash script to run all the tests :P

sweet apex
#

i sure was when i buffed up my compiler's tests

fringe beacon
#

hmm okay

hasty holly
#

@fringe beacon Do you use a ruler in your text editor?

#

I'm looking at this code, for example, and I feel like it's too wide. ```cpp
namespace xieite {
template<std::ranges::forward_range Range, std::ranges::forward_range Subrange, xieite::is_invoc<bool(std::ranges::range_common_reference_t<Range>, std::ranges::range_common_reference_t<Subrange>)> Pred = std::ranges::equal_to>
[[nodiscard]] constexpr auto after(Range&& range, Subrange&& subrange, Pred&& pred = {})
noexcept(xieite::is_noex_range<Range> && xieite::is_noex_range<Subrange> && xieite::is_noex_invoc<Pred, bool(std::ranges::range_common_reference_t<Range>, std::ranges::range_common_reference_t<Subrange>)>) {
return std::ranges::subrange(std::ranges::search(range, subrange, XIEITE_FWD(pred)).end(), std::ranges::end(range));
}

template<std::ranges::input_range Range>
[[nodiscard]] constexpr auto after(Range&& range, std::ranges::range_common_reference_t<Range> x)
noexcept(xieite::is_noex_range<Range>) {
    return std::ranges::subrange(std::ranges::next(std::ranges::find(range, x), 1, std::ranges::end(range)), std::ranges::end(range));
}

}

fringe beacon
#

i don't use a column limit

hasty holly
fringe beacon
#

:O

#

i don't see any

#

i'll have to see it from a desktop

hasty holly
#

There's a mistake in line 20.

#

Should be std::ranges::range_common_reference_t.

fringe beacon
#

an anonymous namespace doesn't do anything useful in a header

hasty holly
#

I wasn't expecting to get the pull request accepted, I just wanted to try the feature out.

fringe beacon
#

yeah thanks btw

hasty holly
#

Do you think this kind of change would make sense?

fringe beacon
# hasty holly I'm looking at this code, for example, and I feel like it's too wide. ```cpp nam...

here's my attempt ```cpp
namespace xieite {
template<
std::ranges::forward_range Range,
std::ranges::forward_range Subrange,
xieite::is_invoc<bool(
std::ranges::range_common_reference_t<Range>,
std::ranges::range_common_reference_t<Subrange>
)> Pred = std::ranges::equal_to
> [[nodiscard]] constexpr auto after(
Range&& range,
Subrange&& subrange,
Pred&& pred = {}
) noexcept(
xieite::is_noex_range<Range>
&& xieite::is_noex_range<Subrange>
&& xieite::is_noex_invoc<Pred, bool(
std::ranges::range_common_reference_t<Range>,
std::ranges::range_common_reference_t<Subrange>
)>
) {
return std::ranges::rubrange(
std::ranges::search(
range,
subrange,
XIEITE_FWD(pred)
).end(),
std::ranges::end(range)
);
}

template<std::ranges::input_range Range>
[[nodiscard]] constexpr auto after(
    Range&& range,
    std::ranges::range_common_reference_t<Range> x
) noexcept(xieite::is_noex_range<Range>) {
    return std::ranges::subrange(
        std::ranges::next(
            std::ranges::find(range, x),
            1,
            std::ranges::end(range)
        ),
        std::ranges::end(range)
    );
}

}

#

though i might've gone too far

hasty holly
#

I wanted to submit something like this, but I thought it might've been too extreme.

fringe beacon
#

mm yes

#

it's difficult to format these

hasty holly
#

I didn't know if you have some sort of style guide or format.

fringe beacon
fringe beacon
#

but actually doing this would be difficult

#

finding a good format for everything

hasty holly
#

Okay, I'll get on this when I get tired of Silksong.

fringe beacon
#

oh gosh

#

well please wait i'm doing a big change :P

#

(possibly)

hasty holly
#

Okay.

#

Let me know when there's a status update.

fringe beacon
#

sure

#

i'm still debating on it though

hasty holly
#

What is the change?

fringe beacon
#

first of all, tests

#

which may lead to some changes in areas i overlooked earlier

#

(writing tests will force me to look at everything)

#

then i want to add a few data structures and simplify most of the string and ranges code

#

if it works out

hasty holly
fringe beacon
hasty holly
#

Hm. So why can't I get started on this?

fringe beacon
fringe beacon
#

JUST HAD AN IDEA

#

GENERATING HTML WITH THE PREPROCESSOR

fringe beacon
hasty holly
#

@fringe beacon I think quote in quote.hpp is bugged.

#
return (delim == esc)                                                        // What is this? vvvvv
    ? (delim + xieite::str_replace(str, delim, String(1, esc, alloc) + delim, alloc) + delim, alloc)
    : (delim + xieite::str_replace(xieite::str_replace(str, esc, Str(2, esc, alloc), alloc), delim, Str(1, esc, alloc) + delim, alloc) + delim);
fringe beacon
#

i guess , alloc should not be there

#

thanks

fringe beacon
#

maybe i should use just a tad less preprocessor

karmic fern
hasty holly
#

@fringe beacon In str_join, why do pfx and sfx use std::type_identity_t?

fringe beacon
#

instead they'll be converted to the first type

hasty holly
#

You should add a xieite::avoid_deduction.

fringe beacon
#

how about obstruct?

hasty holly
#

dont_deduce?

fringe beacon
#

undeduce :P

fringe beacon
#

ICE while writing tests nooo

hasty holly
#

@fringe beacon I don't know if you're aware, but you have a few pull requests open.

fringe beacon
#

oh thanks

#

oh gosh

#

you know you could probably put all of these in a single PR

#

that or make some kind of clang-tidy thingamabob that formats it automatically

hasty holly
fringe beacon
#

why not?

hasty holly
#

I made different kinds of changes. If you don't like some of them, you can just merge what you want.

fringe beacon
#

hmm

agile crest
#

can't u accept certain parts of a PR

#

or am I dreaming

fringe beacon
fringe beacon
#

thoughts on these names? ```cpp
unfold<5>([]<int... i> { // called once
(..., std::println("{}", i));
});

unroll<5>([]<int i> { // called 5 times
std::println("{}", i);
});

sweet apex
fringe beacon
sweet apex
#

oh i was on phone so i couldnt see properly

#

i mean the names are probably okay

fringe beacon
#

they make sense to me so

hasty holly
fringe beacon
#

thanks!

hasty holly
fringe beacon
#

why?

hasty holly
fringe beacon
#

well, it makes a fold expression

#

or gives you pack to make into a fold expression

hasty holly
#

What is the motivation behind these abstractions?

fringe beacon
#

seems neater

#

than without

hasty holly
#

Can you show a side by side comparisson?

fringe beacon
hasty holly
fringe beacon
#

also, 5 comes first rather than last in the entire expression

hasty holly
fringe beacon
#

maybe, but i use this quite frequently (so less repetition is better, i think)

hasty holly
hasty holly
fringe beacon
#

note that unroll in this code is what i plan on renaming to unfold

agile crest
fringe beacon
agile crest
#

could be anything inside

fringe beacon
#

it uses std::make_index_sequence internally so it has to be integers

#

but you could transform those?

fringe beacon
#

what kinds of tuples would be generated automatically?

agile crest
#

?

agile crest
fringe beacon
#

can you write an example

agile crest
#

nvm

#

but basically I was talking about like

unroll(tuple, [](auto&& i) { // the num is deduced to std::tuple_size_v<tuple>, and then rolled over using std::get
    std::println("{}", i);
});
fringe beacon
#

sounds like std::apply

fringe beacon
hasty holly
fringe beacon
#

some neat code

#

joking here it is before preprocessing

#

not sure how to format the middle line

#
inline constexpr auto pipe = [][[nodiscard]](auto&& value, auto&&... funcs) XTE_ARROW(
    xte::unfold<(sizeof...(funcs) - !!sizeof...(funcs))>([]<xte::uz... i>(auto&& value, auto&&... funcs) XTE_ARROW(
        xte::arg_at<(sizeof...(funcs) - !!sizeof...(funcs))>(XTE_FWD(funcs)..., xte::identity)(XTE_FWD((DETAIL_XTE::pipe::wrap_value(XTE_FWD(value))->*...->*DETAIL_XTE::pipe::wrap_func(xte::arg_at<i>(XTE_FWD(funcs)...))).value))
    ), XTE_FWD(value), XTE_FWD(funcs)...)
);
fringe beacon
hidden tulip
#

i'm not even trying to read that

#

actually, meh, i'm bored, will give it a try

#

what is XTE_ARROW tho?

fringe beacon
hidden tulip
#

the requires there is to validate the expression produced by the given arguments?

fringe beacon
#

yes

hidden tulip
#

i don't think that's very useful here tho, but alright, whatever

fringe beacon
#

perhaps not for functions with just 1 overload

fringe beacon
# hidden tulip actually, meh, i'm bored, will give it a try

this whole thing allows me to write ```cpp
template<typename T>
constexpr auto fwd_like = [][[nodiscard]](auto&& x) noexcept -> auto&& {
return xte::pipe(
XTE_FWD(x),
xte::value_at<xte::is_c<T>, xte::as_not_c, xte::as_c>,
xte::value_at<xte::is_v<T>, xte::as_not_v, xte::as_v>,
xte::value_at<xte::is_lref<T>, xte::move, xte::unmove>
);
};

hasty holly
#

I stare at pipes all day at work and then I come home to xte::pipe.

hidden tulip
#

well, can you do better piping than ranges with this?

fringe beacon
#

xte::pipe(a, b, c, d) is equivalent to d(c(b(a)))

#

also it's non-recursive

#

btw

hidden tulip
#

my guess is that unfold is just feeding value and funcs and i (as an index_sequence), and then arg_at just executes the forwarded value (assuming it's the result of the prior call), and then it builds the chain of functions paired with i as that specific index, to have some sort of sorted map where each index points to its corresponding function, and then gets the final .value resulting from that internal execution of the sorted map of indices and functions (and forwarding the value all over as the input argument, that's probably the job of that wrap_value)

agile crest
fringe beacon
sweet apex
#

im working on other bugs rn Pensive

#

some issues with dropped const qualifier on the pack

fringe beacon
sweet apex
# fringe beacon similar?

just realized it sounded like i was working on the bug you submitted from my message.
nope, im working on some ICEs

#

i have 3 crashes im fixing. but i might look at that one u submitted out of curiosity later

fringe beacon
#

oo

#

v ery cool

fringe beacon
#

@sweet apex looks like Marek self-assigned the bug

sweet apex
fringe beacon
#

thank you

sweet apex
#

want to submit 3 patches this week

#

i need to improve the patch i sent but ye

fringe beacon
#

submit them all at the same time >:)

sweet apex
#

just fixing some simpler ICEs

#

getting used to gcc codebase

#

ill move onto to harder bugs in a bit once i finish these

fringe beacon
sweet apex
#

thanks to the support of the gcc team im getting used to it quickly (its very nice to have help!)

fringe beacon
#

i got stuck because i don't know how gcc works

sweet apex
#

wait holdup

fringe beacon
#

lucky

wicked mural
#

@fringe beacon is decltype(return) in xieite yet

late ore
fringe beacon
karmic fern
#

WHY ARE YOU SHOUTING

#

|| I KNOW ITS A MACRO ||

fringe beacon
hidden tulip
#

WHY THE CAPS?!?!?!?!

sweet apex
#

I DONT KNOW EITHER

fringe beacon
sweet apex
#

theres only 1 right answer

oblique hearth
oblique hearth
#

or just add_cv but i will silently ignore it

magic saffron
# fringe beacon

They're cv qualifiers, not vc qualifiers, qualifiers cv, qualifiers vc, c qualifiers v, or v qualifiers c.

fringe beacon
#

and since volatile is rare, surely it should go before const which is much more common

magic saffron
fringe beacon
#

the last two options are just for @\volatile

fringe beacon
#

write qualifiers important more i but

#
write
    qualifiers
        important
            more
    i
but
#

what am i even doing

magic saffron
#

I'm glad we're on the same page 🙂

fringe beacon
magic saffron
#

lol

fringe beacon
#

this is how i speak now

magic saffron
#

llo

#

*speak how now i this is

fringe beacon
#

speak this now how is i

#

hey this is approaching yoda-speak

#

btw i have an idea

#

tell me if it's terrible

#

representing types as a base type + array of cv qualifiers + ref qualifier

#

because if you think about it, cpp int const* volatile* const volatile** const& is an array of const or volatile, and * is the delimiter like a comma

#

so then obviously i should be able to do range operations on this

#

add const to all elements between indices 1 and 3

#

erase index 2?

#

etc

sweet apex
wet holly
fringe beacon
#

or, should that be separate?

wet holly
#

i think i split those up

#

it depends what u need it for

fringe beacon
#

how did you split it up?

wet holly
#

i didnt have multiple function types so it was just an array of [Ret, Args...]

fringe beacon
#

ah

fringe beacon
#

@wet holly i have about this much implemented ```cpp
using A = traits<int>;
using B = A::add_ptr<0, 3>; // traits<int***>
using C = B::add_c<1, 2>; // traits<int* const* const*>
using D = C::copy_ref<float&&> // traits<int* const* const*&&>
using E = D::type<> // int* const* const*&&

#

and a few more similar ones

#

also all function type qualifier things (add/remove/copy const/volatile/lref/rref/noexcept/varargs)

hasty holly
#

Hopefully some of my pull requests will be closed soon.

late ore
#
cppdecl::Type t = cppdecl::Type::FromSingleWord("int");
t.AddModifier(cppdecl::Pointer{});
t.AddModifier(cppdecl::Pointer{});
t.AddModifier(cppdecl::Pointer{});
t.AddQualifiers(cppdecl::CvQualifiers::const_, 1);
t.AddQualifiers(cppdecl::CvQualifiers::const_, 2);
t.AddModifier(cppdecl::Reference{.kind = cppdecl::RefQualifier::rvalue});

std::cout << cppdecl::ToCode(t, {}) << '\n'; // int *const *const *&&
fringe beacon
#

working on readability

fringe beacon
#

very wordy though

fringe beacon
late ore
#

You can't make an actual type from the resulting object

oblique hearth
# late ore You can't make an actual type from the resulting object
#include <cstring>
#include <string_view>

template <size_t N>
struct c_string{

    char string[N];
};

template<std::size_t N>
c_string( const char(&)[N] ) -> c_string<N>;

template <c_string text>
using type_from_one_word = decltype([]() consteval
        {
            constexpr std::string_view work_with{text.string};
            if constexpr(work_with == "int")
            {
                return int{};
            }
            else if constexpr(work_with == "double")
            {
                return double{};
            }
        }());




int main()
{
    type_from_one_word<{"int"}> value;
    type_from_one_word<{"double"}> value2 ;
    static_assert(std::same_as<decltype(value), int>);
    static_assert(!std::same_as<decltype(value), double>);
    static_assert(!std::same_as<decltype(value2), int>);
    static_assert(std::same_as<decltype(value2), double>);
}

let me cook

#

it not usable at runtime, but it works :/

late ore
#

Yeah. I mean I know it's possible, but it's not something I tried with my lib

#

Hardcoding the list of types is uncool

fringe beacon
oblique hearth
#
#   if     defined(A) \
        || defined(B)
#       define C
```?
fringe beacon
fringe beacon
hasty holly
#

I like how it's lined up vertically.

late ore
#

I like || at the end of the first line more thinkies

fringe beacon
late ore
#

Yeah

#

Though the # define after that looks meh

fringe beacon
fringe beacon
fringe beacon
#

someone pls format this i need inspiration ```cpp
inline constexpr auto exchange = []<xte::is_implicit_move_ctor T, xte::is_assignable_to<T&> U = T>[[nodiscard]](T& lhs, U&& rhs) noexcept(xte::is_noex_implicit_move_ctor<T> && xte::is_noex_assignable<T&, U>) -> T {
T old = xte::move(lhs);
lhs = XTE_FWD(rhs);
return old;
};

sweet apex
# fringe beacon someone pls format this i need inspiration ```cpp inline constexpr auto exchange...

unironically the only way to make this readable is something like this

inline constexpr auto exchange = []<xte::is_implicit_move_ctor T, xte::is_assignable_to<T&> U = T>
                        [[nodiscard]] (T & lhs, U&& rhs) noexcept(xte::is_noex_implicit_move_ctor<T>
                                       && xte::is_noex_assignable<T&, U>) -> T {
                    T old = xte::move(lhs);
                    lhs = XTE_FWD(rhs);
                    return old;
                };

or this

inline constexpr auto exchange = []<xte::is_implicit_move_ctor T, xte::is_assignable_to<T&> U = T>
                        [[nodiscard]] (T & lhs, U&& rhs)
                 noexcept(xte::is_noex_implicit_move_ctor<T>
                      && xte::is_noex_assignable<T&, U>) -> T {
                  T old = xte::move(lhs);
                  lhs = XTE_FWD(rhs);
                    return old;
                };

#

wait did discord ruin it

#

bruh

#

ill send a picture

#

since this is terrible cursed code there isnt many ways to make it readable

fringe beacon
sweet apex
fringe beacon
#

actually why am i requiring an implicit ctor

#

i could easily T old = T(xte::move(lhs));

fringe beacon
eternal ridge
#
inline constexpr auto exchange = 
    []<xte::is_implicit_move_ctor T, xte::is_assignable_to<T&> U = T>
    [[nodiscard]](T& lhs, U&& rhs) 
    noexcept(xte::is_noex_implicit_move_ctor<T> && xte::is_noex_assignable<T&, U>) -> T
{
    T old = xte::move(lhs);
    lhs = XTE_FWD(rhs);
    return old;
};
#

I aligned the template parameters, the lambda signature, and the body so it’s easier to parse visually.

#

If you want, I can also give a more compact single-line version that’s still readable for modern C++ headers. Do you want me to do that?

fringe beacon
eternal ridge
fringe beacon
#

ohno why is it public

#

not too bad though

sweet apex
oblique hearth
fringe beacon
#

zengpt

eternal ridge
# fringe beacon zengpt

Hi, I’m ZenGTP, here to help out on anything you’re curious about. Anything on your mind?

fringe beacon
#

at least one example for every component

eternal ridge
fringe beacon
#

smh

fringe beacon
# fringe beacon
poll_question_text

.

victor_answer_votes

9

total_votes

14

victor_answer_id

2

victor_answer_text

const volatile T

#

hah

fringe beacon
#
template<typename T, std::size_t n>
struct fixed_array {
    T _data[n];

    // ...
};

template<typename... Ts>
fixed_array(Ts...) -> fixed_array<std::common_type_t<Ts...>, sizeof...(Ts)>;
``` is this a reasonable deduction guide?
glad coral
#

yes

#

lgtm

hidden tulip
#

uhm...

#

std::common_type_t is weird

#

also i would make sur sizeof...(Ts) > 0uz

fringe beacon
fringe beacon
#

do you prefer cpp auto add(auto x, auto y) ARROW(x + y) or```cpp
auto add(auto x, auto y) ARROW(
x + y
)

fringe beacon
sweet apex
#

sure

fringe beacon
#

i have much practice at writing its definition

#
#define ARROW(...) \
    noexcept(noexcept(__VA_ARGS__)) \
    -> decltype(auto) \
    requires(requires { __VA_ARGS__; }) \
    { return __VA_ARGS__; }
sweet apex
#

i prefer if arrow lets me type {}

fringe beacon
#

i don't think that's possible

#

oh hey wait

sweet apex
#

skill issue

fringe beacon
#
auto add(auto x, auto y) ARROW(//{
    /*return*/ x + y//;
)//}
#

happy?

sweet apex
#

lol

late ore
fringe beacon
wicked mural
fringe beacon
#

it doesn't always work though

#

one sec i'll get an example where i prefer the second option

late ore
#

I think I like second more

fringe beacon
fringe beacon
hasty holly
#

Why not just have both of them be arrows?

late ore
#
void foo(auto f) noexcept
{
    f();
}

auto bar(auto f) ARROW(
    f()
)
#

Or

auto bar(auto f) ARROW(f())
fringe beacon
fringe beacon
agile crest
sweet apex
agile crest
sweet apex
#

indeed that is what is is

agile crest
steel beaconBOT
#
Compiler Output
<source>:8:16: warning: '__VA_ARGS__' can only appear in the expansion of a C++11 variadic macro
    8 | { return auto (__VA_ARGS__);
      |                ^
<source>:7:2: error: expected unqualified-id before ')' token
    7 | }) \
      |  ^
<source>:14:1: error: expected primary-expression before 'return'
   14 | return 0;
      | ^~~~~~
<source>:15:2: error: expected ')' at end of input
   15 | }
      |  ^
      |  )
<source>:6:9: note: to match this '('
    6 | requires(requires {auto (__VA_ARGS__);
      |         ^
<source>:12:1: note: in expansion of macro 'ARROW'
   12 | ARROW({x + y})
      | ^~~~~
<source>:15:2: error: expected initializer at end of input
   15 | }
      |  ^
Build failed
agile crest
#

huh

#

it was working on godbolt

steel beaconBOT
#
Compilation successful

No assembly generated.

fringe beacon
agile crest
fringe beacon
#

another big rewrite is on the way

agile crest
#

remembered this after you said this

fringe beacon
#

he released a new one recently btw

#

You ever found yourself trying to do something really simple, like show a username on a web page, but you can't because there's too much "architecture"? This one is for you.

Music: "Somebody Told Me" by The Killers.

Written by Brandon Flowers, Dave Keuning, Mark Stoermer, Ronnie Vannuci Jr. Copyright © 2004 The Killers Publishing / Lizard Kin...

▶ Play video
fringe beacon
#

I think I'm going to push what I have and then complete tests and docs later

#

But also a lot of things are still missing entirely

fringe beacon
#

wait I messed up the branches

turbid musk
#

need LICENSE and a lot more in the readme

fringe beacon
#

the readme will also link to the docs when I do any of them

fringe beacon
turbid musk
#

can you re link, on phone it seems impossible to scroll to the top

sweet apex
turbid musk
#

for doc/readme maybe some sort of auto generated doxygen would help see what's available/discover it

fringe beacon
#

I'll work on docs now

#

;compile gsnapshot -std=c++26 -freflection -I/opt/compiler-explorer/libs/xieite/main/include ```cpp
#include <xte/io/logger.hpp>

int main() {
xte::logger::info("Hello, world!");
}

steel beaconBOT
#
Program Output
INFO  [2026-02-14 00:28:41] /app/example.cpp:int main():4: Hello, world!
fringe beacon
#

splendid

turbid musk
#

hmm how do you get ur own files in godbolt?

fringe beacon
#

(I asked mr godbolt nicely)

#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/literal/analog.hpp ```cpp
using namespace xte::literal::analog;

std::println("{}", (x - - - +
!* *
! * *
! * *
+ + - - - +
* ! !
* ! !
*! !
+ - - - x).volume);

steel beaconBOT
#
Program Output
27
fringe beacon
#

it's 3x3x3

turbid musk
#

hmm no it's 4x4x4

fringe beacon
#

how would you describe a 1x1x1 cube?

turbid musk
#
++
++
``` is the front face
#

so

x+
+++
 +x
``` I guess
fringe beacon
#

kinda difficult to make that work

#

it isn't very readable either :P

turbid musk
#

well for anything 2 or bigger it's pretty clear...

#

not that I get what this is useful for 🙂

fringe beacon
#

haha

turbid musk
#

so how do you get files uploaded? you know the team personally ?

fringe beacon
#

oh, I submitted a PR so that my library gets pulled every day

#

docs are about halfway done

#

at least of the things that are easy to update

#

which isn't a lot

agile crest
fringe beacon
#

I will push soon

agile crest
#

nice

fringe beacon
#

actually you know what, I'll push now

agile crest
#

nothing in the fn category works

fringe beacon
#

Uhoh

#

reload?

agile crest
fringe beacon
#

what url does it take you to when you click on the func category

fringe beacon
agile crest
fringe beacon
#

Yeah I haven't rewritten that function yet

#

so your sidebar is wrong for some reason

#

try opening the docs in a private tab?

agile crest
#

yup, it shows the new version now

#

👍

#

must be some firefox caching thing

fringe beacon
#

possibly

#

The sidebar is designed horribly currently

#

it's just an embed of another page

#

:P

agile crest
fringe beacon
#

I don't know fancy HTML tricks

agile crest
#

fuck

fringe beacon
#

\:P

agile crest
#

the backslash isn't undoing the emoji

#

oh

fringe beacon
#

or just disable it in discord settings

fringe beacon
agile crest
#

now make four trolol

fringe beacon
#

we'll see

#

btw this should already work on mobile devices

agile crest
fringe beacon
#

haha

#

I made it work on mobile just so that I could look up the docs when I wasn't at my computer

fringe beacon
#

alright I updated more of the docs

#

All of the ones listed on the left should be good

#

feels good to be working on this again

sweet apex
karmic fern
fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/preproc/lambda.hpp ```cpp
auto f = XTE_LAMBDA($0 + 1);
std::println("{}", f(1));

auto g = XTE_LAMBDA_LOCAL(f($0 + $1));
std::println("{}", g(2, 3));

steel beaconBOT
#
Program Output
2
6
fringe beacon
#

@night abyss it works now

agile crest
#

how does $n syntax even work

fringe beacon
#

(it's just an identifier)

late ore
#

;asm -E -P -include/opt/compiler-explorer/libs/xieite/main/include/xte/preproc/lambda.hpp

auto f = XTE_LAMBDA($0 + 1);
steel beaconBOT
#
Assembly Output Pt. 1
auto f = ([]<decltype(auto)... $$ >[[nodiscard]]( [[maybe_unused]] auto&&... $) static noexcept (requires ( decltype($)&&... $) { requires ([]( auto&&... $) { 
#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wunused-parameter"
 return ([&]<decltype(auto) $$0, decltype(auto) $$1, decltype(auto) $$2, decltype(auto) $$3, decltype(auto) $$4, decltype(auto) $$5, decltype(auto) $$6, decltype(auto) $$7, decltype(auto) $$8, decltype(auto) $$9, decltype(auto) $$A, decltype(auto) $$B, decltype(auto) $$C, decltype(auto) $$D, decltype(auto) $$E, decltype(auto) $$F, decltype(auto)...>(auto&& $0, auto&& $1, auto&& $2, auto&& $3, auto&& $4, auto&& $5, auto&& $6, auto&& $7, auto&& $8, auto&& $9, auto&& $A, auto&& $B, auto&& $C, auto&& $D, auto&& $E, auto&& $F, auto&&...) mutable -> decltype(auto) { return noexcept($0 + 1); }).template operator()<$$..., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>(static_cast<decltype($)&&>($)..., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); 

Assembly Output Pt. 2
#pragma GCC diagnostic pop
 })( static_cast<decltype($)&&>($)...); }) -> decltype(auto) requires (requires ( decltype($)&&... $) { requires ([]( auto&&... $) { 
#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wunused-parameter"
 return ([&]<decltype(auto) $$0, decltype(auto) $$1, decltype(auto) $$2, decltype(auto) $$3, decltype(auto) $$4, decltype(auto) $$5, decltype(auto) $$6, decltype(auto) $$7, decltype(auto) $$8, decltype(auto) $$9, decltype(auto) $$A, decltype(auto) $$B, decltype(auto) $$C, decltype(auto) $$D, decltype(auto) $$E, decltype(auto) $$F, decltype(auto)...>(auto&& $0, auto&& $1, auto&& $2, auto&& $3, auto&& $4, auto&& $5, auto&& $6, auto&& $7, auto&& $8, auto&& $9, auto&& $A, auto&& $B, auto&& $C, auto&& $D, auto&& $E, auto&& $F, auto&&...) mutable -> decltype(auto) { return requires { $0 + 1; }; }).template operator()<$$..., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>(static_cast<decltype($)&&>($)..., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); 

Assembly Output Pt. 3
#pragma GCC diagnostic pop
 })( static_cast<decltype($)&&>($)...); }) { 
#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wunused-parameter"
 return ([&]<decltype(auto) $$0, decltype(auto) $$1, decltype(auto) $$2, decltype(auto) $$3, decltype(auto) $$4, decltype(auto) $$5, decltype(auto) $$6, decltype(auto) $$7, decltype(auto) $$8, decltype(auto) $$9, decltype(auto) $$A, decltype(auto) $$B, decltype(auto) $$C, decltype(auto) $$D, decltype(auto) $$E, decltype(auto) $$F, decltype(auto)...>(auto&& $0, auto&& $1, auto&& $2, auto&& $3, auto&& $4, auto&& $5, auto&& $6, auto&& $7, auto&& $8, auto&& $9, auto&& $A, auto&& $B, auto&& $C, auto&& $D, auto&& $E, auto&& $F, auto&&...) mutable -> decltype(auto) { return $0 + 1; }).template operator()<$$..., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>(static_cast<decltype($)&&>($)..., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); 
#pragma GCC diagnostic pop
 });

fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/data/string.hpp ```cpp
xte::string s;
s += "hello";
std::print("{}", s);

steel beaconBOT
#
Program Output
hello
fringe beacon
#

string and array work

tight parcel
fringe beacon
fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/math/big_int.hpp ```cpp
std::println("{}", xte::big_int(99).pow(99));

steel beaconBOT
#
Program Output
00420006028460828220000240826646662822224844246624084240648422060028460824206802008020828642682646062242688642662204002048802060042266002000888268242240242880628040466848888468680220248288602433876430563566003089
fringe beacon
#

great, I don't know what's wrong

#

oh the stringifier is broken

#

;compile ```js
console.log(99n**99n);

steel beaconBOT
#
Program Output
369729637649726772657187905628805440595668764281741102430259972423552570455277523421410650010128232727940978889548326540119429996769494359451621570193644014418071060667659301384999779999159200499899n

fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/math/big_int.hpp ```cpp
std::println("{}", xte::big_int(99).pow(99) == xte::big_int("369729637649726772657187905628805440595668764281741102430259972423552570455277523421410650010128232727940978889548326540119429996769494359451621570193644014418071060667659301384999779999159200499899"));

steel beaconBOT
#
Program Output
true
fringe beacon
#

yeah

#

it was the division operator -_-

odd grove
#

How do you do the division for printing purpose? I remember that python had this loud thing about DOS by sending long ints that took forever to format using regular division xD

fringe beacon
#

hmm, maybe I could format (almost) entire long ints at a time

odd grove
#

That's probably a better idea, than doing it by the digit. I wonder if divide and conquer (splitting roughly in half) might work well

fringe beacon
#

would be good to research stringification techniques

fringe beacon
#

we try again

#

;compile gsnapshot -std=c++26 -freflection -I/opt/compiler-explorer/libs/xieite/main/include ```cpp
#include <xte/math/big_int.hpp>
#include <print>

int main() {
std::println("{}", xte::big_int(99).pow(99));
}

steel beaconBOT
#
Program Output
00420006028460828220000240826646662822224844246624084240648422060028460824206802008020828642682646062242688642662204002048802060042266002000888268242240242880628040466848888468680220248288602433876430563566003089
fringe beacon
#

oh, still some time before godbolt updates

fringe beacon
#

WE TRY AGAIN

#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/math/big_int.hpp -DA=A ```cpp
std::println("{}", xte::big_int(99).pow(99));

steel beaconBOT
#
Program Output
369729637649726772657187905628805440595668764281741102430259972423552570455277523421410650010128232727940978889548326540119429996769494359451621570193644014418071060667659301384999779999159200499899
fringe beacon
#

there we go

fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -I/opt/compiler-explorer/libs/xieite/main/include ```cpp
#include <xte/io/file.hpp>
#include <xte/io/std.hpp>

int main() {
if (auto f = xte::file(FILE, xte::file::mode::read)) {
xte::std::out.write(f.read());
}
}

steel beaconBOT
#
Program Output
#include <xte/io/file.hpp>
#include <xte/io/std.hpp>

int main() {
    if (auto f = xte::file(__FILE__, xte::file::mode::read)) {
        xte::std::out.write(f.read());
    }
}
rain scarab
#

something something logarithms

fringe beacon
#

I suppose it would be useful to optimize the case for radix=10 though

fringe beacon
oblique hearth
#

xte::big_int(99)^3

#

trolol '

#

nvm

fringe beacon
fringe beacon
#

yes

oblique hearth
#

i remember that ** is not allowed

#

oh wait

#

literals

fringe beacon
#

that's a binary operator* and a unary operator*

oblique hearth
#

i see

fringe beacon
#

which is why the _exp is needed

oblique hearth
#

literals fix everything

fringe beacon
#

yes :P

#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/util/cast.hpp ```cpp
std::println("{}", xte::cast<int>(3.14159));

steel beaconBOT
#
Program Output
3
oblique hearth
#

maybe create literal 1_B

fringe beacon
#

boolean?

oblique hearth
#

big int

fringe beacon
#

oh

oblique hearth
#

big B

fringe beacon
oblique hearth
#

i tried find code in your xiete github, but there no big_int

wicked mural
#

;compile clang_trunk -std=c++23 -isystem /opt/compiler-explorer/libs/boost_1_80_0 ```cpp
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

boost::multiprecision::cpp_int test("99");
std::cout << boost::multiprecision::pow(test, 99);

steel beaconBOT
#
Program Output
369729637649726772657187905628805440595668764281741102430259972423552570455277523421410650010128232727940978889548326540119429996769494359451621570193644014418071060667659301384999779999159200499899
fringe beacon
#

nice

agile crest
fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/math/big_int.hpp ```cpp
using namespace xte::literal::big_int;
std::println("{}", 99_big .pow(99));

steel beaconBOT
#
Compiler Output
<source>: In function 'int main()':
<source>:5:20: error: call to consteval function 'xte::literal::big_int::operator""_big<'9', '9'>()' is not a constant expression
    5 | std::println("{}", 99_big .pow(99));
      |                    ^~~~~~
<source>:9:1: error: 'xte::literal::big_int::operator""_big<'9', '9'>()' is not a constant expression because it refers to a result of 'operator new'
    9 | }
      | ^
Build failed
fringe beacon
#

thought I fixed that

#

;compile gsnapshot -std=c++26 -include/opt/compiler-explorer/libs/xieite/main/include/xte/preproc/version.hpp ```cpp
std::println("v{}.{}.{}", XTE_VERSION_MAJOR, XTE_VERSION_MINOR, XTE_VERSION_PATCH);

steel beaconBOT
#
Program Output
v0.155.2
fringe beacon
#

oh, it contains a call to a consteval function

fringe beacon
#

took 3 hours to fix? yey

fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/math/big_int.hpp -Ddummy=0 ```cpp
using namespace xte::literal::big_int;
std::println("{}", 99_big .pow(99));

steel beaconBOT
#
Program Output
369729637649726772657187905628805440595668764281741102430259972423552570455277523421410650010128232727940978889548326540119429996769494359451621570193644014418071060667659301384999779999159200499899
fringe beacon
#

FINALLY

fringe beacon
fringe beacon
fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/math/wrap.hpp ```cpp
for (int i = 0; i < 5; ++i) {
std::println("{}", xte::wrap(i, 2, -1));
}

steel beaconBOT
#
Program Output
0
1
-1
0
1
fringe beacon
#

2 should be inclusive hmm

agile crest
#

I feel it's fine being exclusive tbh makes sense

fringe beacon
#

We'll see if it makes sense later on

sweet apex
#

i feel like wrap can be inclusive honestly, its more intuitive

#

you can also add wrap_exclusive or something

fringe beacon
#

and I'm still working on it

#

the one on github is borked

sweet apex
#

lol, i dont wanna find out what your impl looks like

fringe beacon
#

I hate integer promotion

#

does std::common_type_t do integer promotion?

sweet apex
#

i implemented on my previous compiler

#

had a lot of rules surprisingly

fringe beacon
sweet apex
#

i should probs make a showcase for my new compiler

fringe beacon
#

you should!

sweet apex
#

i been working on it for 6 months now

#

might as well open a showcase

fringe beacon
#

wait a second

#

does it have version macros?

sweet apex
sweet apex
#

it will probs have C FFI eventually among other things

#

its a big project for me to implement a full compiler stack from frontend to backend with real world optimizations found in gcc and llvm

sweet apex
#

i could probs make a C frontend in like a month or less that targets my middle end

#

its something to consider later once it has enough optimizations to be worth benchmarking against llvm and gcc

#

its already nice that it has some opts going on

fringe beacon
#

that is cool

sweet apex
#

i only spent a few hundred hours of my time on it so it still has a long way to go

fringe beacon
#

muhahahahaa

agile crest
fringe beacon
oblique hearth
#

so it like your godbolt?

fringe beacon
oblique hearth
#

like that your wrapper for godbolt for mobile?

fringe beacon
steel beaconBOT
#
Program Output
1 -1 0 1 -1 0 1 -1 0 1 -1
sweet apex
#

also does it matter if its wrap(i, -1, 1) vs wrap(i, 1, -1)?

fringe beacon
#

either way works

fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -I/opt/compiler-explorer/libs/xieite/main/include```cpp
#include <print>
#include <xte/literal/numbers.hpp>

using namespace xte::literal::numbers;

int main() {
std::println("{:X}", 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF_u128);
}

steel beaconBOT
#
Program Output
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
fringe beacon
#

oh also

#

;compile gsnapshot -std=c++26 -freflection -I/opt/compiler-explorer/libs/xieite/main/include```cpp
#include <print>
#include <xte/literal/numbers.hpp>

using namespace xte::literal::numbers;

int main() {
std::println("{}", 5_b);
}

steel beaconBOT
#
Program Output
true
fringe beacon
#

just because

fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/math/div_ceil.hpp ```cpp
std::println("{}", xte::div_ceil(5, 2));

steel beaconBOT
#
Program Output
3
fringe beacon
#

a few division rounding functions

#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/math/div_floor.hpp ```cpp
std::println("{}", xte::div_floor(-5, 2));

steel beaconBOT
#
Program Output
-3
fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/math/avg.hpp ```cpp
std::println("{}", xte::avg(1, 2, 3));

steel beaconBOT
#
Program Output
2
fringe beacon
#

avg here uses only integers and probably cannot overflow

agile crest
#

You should try adding these as "traits" (ie abstract bases) and concepts so that users can overload to their own type

#

And then we can recreate rust generics bb

fringe beacon
agile crest
#

Then again it might be slideware but you can check

fringe beacon
#

slideware haha

noble compass
#

what exactly is this library

fringe beacon
#

sometimes both

#

oh btw apparently there was another bug in xte::stringify_number() caused by rounding errors but that is fixed now

agile crest
#

oh u do im dumb

fringe beacon
agile crest
fringe beacon
# agile crest smh why aren't we using `xte::logger::info()`

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/io/logger.hpp -include/opt/compiler-explorer/libs/xieite/main/include/xte/math/avg.hpp ```cpp
xte::logger::info("{}", xte::avg(1, 2, 3));

steel beaconBOT
#
Program Output
INFO  [2026-05-01 00:47:18] /app/example.cpp:int main():3: 2
agile crest
#

there we go

fringe beacon
#

neat

fringe beacon
# agile crest there we go

something else I just fixed (but godbolt won't update for another 23 hours) is xte::init_list<> for multidimensional arrays

#
xte::array<xte::array<int>> array = {
    { 1, 2, 3 },
    { 4, 5, 6 },
    { 7, 8, 9 }
};
#

everything here is std::moved, not copied :)

fringe beacon
agile crest
fringe beacon
#

it was detect_cosmic_ray() and it wouldn't return until it indeed detected a bit flip

agile crest
#

\s

fringe beacon
agile crest
#

dumb down the api some more

fringe beacon
agile crest
#

also this will be running on mars so it needs to have robust error handling

fringe beacon
#

upon any crash, it automatically restarts your program

agile crest
#

perfect!

agile crest
#

yayyyyyy

fringe beacon
fringe beacon
#

removed all javascript from the docs now

oblique hearth
#

or depends on deducing

#
template <typename T>
concept number = std::integral<T> || std::floating_point<T>;

[[nodiscard]] constexpr
auto avg(number auto... nums) -> std::common_type_t<decltype(nums)...> {
   return ((nums + ...)) / sizeof...(nums);
}
fringe beacon
#

only the types that you pass it

#

well, it gets the common_type_t

oblique hearth
#

true

fringe beacon
oblique hearth
#

so do it eventually cast to big_int?

#

if tooo large

fringe beacon
#

it doesn't use larger types

oblique hearth
#

so, what if it overflow?

#

oh wait

#

im stupid

#

it just cant

#

you do (num0 / size) + (num1 / size) for floats

fringe beacon
#

good luck reading that

#

feel free to try to format it

oblique hearth
#

can i do push request of just formatting trolol

fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/data/array.hpp ```cpp
xte::array<xte::array<int>> a = {
{ 1, 2, 3 },
{ 4, 5, 6 }
};

std::println("{}", a);

steel beaconBOT
#
Program Output
[[1, 2, 3], [4, 5, 6]]
fringe beacon
#

2D arrays with convenient initializer

oblique hearth
#

my beloved

fringe beacon
oblique hearth
#

all my code is 3 space indent

agile crest
#

do you not have a .clang-format or something?

fringe beacon
agile crest
#

just use a formatter nooo

fringe beacon
agile crest
#

you could probably get clang-format or some other formatter to get it to your taste

fringe beacon
#

it lacks the configuration

#

it can't possibly work with this

agile crest
fringe beacon
#

splendid

#

I'll do that for every file

fringe beacon
late ore
#

Nvm I'm still sleepy

#

I thought you got std::array-like class to work with nested braces

#

without {{...}}

fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/math/eval.hpp ```cpp
static_assert(xte::eval<int>("2 + 2 * 2") == 6);

steel beaconBOT
#
Compilation successful
fringe beacon
#

someone opened an issue and it took me 5 days to notice

fringe beacon
#

hm

#

;asm -E -P -include/opt/compiler-explorer/libs/xieite/main/include/xte/preproc/version.hpp ```cpp
XTE_VERSION_MAJOR.XTE_VERSION_MINOR.XTE_VERSION_PATCH

steel beaconBOT
#
Assembly Output
0 . 184 . 4

fringe beacon
#

why hasn't it updated

fringe beacon
#

;compile g161 -std=c++26 -freflection -I/opt/compiler-explorer/libs/xieite/main/include ```cpp
#include <xte/data/array.hpp>
#include <xte/data/init_list.hpp>
#include <xte/data/ptr.hpp>
#include <xte/util/xvalue.hpp>

template<typename T>
struct MyArray {
xte::array<T> data;

MyArray(xte::init_list<T> list) {
    for (auto&& item : list) {
        this->data.push(xte::xvalue(item));
    }
}

};

int main() {
MyArray<xte::ptr<int>> a = {
xte::ptr<int>::make(5),
nullptr
};
}

steel beaconBOT
#
Compilation successful
fringe beacon
#

erm

#

ok so there's a compiler bug

fringe beacon
regal lynxBOT
fringe beacon
#

ok wheatley

fringe beacon
fringe beacon
#

replaced a lot of static_casts with calls to xte::cast because that properly handles floating point shenanigans*

#

(hopefully)

frosty dagger
#

hey uh

#

this isnt great to do

fringe beacon
frosty dagger
#

the compiling random files to discord i dont understand whyù

fringe beacon
#

I don't know what you mean?

fringe beacon
frosty dagger
#

yes

fringe beacon
frosty dagger
#

unpractical

fringe beacon
frosty dagger
#

doesnt need a for what

#

its a bad practice

fringe beacon
frosty dagger
#

gcc or single file compilation

#

try g++ or cl

fringe beacon
#

the compiler bot can use any c++ compiler

#

including g++

frosty dagger
#

then why do it on discord

#

honestly

#

its not worth it

#

do it

#

idc

fringe beacon
wicked mural
#

unpractical a bad practice!

#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/math/eval.hpp ```cpp
static_assert(xte::eval<int>("2 + 2 * 2") == 6);

steel beaconBOT
#
Compiler Output
In file included from /opt/compiler-explorer/libs/xieite/main/include/xte/math/../data/../data/../preproc/arrow.hpp:8,
                 from /opt/compiler-explorer/libs/xieite/main/include/xte/math/../data/../data/range_cmp.hpp:6,
                 from /opt/compiler-explorer/libs/xieite/main/include/xte/math/../data/array.hpp:4,
                 from /opt/compiler-explorer/libs/xieite/main/include/xte/math/eval.hpp:4,
                 from <command-line>:
/opt/compiler-explorer/libs/xieite/main/include/xte/math/../data/../data/../preproc/arrow.hpp:38:129: error: 'DETAIL_XTE_arg' was not declared in this scope; did you mean 'DETAIL_XTE_Arg'? [-Wtemplate-body]
   38 |                 requires(requires { XTE_IF(XTE_ANY(_arg))(([](XTE_UNWRAP(_arg)) requires(requires { __VA_ARGS__; }) {})(XTE_FWD(DETAIL_XTE_arg)))(__VA_ARGS__); })) \
      |                                                                                                                                 ^~~~~~~~~~~~~~
/opt/
wicked mural
#

@fringe beacon fix that

#

also why is this so unreadable

fringe beacon
wicked mural
wicked mural
fringe beacon
#

ok, how would you format it?

wicked mural
#

its gonna be hard to reason about at first glance

wicked mural
fringe beacon
#

and then the normal noexcept/requires/body

fringe beacon
fringe beacon
late ore
#

Nice

#

I assume the unusual type name spelling is intentional

fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/meta/meta.hpp ```cpp
std::println("{}", xte::meta::name_of(^^const int*(&&)(...) noexcept));

regal lynxBOT
steel beaconBOT
#
Program Output
(const int*(...) noexcept)&&
fringe beacon
#

documented compiler/platform/architecture detection macros

fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/meta/meta.hpp ```cpp
#include <print>

template<auto> int x;

int main() {
std::println("{}", xte::meta::name_of(^^x<[] {}>));
}

steel beaconBOT
#
Program Output
x<main()::<lambda>{}>
fringe beacon
#

alright

fringe beacon
#

;compile gsnapshot -std=c++26 -freflection -include/opt/compiler-explorer/libs/xieite/main/include/xte/sys/available_memory.hpp ```cpp
std::println("{}", xte::available_memory());

steel beaconBOT
#
Program Output
16469725160
oblique hearth
oblique hearth
#

that not that hard

fringe beacon
#

what about mebibytes and gibibytes

oblique hearth
#

xte::big_int for what

fringe beacon
oblique hearth
#

like you still can implement for everything what IEC define trolol

fringe beacon
#

what is IEC?

oblique hearth
#

International Electrotechnical Commission

#

like exbibyte

fringe beacon
#

ah yes

hot jackal