Skip to content

C#-like properties for C++20. This was made to demonstrate a bug in ClangFormat.

License

Notifications You must be signed in to change notification settings

ifarbod/cpp20-property

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

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;
}

About

C#-like properties for C++20. This was made to demonstrate a bug in ClangFormat.

Topics

Resources

License

Stars

Watchers

Forks

Languages