<commit_before>#pragma once
#include "http.h"
#include "json_wrapper.h"
#include "error.h"

namespace SleepyDiscord {
	struct StandardResponse : Response {	//this is just used for the constructor
		StandardResponse(const Response& response) : Response(response) {}
		//operator const Response&() { return *this; }	//never used
	};

	struct BooleanResponse : public StandardResponse {
	private:
		typedef std::function<bool(const Response* response)> BooleanFunction;
		BooleanFunction lambdaFunction;
	public:
		BooleanResponse(const Response& response,
			BooleanFunction lambda = [](const Response* response) { return !response->error(); }
		) :
			StandardResponse(response), lambdaFunction(lambda) {}
		operator bool() const {
			return lambdaFunction(this);
		}
	};
	
	template<class Type>
	struct ObjectResponse : public StandardResponse {
		using StandardResponse::StandardResponse;
		operator Type() {
			return error() ? Type() : Type(&text);
		}

		Type& operator*() const {
			return Type();
		}

		Type* operator->() const {
			return &Type();
		}

		inline Type cast() {
			return operator Type();
		}
	};

	struct ArrayResponseWrapper : public json::BaseArrayWrapper, public StandardResponse {
		using StandardResponse::StandardResponse;
		operator const std::string&() const {
			return text;
		}
	};

	template <class Type>
	using ArrayResponse = json::ArrayWrapper<Type, ArrayResponseWrapper>;
}<commit_msg>Removed ObjectResponse operator-> because it doesn't work<commit_after>#pragma once
#include "http.h"
#include "json_wrapper.h"
#include "error.h"

namespace SleepyDiscord {
	struct StandardResponse : Response {	//this is just used for the constructor
		StandardResponse(const Response& response) : Response(response) {}
		//operator const Response&() { return *this; }	//never used
	};

	struct BooleanResponse : public StandardResponse {
	private:
		typedef std::function<bool(const Response* response)> BooleanFunction;
		BooleanFunction lambdaFunction;
	public:
		BooleanResponse(const Response& response,
			BooleanFunction lambda = [](const Response* response) { return !response->error(); }
		) :
			StandardResponse(response), lambdaFunction(lambda) {}
		operator bool() const {
			return lambdaFunction(this);
		}
	};
	
	template<class Type>
	struct ObjectResponse : public StandardResponse {
		using StandardResponse::StandardResponse;
		operator Type() {
			return error() ? Type() : Type(&text);
		}

		Type& operator*() const {
			return Type();
		}

		inline Type cast() {
			return operator Type();
		}
	};

	struct ArrayResponseWrapper : public json::BaseArrayWrapper, public StandardResponse {
		using StandardResponse::StandardResponse;
		operator const std::string&() const {
			return text;
		}
	};

	template <class Type>
	using ArrayResponse = json::ArrayWrapper<Type, ArrayResponseWrapper>;
}
{'fraction_non_alphanumeric': 0.11553363860514265, 'fraction_numerical': 0.0, 'mean_word_length': 4.843621399176954, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '518242', 'n_tokens_mistral': 855, 'n_tokens_neox': 765, 'n_words': 225}