https://github.com/theypsilon/getset
Add trivial getters & setters to your interface in a very simple and extensible way
https://github.com/theypsilon/getset
Last synced: about 1 year ago
JSON representation
Add trivial getters & setters to your interface in a very simple and extensible way
- Host: GitHub
- URL: https://github.com/theypsilon/getset
- Owner: theypsilon
- License: bsl-1.0
- Created: 2014-08-17T03:49:51.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-08-18T16:26:12.000Z (almost 12 years ago)
- Last Synced: 2025-06-08T07:05:35.929Z (about 1 year ago)
- Language: C++
- Homepage:
- Size: 219 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE_1_0.txt
Awesome Lists containing this project
README
getset.hpp [](https://travis-ci.org/theypsilon/getset)
======
```cpp
#include "getset.hpp"
#include
using namespace accessor;
struct Data {
getset a;
getset b;
getset c;
};
int main() {
Data x{"Hello","I'm not a blank space","World."};
x.b(" ");
std::cout << x.a() << x.b() << x.c() << std::endl;
return 0;
}
/* output: "Hello World." */
```
Just add this simple template to your types and you will have a getter & setter interface that eventually you will be able to modify in the future without any modification in client code.
This has **zero** overhead. You may compare the asm this code generates, with the one you get when you replace the getset statements with raw variable declarations and simple assignments.