<commit_before>// Apache Thrift Binary Protocol Struct Writer in C++ 

#include <iostream>
#include <string>
#include <boost/shared_ptr.hpp>
#include <thrift/transport/TSimpleFileTransport.h>
#include <thrift/protocol/TBinaryProtocol.h>

using namespace apache::thrift::transport;

struct Trade {
   char symbol [16];
   double price;
   int size;
};

int main()
{
    Trade trade;
    trade.symbol [0] = 'F'; trade.symbol[1] = '\0';
    trade.price = 13.10;
    trade.size = 2500;

    const std::string path_name("data");
    boost::shared_ptr<TTransport> trans(new TSimpleFileTransport(path_name, false, true));
    apache::thrift::protocol::TBinaryProtocol proto(trans);     	

    int i = 0;
    i += proto.writeStructBegin("Trade");             			     

    i += proto.writeFieldBegin("symbol ", 
                               ::apache::thrift::protocol::T_STRING, 1);
    i += proto.writeString(std::string(trade.symbol));          	
    i += proto.writeFieldEnd();                     		

    i += proto.writeFieldBegin("price ", 
                               ::apache::thrift::protocol::T_DOUBLE, 2);
    i += proto.writeDouble(trade.price);                    
    i += proto.writeFieldEnd();                     

    i += proto.writeFieldBegin("size ", ::apache::thrift::protocol::T_I32, 3);   
    i += proto.writeI32(trade.size);                    
    i += proto.writeFieldEnd();                     

    i += proto.writeFieldStop();   				                 
    i += proto.writeStructEnd();                        	

    std::cout << "Wrote " << i << " bytes to " << path_name << std::endl;
}
<commit_msg>cpp11 update<commit_after>// Apache Thrift Binary Protocol Struct Writer in C++ 

#include <iostream>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <thrift/transport/TSimpleFileTransport.h>
#include <thrift/protocol/TProtocol.h>
#include <thrift/protocol/TBinaryProtocol.h>

using namespace apache::thrift::transport;
using namespace apache::thrift::protocol;

struct Trade {
   char symbol [16];
   double price;
   int size;
};

int main()
{
    Trade trade;
    trade.symbol [0] = 'F'; trade.symbol[1] = '\0';
    trade.price = 13.10;
    trade.size = 2500;

    const std::string path_name("data");
    boost::shared_ptr<TTransport> trans =
        boost::make_shared<TSimpleFileTransport>(path_name, false, true);
    boost::shared_ptr<TProtocol> proto =
        boost::make_shared<TBinaryProtocol>(trans);

    int i = 0;
    i += proto->writeStructBegin("Trade");

    i += proto->writeFieldBegin("symbol ",
                               ::apache::thrift::protocol::T_STRING, 1);
    i += proto->writeString(std::string(trade.symbol));
    i += proto->writeFieldEnd();

    i += proto->writeFieldBegin("price ",
                               ::apache::thrift::protocol::T_DOUBLE, 2);
    i += proto->writeDouble(trade.price);
    i += proto->writeFieldEnd();

    i += proto->writeFieldBegin("size ", ::apache::thrift::protocol::T_I32, 3);
    i += proto->writeI32(trade.size);
    i += proto->writeFieldEnd();

    i += proto->writeFieldStop();
    i += proto->writeStructEnd();

    std::cout << "Wrote " << i << " bytes to " << path_name << std::endl;
}

{'fraction_non_alphanumeric': 0.15565163681284744, 'fraction_numerical': 0.013588634959851761, 'mean_word_length': 2.6890660592255125, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 32, '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': '3291822', 'n_tokens_mistral': 1025, 'n_tokens_neox': 971, 'n_words': 197}