Skip to content

improve the generation of CPP code that can be easily read by humans. #27

@sonygod

Description

@sonygod

for example

template<typename T>
	static std::shared_ptr<std::deque<T>> concat(std::deque<T>* a, std::deque<T>* other) {
		std::shared_ptr<std::deque<T>> tempArray;

		{
			std::shared_ptr<std::deque<T>> result = std::make_shared<std::deque<T>>(std::deque<T>{});

			{
				int _g = 0;
				std::deque<T>* _g1 = a;

				while(_g < (int)(_g1->size())) {
					T obj = (*_g1)[_g];

					++_g;

					{
						result->push_back(obj);
					};
				};
			};

			tempArray = result;
		};

		int _g_current = 0;
		std::deque<T>* _g_array = other;

		while(_g_current < (int)(_g_array->size())) {
			T o = (*_g_array)[_g_current++];

			tempArray->push_back(o);
		};

		return tempArray;
	}

why not like here

#include <deque>
#include <memory>

template<typename T>
static std::shared_ptr<std::deque<T>> concat(std::deque<T>* a, std::deque<T>* other) {
    std::shared_ptr<std::deque<T>> result = std::make_shared<std::deque<T>>();
    
    for (const auto& item : *a) {
        result->push_back(item);
    }
    
    for (const auto& item : *other) {
        result->push_back(item);
    }
    
    return result;
}

Your library is already doing a great job, but there is always room for improvement. Thank you for your efforts :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions