GithubHelp home page GithubHelp logo

blackmatov / meta.hpp Goto Github PK

View Code? Open in Web Editor NEW
118.0 6.0 8.0 1.92 MB

C++20 Dynamic Reflection Library

Home Page: https://github.com/BlackMATov/meta.hpp

License: MIT License

CMake 0.84% C++ 98.85% Python 0.31%
c-plus-plus cplusplus-20 cpp cpp20 header-only no-dependencies reflection single-header

meta.hpp's Introduction

meta.hpp

C++20 Dynamic Reflection Library

linux darwin windows language license

Requirements

Installation

meta.hpp is a header-only library. All you need to do is copy the headers files from headers directory into your project and include them:

#include "meta.hpp/meta_all.hpp"

Also, you can add the root repository directory to your cmake project:

add_subdirectory(external/meta.hpp)
target_link_libraries(your_project_target PUBLIC meta.hpp::meta.hpp)

Or just use the single-header version of the library, which you can find here.

Features

  • can reflect:
    • arrays
    • classes
    • constructors
    • destructors
    • enums
    • functions
    • member
    • methods
    • numbers
    • pointers
    • references
    • typedefs
    • variables
  • has different behaviour bind policies
  • supports multiple and virtual inheritance
  • allows add additional metadata to all types
  • calls functions/methods with runtime variables
  • doesn't contain 3rd-party dependencies
  • can be used without rtti and exceptions

Documentation

Examples

Alternatives

meta.hpp's People

Contributors

blackmatov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

meta.hpp's Issues

Registering non-copyable classes

If i have a non-copyable class, for example:

class A {
  public:
    A() {
      std::cout << "A constructor" << std::endl;
    }
    ~A() {
      std::cout << "A destructor" << std::endl;
    }

    std::atomic_bool _isInitialized = false; // non copyable member will make class non copyable
};

In the registering phase, the raw_constructor_create function will fail on the static_assert that checks if the class is non copyable.

...
         constexpr bool as_object                       
            = std::is_copy_constructible_v<class_type> 
           && std::is_same_v<Policy, constructor_policy::as_object_t>;

        constexpr bool as_raw_ptr //
            = std::is_same_v<Policy, constructor_policy::as_raw_pointer_t>;

        constexpr bool as_shared_ptr //
            = std::is_same_v<Policy, constructor_policy::as_shared_pointer_t>;

        static_assert(as_object || as_raw_ptr || as_shared_ptr);
...

Can I modify the Policy at the time of registration, somehow? Or does the library not support registering non-copyable classes at all?

"Resolve type by string" feature

I like the idea of a library, but I think there is one feature that would improve its use: the ability to resolve a type by name.
This would allow doing, for example, auto-scripting/auto-serialization of reflected objects.
Something like:

auto type = meta_hpp::get_type_by_name("rectangle");

of course, it requires adding the name "rectangle" to
meta::class_<Rectangle>("rectangle");

But that adds enormous flexibility to the library.

Memeber as getter and setter

Hi,
Thank you for the great library. Hoping to build my game engine reflection on it.
Is it possible for you to add support for adding members without a pointer to a specific region of a class and by specifying just a getter and setter function?

Doesn't compile with C++23 in visual studio 2022 with /std:c++latest

steps to repro:

  1. set C++ Language Standard to Preview - Features from the Latest C++ Working Draft (/std:c++latest)
    Error:

meta.hpp\meta_base\fixed_function.hpp(81,32): error C4996: 'std::aligned_storage_t': warning STL4034: std::aligned_storage and std::aligned_storage_t are deprecated in C++23. Prefer alignas(T) std::byte t_buff[sizeof(T)]. You can define _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING or _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to acknowledge that you have received this warning.

Missing pdb when trying to run

When I launch my program, it crashes when getting to the code containing the meta functions.
It says I'm missing the ucrtbase.pdb.
image

Tons of syntax errors in the header files.

Unfortunately the headers are giving tons of errors and I unfortunately don't know how to fix them as the syntax is obviously correct. If you could help me fix this issue it would be much appreciated.

