CptCap

u/CptCap


r/BudgetBlades•

My collection so far. I needed a new knife and since I really like natural materials like wood and leather, I was drawn to civivi's wood scale. I got one, it felt so nice I had to get two more.

From top to bottom: Praxis, Mini Praxis and Conspirator.

Both the praxis are feel incredible in the hand, even if I can't wrap my pinky around the mini. I don't like the Conspirator as much, but with the nick and button lock it's a great fidget knife. The whole bunch was 200€ which is kinda nuts.

10

r/Hema•

Hello!

Most one handed weapons have different protection/bulk requirements for both hands.

Which makes me wonder, why are gloves always sold in pairs?

There is the argument that selling 2 gloves allow for a higher price and thus higher income, but it also raise the barrier of entry tremendously.

Not everyone is able to spend 400€ on a pair of Thokk or Black prince, to use only one. They don't even need to sell them half price for it to be attractive. I would gladly pay 60-65% of the pair price just to get one.

3037

r/vulkan•

I just got my first nasty DEVICE_LOST bug.

It was due to my render-graph buffer allocator sometimes returning a bigger buffer than requested, which would get fed into draw_indirect(TypedSubBuffer<VkDrawIndexedIndirectCommand, BufferUsage::IndirectBit> indirect), which draws indirect.size() commands. Since the buffer was bigger than expected it wasn't completely written, which caused the GPU to run garbage draws and crash.

I searched for this bug for hours without making any progress until I stumbled on VK_NV_device_diagnostic_checkpoints. One hour later the bug was fixed.


This extension allows you to insert checkpoints in command buffer, and to query the last checkpoints ex

327

r/cpp_questions•

Hi !

I have a struct which looks something like this:

struct A {
    int x;
    int y;
    int z;
};

I am taking pointers to members of this class, to modify a dynamically chosen member. Like so:

auto member_ptr = animate_x ? &A::x : &A::z;

This class needs to be refactored into something like this

struct B {
    int x;
    int y;
};

struct A {
    B b;
    int z;
};

To extract and reuse some common behavior.

The problem is that now, some of the members I was getting pointers to (namely x and y), live in B b; inside of A.

They are obviously still in A, but I can't, for the life of me, find how to get a pointer to memb

215

r/cpp•

Hi everyone!

I was micro-optimizing some compression code and an innocuous change made a huge performance difference. At first I expected some weird hardware pipelining effects, but looking at the disassembly revealed that MSVC sometimes generates atrocious code when trying to copy an 8 byte struct (with /O2 ofc):

For this struct struct entry { uint32_t a; uint32_t b; };:

*target = entry {a, b};

Creates a temporary entry on the stack, reads it into rax and only then move rax into target.

But:

target->a = a;
target->b = b;

Sets a and b into target directly.

Bizarrely when the struct is already instantiated, it's the opposite:

target->a = e.a;
5031

r/cpp_questions•

Hello!

I have a program that creates a lot of very short lived short-ish strings, mostly to feed into ImGui.

To avoid spending too much time allocating strings I created a small formatter class that returns const char*/std::string_view pointing to a small internal buffer. (The buffer is sub allocated using a bump-ptr allocator and gets reset once in a while).

I recently replaced my ugly formatting code by calls to std::vformat_to, plugged into my allocator like so:

auto buffer = detail::alloc_fmt_buffer();
std::vformat_to(buffer.begin(), /* ... */);

This is hidden inside a function, and I haven't found a way to properly forward all the

16

r/cpp_questions•

I have a class hierarchy similar to this:

class Widget {
    // a lot of virtual members
};

class Button : public Widget {
    // new stuff + overrides
};

class MySuperButton : public Button {
    // ...
};

And I would like to hide the fact that MySuperButton inherit from Button, but not from Widget. Basically making the inheritance from Button private while keeping all its base classes public.

Why?

I have a complicated widget build on Button, which needs to maintain some invariant with its button state. Exposing it has a Button might allow something to modify the button directly breaking these invariants.

Example:

112

r/cpp•

Hello!

I am currently trying to write an is_template trait (out of^^mostly curiosity), that matches any templated type. The problem I am running into is that there doesn't seem to be a way to write a template template parameter that doesn't discriminates between types and non types.

template<template<typename...> typename T> will only match types while template<template<auto...> typename T> only match non types.

template<template<auto..., typename..., auto..., typename..., etc> typename T> would work, but parameter packs are required to be in last position in primary class templates parameter list.

Is there any way to accomplish this, without w

112

r/CR6•

Hi, I have recently acquired a CR6-SE. Everything was fantastic until I tried to change the nozzle and broke it in the heating block. Like this.

I have dissembled the hot-end, and tried drilling the nozzle out, but it hasn't moved.

This is what I am left with: I am unable to dissemble it further.

I am new to 3D printing and I am not quite sure where to go from here. Changing the heating block seems like the thing to do, but after searching everywhere I wasn't able to find any CR6-SE heating block. Can I use a CR10 or ender block?

[edit] Also, how do I avoid this in the future?

[edit] I wasn't able to extract t

121