补全边角
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(StructiveInstallConsumer LANGUAGES CXX)
|
||||
include(CTest)
|
||||
find_package(Structive CONFIG REQUIRED COMPONENTS Core Extensions)
|
||||
add_executable(structive_install_consumer main.cpp)
|
||||
target_link_libraries(structive_install_consumer PRIVATE structive::property_core structive::property_extensions)
|
||||
target_compile_features(structive_install_consumer PRIVATE cxx_std_20)
|
||||
add_test(NAME structive_install_consumer COMMAND structive_install_consumer)
|
||||
@@ -0,0 +1,16 @@
|
||||
#include <structive/property/extensions/presentation.hpp>
|
||||
#include <structive/property/property.hpp>
|
||||
struct Consumer_Device : structive::Property_Object<Consumer_Device> {
|
||||
int value{1};
|
||||
};
|
||||
template <>
|
||||
struct structive::Type_Descriptor<Consumer_Device> {
|
||||
static auto get() {
|
||||
return object<Consumer_Device>(field<&Consumer_Device::value>(key<"value">, presentation::label<"Value">));
|
||||
}
|
||||
};
|
||||
int main() {
|
||||
Consumer_Device device;
|
||||
device.write<&Consumer_Device::value>(2);
|
||||
return device.read<&Consumer_Device::value>() == 2 ? 0 : 1;
|
||||
}
|
||||
Reference in New Issue
Block a user