Skip to content

aleques-tech/librepr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

librepr

C++ library that uses dwarf data to pretty print complex values.

Example:

#include <iostream>

#include <librepr.hpp>

using librepr::repr;

enum class Suit { Clubs, Diamonds, Hearts, Spades };
enum class Rank { Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King };

struct CardBase
{
    int foo = 5;
};

struct Card : CardBase
{
    Suit suit;
    Rank rank;
    double bar = 3.14;
};

int main()
{
    Card c;
    c.suit = Suit::Spades;
    c.rank = Rank::Ace;

    // prints "{.foo=5, .suit=Suit::Spades, .rank=Rank::Ace, .bar=3.14}"
    std::cout << repr(c) << "\n";
};

About

Similar to python's `repr`, for c++

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%