Skip to content

Protocol Buffers Compiler (protoc) plugin allowing aggregate initialization on generated types in C++

License

Notifications You must be signed in to change notification settings

DanShaders/cpp-protoc-initializers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpp-protoc-initializers

WORK IN PROGRESS

This plugin allows using aggregate initialization on Protocol Buffer generated classes.

Invocation: protoc --plugin=protoc-gen-cpp_initializers=<path_to_plugin> --cpp_initializers_out=. PROTO_FILES.

Example:

syntax = "proto3";

package foo;

message Message {
	int32 field;
}
template <typename T>
void foo(const typename T::initializable_type &message_) {
	T message(message_);
}

foo<package::Message>({.field = 2});

About

Protocol Buffers Compiler (protoc) plugin allowing aggregate initialization on generated types in C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published