image

I tried both the single header as well as the multiple headers. And yes I am using C++ Standard 20 and I also tried latest working draft.

Console Output

1>------ Build started: Project: DeceptionC++, Configuration: Release x64 ------
1>ErrorHandling.cpp
1>GameObjectBase.cpp
1>main.cpp
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,30): error C3878: syntax error: unexpected token ',' following 'condition'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,30):
1>missing one of:  ')' ';' ?
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(107,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::constructor_(Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,30): message : error recovery skipped: ', identifier {  . . . ('
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(107,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::constructor_(Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,39): message : parsing resumes here
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(107,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::constructor_(Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,39): error C2760: syntax error: ')' was unexpected here; expected ';'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(107,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::constructor_(Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,39): error C2760: syntax error: ')' was unexpected here; expected 'statement'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(107,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::constructor_(Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,39): message : error recovery skipped: ') <'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(107,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::constructor_(Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,39): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(107,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::constructor_(Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,39): message : error recovery skipped: ') ?'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(107,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::constructor_(Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,39): error C2760: syntax error: ':' was unexpected here; expected ';'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(107,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::constructor_(Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,39): error C3878: syntax error: unexpected token ':' following 'expression_statement'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(107,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::constructor_(Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,39): message : error recovery skipped: ':'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(107,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::constructor_(Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(46,39): message : error recovery skipped: ')'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(107,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::constructor_(Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,30): error C3878: syntax error: unexpected token ',' following 'condition'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,30):
1>missing one of:  ')' ';' ?
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(114,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,30): message : error recovery skipped: ', identifier {  . . . ('
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(114,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,39): message : parsing resumes here
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(114,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,39): error C2760: syntax error: ')' was unexpected here; expected ';'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(114,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,39): error C2760: syntax error: ')' was unexpected here; expected 'statement'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(114,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,39): message : error recovery skipped: ') <'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(114,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,39): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(114,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,39): message : error recovery skipped: ') ?'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(114,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,39): error C2760: syntax error: ':' was unexpected here; expected ';'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(114,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,39): error C3878: syntax error: unexpected token ':' following 'expression_statement'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(114,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,39): message : error recovery skipped: ':'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(114,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(88,39): message : error recovery skipped: ')'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(114,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,30): error C3878: syntax error: unexpected token ',' following 'condition'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,30):
1>missing one of:  ')' ';' ?
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(120,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::method_(std::string,Method,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,30): message : error recovery skipped: ', identifier {  . . . ('
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(120,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::method_(std::string,Method,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,39): message : parsing resumes here
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(120,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::method_(std::string,Method,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,39): error C2760: syntax error: ')' was unexpected here; expected ';'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(120,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::method_(std::string,Method,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,39): error C2760: syntax error: ')' was unexpected here; expected 'statement'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(120,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::method_(std::string,Method,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,39): message : error recovery skipped: ') <'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(120,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::method_(std::string,Method,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,39): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(120,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::method_(std::string,Method,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,39): message : error recovery skipped: ') ?'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(120,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::method_(std::string,Method,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,39): error C2760: syntax error: ':' was unexpected here; expected ';'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(120,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::method_(std::string,Method,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,39): error C3878: syntax error: unexpected token ':' following 'expression_statement'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(120,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::method_(std::string,Method,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,39): message : error recovery skipped: ':'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(120,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::method_(std::string,Method,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\class_bind.hpp(137,39): message : error recovery skipped: ')'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(120,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::class_bind<Class> &meta_hpp::class_bind<Class>::method_(std::string,Method,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,30): error C3878: syntax error: unexpected token ',' following 'condition'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,30):
1>missing one of:  ')' ';' ?
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(221,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::scope_bind &meta_hpp::scope_bind::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,30): message : error recovery skipped: ', identifier {  . . . ('
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(221,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::scope_bind &meta_hpp::scope_bind::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,39): message : parsing resumes here
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(221,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::scope_bind &meta_hpp::scope_bind::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,39): error C2760: syntax error: ')' was unexpected here; expected ';'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(221,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::scope_bind &meta_hpp::scope_bind::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,39): error C2760: syntax error: ')' was unexpected here; expected 'statement'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(221,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::scope_bind &meta_hpp::scope_bind::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,39): message : error recovery skipped: ') <'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(221,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::scope_bind &meta_hpp::scope_bind::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,39): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(221,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::scope_bind &meta_hpp::scope_bind::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,39): message : error recovery skipped: ') ?'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(221,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::scope_bind &meta_hpp::scope_bind::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,39): error C2760: syntax error: ':' was unexpected here; expected ';'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(221,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::scope_bind &meta_hpp::scope_bind::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,39): error C3878: syntax error: unexpected token ':' following 'expression_statement'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(221,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::scope_bind &meta_hpp::scope_bind::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,39): message : error recovery skipped: ':'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(221,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::scope_bind &meta_hpp::scope_bind::function_(std::string,Function,Opts &&...)'
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds\scope_bind.hpp(39,39): message : error recovery skipped: ')'
1>(compiling source file 'main.cpp')
1>C:\Users\levil\source\repos\DeceptionC++\DeceptionC++\meta.hpp\meta_binds.hpp(221,21):
1>This diagnostic occurred in the compiler generated function 'meta_hpp::scope_bind &meta_hpp::scope_bind::function_(std::string,Function,Opts &&...)'
1>Net.cpp
1>Done building project "DeceptionC++.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 1:27 AM and took 02.641 seconds ==========

How to support std::shared_ptr for upcast

for example,
struct A{}
struct B:A{}
class test
{
std::shared_ptr calc()
{
return std::make_shared();
}

how to upcast the result of calc method as std::shared_ptr by reflection.

Registering names for contructor and methods arguments

Hello;

How can i register the arguments names for contructors and methods. For example, i can register methods names this way:

meta::class_<Class>()
.method_("mtd", &Class::mtd);

And i can acess methods and constructor arguments as well. But if i have a method:

void mtd (int a, int b)
{...}

how can i register the names of the two arguments? The same for constructor arguments.

Because i would like to do something like this:

for (const meta::method &methods : classType.get_methods()) {
    auto arity = methods.get_type().get_arity();
    if (arity > 0) {
      std::vector<meta::argument> args = methods.get_arguments();
      for (const meta::argument &arg : args) {
        auto name = arg.get_name();
        ...

but name is blank, because no name was registered for the arguments.

Thanks in advance.

uvalue and polymorphic types

Is my understanding correct that uvalue::try_cast should work in case of casting the derived value to the base?

struct Base { virtual ~Base() {} }; struct Derived : Base {};

...

meta::uvalue value{new Derived()};
auto base = value.try_cast<Base>(); // currently returns nullptr

chaiscript+meta.hpp

It's rather a question, not an issue. I was thinking about auto-binding reflected types to chaiscript, but can't figure out how to glue meta.hpp and chaiscript together.

To bind the type to chaiscript I need explicitly define all type's information: type, ctor, functions, etc.
For example:
chai.add(chaiscript::user_type(), "Vertex");
chai.add(chaiscript::constructor<Vertex(int32_t)>(), "Vertex");
chai.add(chaiscript::fun(&addVertex), "addVertex");

Is there a way to do it automatically using meta.hpp?

Getting the value from a member without knowing the type

Is there a way to get the value from a member without knowing the type? I'm currently iterating through a list of members via the get_memberts() function. I've tried a few different things, but can't seem to make it work.

This is the code:

auto metaData = transform->GetMetaData();
for (const auto& member : metaData.get_members()) {

	const auto value = member.get(transform);
	spdlog::info("name: {}, value: {}",
		member.get_name());
}

Resolve generic std::tuple

Is it possible to identify or resolve a std::tuple<Args...>? What i want to do is, if a meta::any_type is a std::tuple<...>, i want to resolve the internal types of this tuple. There's any way of doing this or i only can resolve a deterministic type?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.