Skip to content

Latest commit

 

History

History
38 lines (32 loc) · 601 Bytes

README.md

File metadata and controls

38 lines (32 loc) · 601 Bytes

cpp20-property

C#-like properties for C++20.

Example usage

#include <iostream>

#include <Propery.hpp>

class ProperyTest
{
public:
    zsl::Property<int> prop{m_something,
        {
            .get = [this](auto& var) constexpr
            {
                return var + 2;
            },
            .set = [this](auto& var, auto value) constexpr
            {
                var = value;
            }
        }
    };

private:
    int m_something = 0;
};

auto main(int argc, char** argv) -> int
{
    ProperyTest t;
    t.prop = 123;
    std::cout << t.prop;
    return 0;
}