kainjow / Mustache

Mustache text templates for modern C++
Boost Software License 1.0
357 stars 49 forks source link

basic_data could be a std::variant #64

Closed the-moisrex closed 4 months ago

the-moisrex commented 2 years ago

Is there a reason (other than the project being designed for older C++ versions) that basic_data isn't std::variant or at least implemented a bit like std::variant? Why so many unique_ptrs laying around?

private:
    type type_;
    std::unique_ptr<basic_object<string_type>> obj_;
    std::unique_ptr<string_type> str_;
    std::unique_ptr<basic_list<string_type>> list_;
    std::unique_ptr<basic_partial<string_type>> partial_;
    std::unique_ptr<basic_lambda_t<string_type>> lambda_;
kainjow commented 2 years ago

Yes the project was written for C++11.

ivanstepanovftw commented 1 year ago

We are in 2023

the-moisrex commented 1 year ago

I've changed the source code of this project is so many ways that I hardly recognize the old code and I'm still not satisfied with how it's storing the AST.

Here's my implementation which works in C++20.

I still have work to do thought but I have my hands full the framework.

issue, issue, and the most annoying issue.

kainjow commented 4 months ago

I'm happy to review a PR for this change that keeps existing functionality behind some type of if-def. Thanks.