<commit_before>#ifndef _CPP_ARRAY2D_H_
#define _CPP_ARRAY2D_H_

#include "../export.h"
#include <dlib/array2d.h>
#include <dlib/pixel.h>
#include "../shared.h"
#include "../template.h"

using namespace dlib;

#pragma region template

#define array2d_new_template(__TYPE__, error, type, ...) \
ret = new dlib::array2d<__TYPE__>();

#define array2d_new1_template(__TYPE__, error, type, ...) \
ret = new dlib::array2d<__TYPE__>(rows, cols);

#define array2d_data_raw_template(__TYPE__, error, type, ...) \
ret = &(((array2d<__TYPE__>*)array)->[0][0]);

#define array2d_delete_template(__TYPE__, error, type, ...) \
delete ((dlib::array2d<__TYPE__>*)array);

#define array2d_nc_template(__TYPE__, error, type, ...) \
*ret = ((array2d<__TYPE__>*)array)->nc();\
return true;

#define array2d_nr_template(__TYPE__, error, type, ...) \
*ret = ((array2d<__TYPE__>*)array)->nr();\
return true;

#define array2d_size_template(__TYPE__, error, type, ...) \
*ret = ((array2d<__TYPE__>*)array)->size();\
return true;

#define array2d_set_size_template(__TYPE__, error, type, ...) \
((array2d<__TYPE__>*)array)->set_size(rows, cols);\
return true;

#define array2d_row_template(__TYPE__, error, type, ...) \
auto tmp = static_cast<dlib::array2d<__TYPE__>*>(array);\
auto r = (*tmp)[row];\
*ret = new dlib::array2d<__TYPE__>::row(r);<commit_msg>Use begin() method instead of array accessor.<commit_after>#ifndef _CPP_ARRAY2D_H_
#define _CPP_ARRAY2D_H_

#include "../export.h"
#include <dlib/array2d.h>
#include <dlib/pixel.h>
#include "../shared.h"
#include "../template.h"

using namespace dlib;

#pragma region template

#define array2d_new_template(__TYPE__, error, type, ...) \
ret = new dlib::array2d<__TYPE__>();

#define array2d_new1_template(__TYPE__, error, type, ...) \
ret = new dlib::array2d<__TYPE__>(rows, cols);

#define array2d_data_raw_template(__TYPE__, error, type, ...) \
ret = (void*)((array2d<__TYPE__>*)array)->begin();

#define array2d_delete_template(__TYPE__, error, type, ...) \
delete ((dlib::array2d<__TYPE__>*)array);

#define array2d_nc_template(__TYPE__, error, type, ...) \
*ret = ((array2d<__TYPE__>*)array)->nc();\
return true;

#define array2d_nr_template(__TYPE__, error, type, ...) \
*ret = ((array2d<__TYPE__>*)array)->nr();\
return true;

#define array2d_size_template(__TYPE__, error, type, ...) \
*ret = ((array2d<__TYPE__>*)array)->size();\
return true;

#define array2d_set_size_template(__TYPE__, error, type, ...) \
((array2d<__TYPE__>*)array)->set_size(rows, cols);\
return true;

#define array2d_row_template(__TYPE__, error, type, ...) \
auto tmp = static_cast<dlib::array2d<__TYPE__>*>(array);\
auto r = (*tmp)[row];\
*ret = new dlib::array2d<__TYPE__>::row(r);
{'fraction_non_alphanumeric': 0.19851576994434136, 'fraction_numerical': 0.017810760667903526, 'mean_word_length': 5.842639593908629, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3216054', 'n_tokens_mistral': 1026, 'n_tokens_neox': 990, 'n_words': 189}