INNER CODE UNIT · Python

EESmallVectorPrinter

SpartanJ/eepp · projects/scripts/debug/eepp_gdb.py:4

class EESmallVectorPrinter:
    """Pretty Printer for EE::SmallVector (ankerl::svector)"""

    def __init__(self, val):
        self.val = val
        # Get the underlying uint8_t array
        self.m_data = self.val["m_data"]["_M_elems"]
        self.type_t = self.val.type.template_argument(0)

    def is_direct(self):
        # bit 0 of the first byte is the discriminator
        return (int(self.m_data[0]) & 1) != 0

    def to_string(self):
        if self.is_direct():
            size = int(self.m_data[0]) >> 1
            return f"EE::SmallVector<{self.type_t}> [Direct] (size={size})"
        else:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…