<commit_before>/* vector.h                                 -*- C++ -*-
   <NAME> (<EMAIL>), 19 Apr 2014
   FreeBSD-style copyright and disclaimer apply

   vector reflection.
*/

#pragma once

#include "reflect.h"
#include "reflect/basics.h"
#include "reflect/function.h"
#include "reflect/operators.h"

#include <vector>

namespace reflect {

/******************************************************************************/
/* REFLECT VECTOR                                                             */
/******************************************************************************/

template<typename T>
struct Reflect< std::vector<T> >
{
    typedef std::vector<T> T_;
    static std::string id()
    {
        return "std::vector<" + typeId<T>() + ">";
    }

    reflectTemplateLoader()

    static void reflect(Type* type_)
    {
        reflectPlumbing();

        reflectTrait(list);
        reflectCustom(valueType) { return type<T>(); };

        reflectFn(size);
        reflectFnTyped(push_back, void (T_::*) (const T&));

        reflectCustom(operator[]) (const T_& value, size_t i) -> const T& {
            return value[i];
        };
        reflectCustom(operator[]) (T_& value, size_t i) -> T& {
            return value[i];
        };

    }
};

} // namespace reflect
<commit_msg>Added rvalue push_back to vector.<commit_after>/* vector.h                                 -*- C++ -*-
   <NAME> (<EMAIL>), 19 Apr 2014
   FreeBSD-style copyright and disclaimer apply

   vector reflection.
*/

#pragma once

#include "reflect.h"
#include "reflect/basics.h"
#include "reflect/function.h"
#include "reflect/operators.h"

#include <vector>

namespace reflect {

/******************************************************************************/
/* REFLECT VECTOR                                                             */
/******************************************************************************/

template<typename T>
struct Reflect< std::vector<T> >
{
    typedef std::vector<T> T_;
    static std::string id() { return "std::vector<" + typeId<T>() + ">"; }

    reflectTemplateLoader()

    static void reflect(Type* type_)
    {
        reflectPlumbing();

        reflectTrait(list);
        reflectCustom(valueType) { return type<T>(); };

        reflectFn(size);
        reflectFnTyped(push_back, void (T_::*) (const T&));
        reflectFnTyped(push_back, void (T_::*) (T&&));

        reflectCustom(operator[]) (const T_& value, size_t i) -> const T& {
            return value[i];
        };
        reflectCustom(operator[]) (T_& value, size_t i) -> T& {
            return value[i];
        };

    }
};

} // namespace reflect

{'fraction_non_alphanumeric': 0.24896887889013875, 'fraction_numerical': 0.0044994375703037125, 'mean_word_length': 2.44702842377261, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3063410', 'n_tokens_mistral': 752, 'n_tokens_neox': 714, 'n_words': 170}