rttrorg / rttr

C++ Reflection Library
https://www.rttr.org
MIT License
3.11k stars 429 forks source link

Best way to pass 'no type' to a function? #344

Open sam-apparance opened 1 year ago

sam-apparance commented 1 year ago

I'd like to be able to specify 'no type' as a functions rttr::type parameter and it seems that an invalid type object would make sense here. Even though there is a rttr::type::is_valid() method for checking types are valid it's not clear how to create one or the best way to yield one. Currently I'm using rttr::type::get() as my 'no type' value and comparing explicitly. I guess I could pass a pointer to an rttr::type but this seems an uncomfortable switch from passing rttr::type's around by value everywhere (as I believe they are designed). Any ideas?