doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
35d06d67-7079-491f-b42e-1b9bcbb734e1
{ "language": "C++" }
```c++ /* * Copyright 2017 * * Made by vincent leroy * Mail <vincent.54.leroy@gmail.com> */ // Project includes ------------------------------------------------------------ #include "MainWindow.hpp" // Qt includes ----------------------------------------------------------------- #include <QApplication> #include...
```c++ /* * Copyright 2017 * * Made by vincent leroy * Mail <vincent.54.leroy@gmail.com> */ // Project includes ------------------------------------------------------------ #include "MainWindow.hpp" // Qt includes ----------------------------------------------------------------- #include <QApplication> #include...
e64d02e2-6153-4e3d-b3b0-eb590c8c9549
{ "language": "C++" }
```c++ #include "../guia1/particionar.cpp" #include "../config.hpp" #include <boost/filesystem.hpp> int main() { vec datos; datos.load(config::sourceDir + "/guia2/datos/merval.csv"); mat tuplas(datos.n_elem - 5, 6); for (unsigned int i = 0; i < datos.n_rows - 5; ++i) { tuplas.row(i) = datos.r...
```c++ #include "../guia1/particionar.cpp" #include "../config.hpp" #include <boost/filesystem.hpp> int main() { arma_rng::set_seed_random(); vec datos; datos.load(config::sourceDir + "/guia2/datos/merval.csv"); mat tuplas(datos.n_elem - 5, 6); for (unsigned int i = 0; i < datos.n_rows - 5; ++i)...
e99483e0-c885-42a4-8c2a-426fdb91ca3c
{ "language": "C++" }
```c++ #include <fcntl.h> #include <netinet/in.h> #include <sys/socket.h> #include <glog/logging.h> namespace { const uint32_t k_listen_backlog = 100; } int create_tcp_listen_socket(int port) { struct sockaddr_in addr; int socket_fd = socket(PF_INET, SOCK_STREAM, 0); addr.sin_family = AF_INET; addr.sin_po...
```c++ #include <fcntl.h> #include <netinet/in.h> #include <sys/socket.h> #include <glog/logging.h> namespace { const uint32_t k_listen_backlog = 100; } int create_tcp_listen_socket(int port) { struct sockaddr_in addr; int socket_fd = socket(PF_INET, SOCK_STREAM, 0); int reuse_addr = 1; if (setsockopt(so...
35c0d327-094c-4ea0-8293-7b7115e6ce03
{ "language": "C++" }
```c++ #include <stdio.h> #include "wcl/network/TCPSocket.h" int main(void) { char buffer[4096]; try{ TCPSocket s("10.220.99.84", 55555); s.read((char *)buffer, 4096); printf("Client: Server Said: %s\n", buffer); s.close(); } catch( SocketException* e ) { fprintf( stderr, e->getReason().c_str() ); } ...
```c++ #include <stdio.h> #include "wcl/network/TCPSocket.h" int main(void) { char buffer[4096]; try{ TCPSocket s("127.0.0.1", 55555); s.read((char *)buffer, 4096); printf("Client: Server Said: %s\n", buffer); s.close(); } catch( SocketException* e ) { fprintf( stderr, e->getReason().c_str() ); } re...
efe0f8f9-50b9-4ab7-98ab-cc3631b0e52e
{ "language": "C++" }
```c++ #include "gtest/gtest.h" #include "Token.hpp" class SemanticAnalyser { public: bool analyse(const Tokens& tokens) { return tokens.empty(); } }; constexpr Token createTokenWithZeroValue(TokenType type) { return {type, 0}; } TEST(SemanticAnalyserTest, ShouldAcceptEmptyTokens) { SemanticAnalyser a...
```c++ #include "gtest/gtest.h" #include "Token.hpp" class SemanticAnalyser { public: bool analyse(const Tokens& tokens) { return tokens.empty(); } }; using namespace ::testing; struct SemanticAnalyserTest : public Test { SemanticAnalyser analyser; static constexpr Token createTokenWithZeroValue(Token...
8543ffa9-fe90-4754-9f64-1b499a73dae8
{ "language": "C++" }
```c++ //===- Error.cpp ----------------------------------------------------------===// // // The LLVM Linker // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===---------------------------------------------------------...
```c++ //===- Error.cpp ----------------------------------------------------------===// // // The LLVM Linker // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===---------------------------------------------------------...
51405f9e-7ab7-4ce4-ae8e-f79a9541bbc1
{ "language": "C++" }
```c++ // Test to check if we handle pic code properly. // RUN: %clangxx_xray -fxray-instrument -std=c++11 -fpic %s -o %t // RUN: XRAY_OPTIONS="patch_premain=true verbosity=1 xray_logfile_base=pic-test-logging-" %run %t 2>&1 | FileCheck %s // After all that, clean up the output xray log. // // RUN: rm pic-test-logging...
```c++ // Test to check if we handle pic code properly. // RUN: %clangxx_xray -fxray-instrument -std=c++11 -ffunction-sections \ // RUN: -fdata-sections -fpic -fpie -Wl,--gc-sections %s -o %t // RUN: XRAY_OPTIONS="patch_premain=true verbosity=1 xray_logfile_base=pic-test-logging-" %run %t 2>&1 | FileCheck %s // Af...
ea55b2e7-4780-4b66-bf27-cd524ecda247
{ "language": "C++" }
```c++ #if defined(WIN32) && !defined(_DEBUG) #pragma comment(linker, "/SUBSYSTEM:WINDOWS /entry:mainCRTStartup") #endif #include "Application.h" #include <memory> #include <gloperate-qtapplication/Viewer.h> #include <widgetzeug/dark_fusion_style.hpp> int main(int argc, char * argv[]) { Application app(argc...
```c++ #if defined(WIN32) && !defined(_DEBUG) #pragma comment(linker, "/SUBSYSTEM:WINDOWS /entry:mainCRTStartup") #endif #include "Application.h" #include <memory> #include <gloperate-qtapplication/Viewer.h> #include <widgetzeug/dark_fusion_style.hpp> int main(int argc, char * argv[]) { Application app(argc...
4b658228-9b29-4742-a801-03ea55f3513f
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s // Crasher for PR22929. class Base { virtual void VariadicFunction(...); }; class Derived : public virtual Base { virtual void VariadicFunction(...); }; void Derived::VariadicFunction(...) { }...
```c++ // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s // Crasher for PR22929. class Base { virtual void VariadicFunction(...); }; class Derived : public virtual Base { virtual void VariadicFunction(...); }; void Derived::VariadicFunction(...) { }...
7c37fbe3-12f7-4bee-add3-92fb8d89077e
{ "language": "C++" }
```c++ #include "highlighter.hh" #include "buffer_utils.hh" namespace Kakoune { void Highlighter::highlight(HighlightContext context, DisplayBuffer& display_buffer, BufferRange range) { if (context.pass & m_passes) try { do_highlight(context, display_buffer, range); } catch (runtime_error& er...
```c++ #include "highlighter.hh" #include "buffer_utils.hh" namespace Kakoune { void Highlighter::highlight(HighlightContext context, DisplayBuffer& display_buffer, BufferRange range) { if (context.pass & m_passes) try { do_highlight(context, display_buffer, range); } catch (runtime_error& er...
39c19cb3-34ba-4d7c-8c81-72db4dfd216b
{ "language": "C++" }
```c++ #include <bonefish/wamp_dealer.hpp> #include <bonefish/wamp_session.hpp> #include <iostream> namespace bonefish { wamp_dealer::wamp_dealer() : m_sessions() { } wamp_dealer::~wamp_dealer() { } bool wamp_dealer::attach_session(const std::shared_ptr<wamp_session>& session) { std::cerr << "attach session...
```c++ #include <bonefish/wamp_dealer.hpp> #include <bonefish/wamp_session.hpp> #include <iostream> namespace bonefish { wamp_dealer::wamp_dealer() : m_sessions() { } wamp_dealer::~wamp_dealer() { } bool wamp_dealer::attach_session(const std::shared_ptr<wamp_session>& session) { std::cerr << "attach session...
f889f927-e844-460a-9b60-ca5424ddda5b
{ "language": "C++" }
```c++ #include <iostream> #include "CompileToBash.h" #include "Parser.h" void compile_to_bash(std::ostream &os, Bish::AST *ast) { Bish::CompileToBash compile(os); ast->accept(&compile); } int main(int argc, char **argv) { if (argc < 2) { std::cerr << "USAGE: " << argv[0] << " <INPUT>\n"; ...
```c++ #include <iostream> #include "CompileToBash.h" #include "Parser.h" void compile_to_bash(std::ostream &os, Bish::AST *ast) { os << "#!/bin/bash\n"; Bish::CompileToBash compile(os); ast->accept(&compile); } int main(int argc, char **argv) { if (argc < 2) { std::cerr << "USAGE: " << argv[0...
7d74647d-cfef-4cda-8942-c7e18c3172d5
{ "language": "C++" }
```c++ // // CRectangleShape.cpp // MenuTest // // Created by Tim Brier on 14/05/2015. // // #include "CRectangleShape.hpp" CRectangleShape::CRectangleShape(CVector2f size) { CRectangleShape(size.x, size.y); } CRectangleShape::CRectangleShape(float width, float height) : CConvexShape(4) { setPoint(0, CVec...
```c++ // // CRectangleShape.cpp // MenuTest // // Created by Tim Brier on 14/05/2015. // // #include "CRectangleShape.hpp" CRectangleShape::CRectangleShape(CVector2f size) : CRectangleShape(size.x, size.y) { } CRectangleShape::CRectangleShape(float width, float height) : CConvexShape(4) { setPoint(0, CVecto...
77b246cc-3527-4d62-b23b-0039ee43ab92
{ "language": "C++" }
```c++ #include <random> #include <vector> #include <algorithm> #include "Statistic.hpp" #include <cstdlib> namespace cctag { namespace numerical { static constexpr size_t MAX_POINTS = 1000; static constexpr size_t MAX_RANDOMNESS = 10000000; struct Randomness : public std::vector<unsigned short> { Randomness(); ...
```c++ #include <algorithm> #include "Statistic.hpp" #include "utils/pcg_random.hpp" namespace cctag { namespace numerical { void rand_5_k(std::array<int, 5>& perm, size_t N) { static thread_local pcg32 rng(271828); auto it = perm.begin(); int r; for (int i = 0; i < 5; ++i) { do { r = rng(N);...
100fc3d9-a566-44dd-bc79-57abe1f08fbc
{ "language": "C++" }
```c++ ``` Add test case in main()
```c++ #include <stdio.h> #include <stdlib.h> int *list; int size; int sum; int main(void) { size = 9; sum = 15; list = (int *)malloc(sizeof(int) * size); list[0] = 1; list[1] = 5; list[2] = 8; list[3] = 3; list[4] = 7; list[5] = 12; list[6] = 11; list[7] = 2; list[8] ...
e23084fa-646e-4dff-af2f-29cfaa79cb5c
{ "language": "C++" }
```c++ #include <omp.h> #include "proctor/detector.h" #include "proctor/proctor.h" #include "proctor/scanning_model_source.h" using pcl::proctor::Detector; //using pcl::proctor::ProctorMPI; using pcl::proctor::Proctor; using pcl::proctor::ScanningModelSource; Detector detector; Proctor proctor; int main(int argc, c...
```c++ #include <omp.h> #include "proctor/detector.h" #include "proctor/proctor.h" #include "proctor/scanning_model_source.h" using pcl::proctor::Detector; //using pcl::proctor::ProctorMPI; using pcl::proctor::Proctor; using pcl::proctor::ScanningModelSource; Detector detector; Proctor proctor; int main(int argc, c...
055e39d0-7484-4b70-bdbe-ecfa55a18f12
{ "language": "C++" }
```c++ #include "canwrite.h" #include "canutil_pic32.h" #include "bitfield.h" #include "log.h" void copyToMessageBuffer(uint64_t source, uint8_t* destination) { for(int i = 0; i < 8; i++) { destination[i] = ((uint8_t*)&source)[i]; } } bool sendCanMessage(CanBus* bus, CanMessage request) { CAN::TxM...
```c++ #include "canwrite.h" #include "canutil_pic32.h" #include "bitfield.h" #include "log.h" void copyToMessageBuffer(uint64_t source, uint8_t* destination) { for(int i = 0; i < 8; i++) { destination[i] = ((uint8_t*)&source)[i]; } } bool sendCanMessage(CanBus* bus, CanMessage request) { CAN::TxM...
a4b53002-731d-4a6f-a868-3417eb9bd365
{ "language": "C++" }
```c++ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
```c++ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
141a5206-41ac-491a-83c5-a50a3c455e8d
{ "language": "C++" }
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/base/network_change_notifier_win.h" #include <iphlpapi.h> #include <winsock2.h> #pragma comment(lib, "iphlpapi.lib") namespace...
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/base/network_change_notifier_win.h" #include <iphlpapi.h> #include <winsock2.h> #pragma comment(lib, "iphlpapi.lib") namespace...
3d137ce1-f6ab-4b54-9343-ba26028c40c5
{ "language": "C++" }
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/disk_cache/cache_util.h" #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" namespace dis...
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/disk_cache/cache_util.h" #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" namespace dis...
dba4b1ab-9d11-4ee1-815e-4e5ebd95ca5c
{ "language": "C++" }
```c++ /*** This is a simple demo project that you can copy to get started. Comments blocks starting with '***' and subsequent non-empty lines are automatically added to this project's wiki page. */ #include <stdio.h> #include <vector> #include <iostream> #include "Maxfiles.h" #include "MaxSLiCInterface....
```c++ /*** This is a simple demo project that you can copy to get started. Comments blocks starting with '***' and subsequent non-empty lines are automatically added to this project's wiki page. */ #include <stdio.h> #include <vector> #include <iostream> #include "Maxfiles.h" #include "MaxSLiCInterface....
d72e16aa-7fbb-4da9-ac8f-f288384abd32
{ "language": "C++" }
```c++ /********************************************************************** * * GEOS - Geometry Engine Open Source * http://geos.osgeo.org * * Copyright (C) 2001-2002 Vivid Solutions Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licen...
```c++ /********************************************************************** * * GEOS - Geometry Engine Open Source * http://geos.osgeo.org * * Copyright (C) 2001-2002 Vivid Solutions Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licen...
23d681bc-397d-44db-9387-6a9074fd60df
{ "language": "C++" }
```c++ #include "gamelib/sprite/SpriteData.hpp" #include <cmath> namespace gamelib { AnimationData::AnimationData() : length(1), speed(0), offset(0) { } void AnimationData::update(float fps) { offset = std::fmod(offset + speed / fps, length); } sf::IntRect Anim...
```c++ #include "gamelib/sprite/SpriteData.hpp" #include <cmath> namespace gamelib { AnimationData::AnimationData() : length(1), speed(0), offset(0) { } void AnimationData::update(float fps) { if (length > 1 && speed != 0) offset = std::fmod(offset + speed /...
9e785252-a7df-45da-bed0-07fa4399f82f
{ "language": "C++" }
```c++ /* MIT License Copyright (c) 2017 Blockchain-VCS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
```c++ /* MIT License Copyright (c) 2017 Blockchain-VCS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
88f8c68c-0b44-4ae3-98f1-a1f58075a0a6
{ "language": "C++" }
```c++ /* Copyright (c) 2014, J.D. Koftinoff Software, Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, thi...
```c++ /* Copyright (c) 2014, J.D. Koftinoff Software, Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, thi...
c750317c-71de-4bdd-b67e-4a0c72270cdc
{ "language": "C++" }
```c++ #include "librt_error.h" using namespace librt; Error::Error() : errorCode_(Error::Code::Ok), message_() { } Error::Error(Error::Code errorCode, std::__cxx11::string &&message) : errorCode_(errorCode), message_(message) { } Error::Error(Error &&other) : errorCode_(other.errorCode_), m...
```c++ #include "librt_error.h" using namespace librt; Error::Error() : errorCode_(Error::Code::Ok), message_() { } Error::Error(Error::Code errorCode, std::string &&message) : errorCode_(errorCode), message_(message) { } Error::Error(Error &&other) : errorCode_(other.errorCode_), message_(s...
0aa83376-07ac-444c-949b-944bb30e9d0b
{ "language": "C++" }
```c++ //======================================================================= // Copyright Baptiste Wicht 2011. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //==============================================...
```c++ //======================================================================= // Copyright Baptiste Wicht 2011. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //==============================================...
aba39b0d-1dd7-4077-b12a-a575aecb33b5
{ "language": "C++" }
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/glue/data_type_controller.h" #include "s...
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/glue/data_type_controller.h" #include "s...
6d6a1c06-744f-42d0-a2ab-215fc3911176
{ "language": "C++" }
```c++ #include <string.h> #include "tree_sitter/runtime.h" void test_log(void *payload, TSLogType type, const char *string) { } TSLogger logger = { .log = test_log, }; extern "C" const TSLanguage *TS_LANG(); extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { const char *str = reinterpret...
```c++ #include <string.h> #include "tree_sitter/runtime.h" void test_log(void *payload, TSLogType type, const char *string) { } TSLogger logger = { .log = test_log, }; extern "C" const TSLanguage *TS_LANG(); extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { const char *str = reinterpret...
66f437e3-d95f-44e4-9f36-e6016ae292f0
{ "language": "C++" }
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "datastore.h" using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert; namespace YouDataStoreTests { TEST_CLASS(DataStoreApiTest) { public: TEST_METHOD(Post_EmptyTask_Test) { // You::DataStore::DataStore sut; // sut.post(std::unordered_ma...
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "datastore.h" using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert; namespace YouDataStoreTests { TEST_CLASS(DataStoreApiTest) { public: TEST_METHOD(DataStoreDummyTest) { // You::DataStore::DataStore sut; // sut.post(std::unordered_map...
2fbdf8b5-efee-4ede-a071-4ba0610f4c47
{ "language": "C++" }
```c++ #include <iostream> #include "EventAction.hh" #include "G4Event.hh" #include "RunAction.hh" #include "Run.hh" EventAction::EventAction(): G4UserEventAction{}, _draw_flag("all") { } EventAction::~EventAction() { } void EventAction::BeginOfEventAction(const G4Event* evt) { G4cout << "EV: " << evt-...
```c++ #include <iostream> #include "EventAction.hh" #include "G4Event.hh" #include "RunAction.hh" #include "Run.hh" EventAction::EventAction(): G4UserEventAction{}, _draw_flag("all") { } EventAction::~EventAction() { } void EventAction::BeginOfEventAction(const G4Event*) { // G4cout << "EV: " << evt->...
b87f63a3-b812-49f8-84e4-85e02797ef28
{ "language": "C++" }
```c++ #include "cardreader.h" #include <QEvent> #include <QKeyEvent> bool CardReader::eventFilter(QObject *object, QEvent *event) { if (event->type() != QEvent::KeyPress) { return false; } if (cardNumber.isEmpty()) { writeTime.start(); } //accumulate characters QKeyEvent *keyEvent = static_cast<QKeyEvent...
```c++ #include "cardreader.h" #include <QEvent> #include <QKeyEvent> bool CardReader::eventFilter(QObject *object, QEvent *event) { if (event->type() != QEvent::KeyPress) { return false; } if (cardNumber.isEmpty()) { writeTime.start(); } //accumulate characters QKeyEvent *keyEvent = static_cast<QKeyEvent...
3ef0c0b1-b242-4460-86ae-2b642d94c533
{ "language": "C++" }
```c++ #include <hw/serial.hpp> extern "C" void __serial_print1(const char* cstr) { const uint16_t port = 0x3F8; // Serial 1 while (*cstr) { while (not (hw::inb(port + 5) & 0x20)); hw::outb(port, *cstr++); } } ``` Initialize the default serial port properly
```c++ #include <hw/serial.hpp> extern "C" void __serial_print1(const char* cstr) { const uint16_t port = 0x3F8; // Serial 1 static bool init = false; if (!init) { init = true; // properly initialize serial port hw::outb(port + 1, 0x00); // Disable all interrupts hw::outb(port + 3, 0x80); /...
6fa738a4-d1f6-47eb-8ff3-2d45d7f64895
{ "language": "C++" }
```c++ #include "mainwindow.h" #include <QGridLayout> #include <QLabel> #include <QEvent> #include <QKeyEvent> #include <iostream> MainWindow::MainWindow(QWidget *parent) { QGridLayout *layout = new QGridLayout(this); layout->addWidget(new QLabel("ARK kryssesystem")); //install cardReader as an filter which inter...
```c++ #include "mainwindow.h" #include <QGridLayout> #include <QLabel> #include <QEvent> #include <QKeyEvent> #include <iostream> MainWindow::MainWindow(QWidget *parent) { QGridLayout *layout = new QGridLayout(this); layout->addWidget(new QLabel("ARK kryssesystem. Bipp et kort:")); QLabel *testLabel = new QLabel...
9bd9623c-b37b-4d19-8f73-d57b98082b46
{ "language": "C++" }
```c++ /* Copyright (C) 2014,2015,2018 Rodrigo Jose Hernandez Cordoba Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law o...
```c++ /* Copyright (C) 2014,2015,2018,2019 Rodrigo Jose Hernandez Cordoba Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable ...
7ca40a80-eeb1-4898-b83f-cb891210edf0
{ "language": "C++" }
```c++ #include "Core.h" #include "IntPtr.h" #include "uhx/ue/RuntimeLibrary.h" #include "HAL/PlatformAtomics.h" static int uhx_tls_slot = 0; #if defined(_MSC_VER) unreal::UIntPtr *uhx::ue::RuntimeLibrary_obj::tlsObj = nullptr; #elif defined(__GNUC__) thread_local unreal::UIntPtr *uhx::ue::RuntimeLibrary_obj::tlsObj ...
```c++ #ifndef UHX_NO_UOBJECT #include "Core.h" #include "IntPtr.h" #include "uhx/ue/RuntimeLibrary.h" #include "HAL/PlatformAtomics.h" static int uhx_tls_slot = 0; #if defined(_MSC_VER) unreal::UIntPtr *uhx::ue::RuntimeLibrary_obj::tlsObj = nullptr; #elif defined(__GNUC__) thread_local unreal::UIntPtr *uhx::ue::Run...
50d1d892-a3e8-443c-b702-e9b1afea5b22
{ "language": "C++" }
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/message_loop.h" #include "base/perf_test_suite.h" #include "chrome/common/chrome_paths.cc" int main(int argc, char **argv)...
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/message_loop.h" #include "base/perf_test_suite.h" #include "chrome/common/chrome_paths.cc" int main(int argc, char **argv)...
fb714a0b-4172-4102-9e5f-964cdf6b3363
{ "language": "C++" }
```c++ // Test main file for the Player and Team classes #include "Player.hpp" #include "Team.hpp" int main() { // Don't do anything return 0; }``` Test code from assignment description
```c++ // Test main file for the Player and Team classes #include "Player.hpp" #include "Team.hpp" #include <string> #include <iostream> int main() { // Test code from the assignment description Player::Player p1("Charlotte", 24, 10, 7); Player::Player p2("Emily", 21, 13, 9); Player::Player p3("Anne"...
5765aff5-7ddc-40a8-84d4-32535f3b85e3
{ "language": "C++" }
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/basictypes.h" #include "base/file_path.h" #include "build/build_config.h" #include "chrome/test/automation/tab_proxy.h" #include...
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/basictypes.h" #include "base/file_path.h" #include "build/build_config.h" #include "chrome/test/automation/tab_proxy.h" #include...
9cffe609-ac54-47a6-9aa5-66d806fab665
{ "language": "C++" }
```c++ /* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "AndroidTextInputState.h" #include <react/renderer/components/text/conversions.h> #include <react/renderer/debug/d...
```c++ /* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "AndroidTextInputState.h" #include <react/renderer/components/text/conversions.h> #include <react/renderer/debug/d...
c083ef42-993d-4035-99c8-a0c4dc64cd7a
{ "language": "C++" }
```c++ // Copyright (C) 2015 Elviss Strazdins // This file is part of the Ouzel engine. #include "Application.h" ouzel::AppPtr ouzelMain(const std::vector<std::string>& args) { std::shared_ptr<ouzel::Application> application(new ouzel::Application()); return application; } ``` Use make_shared instead of...
```c++ // Copyright (C) 2015 Elviss Strazdins // This file is part of the Ouzel engine. #include "Application.h" ouzel::AppPtr ouzelMain(const std::vector<std::string>& args) { std::shared_ptr<ouzel::Application> application = std::make_shared<ouzel::Application>(); return application; } ```
a2c79b7f-4875-429c-a5c0-8a8ce25cb2d6
{ "language": "C++" }
```c++ /** * fastcall.cpp * * This file holds some PHP functions implementation in C directly. * */ #include "includes.h" namespace Php { bool class_exists(const std::string &classname, bool autoload) { // we need the tsrm_ls variable TSRMLS_FETCH(); zend_class_entry **ce; ...
```c++ /** * fastcall.cpp * * This file holds some PHP functions implementation in C directly. * */ #include "includes.h" namespace Php { bool class_exists(const std::string &classname, bool autoload) { // we need the tsrm_ls variable TSRMLS_FETCH(); zend_class_entry **ce; ...
2b5f979d-eb5e-4e44-b172-3b7eead6c773
{ "language": "C++" }
```c++ #include <jni.h> #include <string> #include "SpatialFilter.h" #include "VideoProcessor.h" extern "C" jstring Java_cn_edu_seu_evmhr_MainActivity_stringFromJNI( JNIEnv *env, jobject /* this */, jstring jFileName) { const char* jnamestr = env->GetStringUTFChars(jFileName, NULL); V...
```c++ #include <jni.h> #include <string> #include "SpatialFilter.h" #include "VideoProcessor.h" extern "C" jstring Java_cn_edu_seu_evmhr_MainActivity_stringFromJNI( JNIEnv *env, jobject /* this */, jstring jFileName) { const char* jnamestr = env->GetStringUTFChars(jFileName, NULL); V...
d63cb8d4-617e-4f12-842d-5ac94c859b31
{ "language": "C++" }
```c++ #include "SharedResource.h" #define BOOST_TEST_MAIN #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_CASE(Basic_construction) { SharedResource<int> shared_int; } BOOST_AUTO_TEST_CASE(Construction_with_argument) { SharedResource<int> shared_int(5); } BOOST_AUTO_TEST_CASE(Construction_no_default_...
```c++ #include "SharedResource.h" #define BOOST_TEST_MAIN #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_CASE(Basic_construction) { SharedResource<int> shared_int; } BOOST_AUTO_TEST_CASE(Construction_with_argument) { SharedResource<int> shared_int(5); } BOOST_AUTO_TEST_CASE(Construction_no_default_...
7b3751b7-0dc3-4e0e-a658-a68382e4a72b
{ "language": "C++" }
```c++ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "checksumaggregators.h" namespace proton::bucketdb { std::unique_ptr<ChecksumAggregator> ChecksumAggregator::create(ChecksumType type, BucketChecksum seed) { switch (type) { case C...
```c++ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "checksumaggregators.h" namespace proton::bucketdb { std::unique_ptr<ChecksumAggregator> ChecksumAggregator::create(ChecksumType type, BucketChecksum seed) { switch (type) { case C...
35b4718d-9eba-49a4-a2c6-5382dd3affbb
{ "language": "C++" }
```c++ // cc.in79 // problem with templatized forward decl? // no, was a problem with templatized prototypes class istream; template<class TP> class smanip; //template<class TP> class smanip {}; template<class TP> inline istream& operator>>(istream& i, const smanip<TP>& m); //int foo(smanip<TP> &m); typedef smanip<...
```c++ // in/t0079.cc // problem with templatized forward decl? // no, was a problem with templatized prototypes class istream; template<class TP> class smanip; //template<class TP> class smanip {}; template<class TP> inline istream& operator>>(istream& i, const smanip<TP>& m); //int foo(smanip<TP> &m); typedef sma...
45f3aa2e-4ad3-4f4e-b50a-8ff02785c7b0
{ "language": "C++" }
```c++ #include <ostree.h> #include <stdlib.h> extern "C" OstreeDeployment *ostree_sysroot_get_booted_deployment(OstreeSysroot *self) { (void)self; const char *hash = getenv("OSTREE_HASH"); return ostree_deployment_new(0, "dummy-os", hash, 1, hash, 1); } extern "C" const char *ostree_deployment_get_csum(OstreeD...
```c++ #include <ostree.h> #include <stdlib.h> extern "C" OstreeDeployment *ostree_sysroot_get_booted_deployment(OstreeSysroot *self) { (void)self; static OstreeDeployment *deployment; if (deployment != nullptr) { return deployment; } const char *hash = getenv("OSTREE_HASH"); deployment = ostree_depl...
2044a67c-8825-4675-996b-07ad9f49f905
{ "language": "C++" }
```c++ //===- AArch64MachineLegalizer.cpp -------------------------------*- C++ -*-==// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===- AArch64MachineLegalizer.cpp -------------------------------*- C++ -*-==// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
cf435111-0650-4ed9-a6dd-ecda6d711b47
{ "language": "C++" }
```c++ #include <memory> #include "PPMLoader.hpp" std::shared_ptr<Image> PPMLoader::load(const char *pathToImage) { FILE *file = fopen(pathToImage, "r"); char magicNumber[8]; fscanf(file, "%s\n", magicNumber); int width, height; fscanf(file, "%d %d\n", &width, &height); int maxValue; fscanf(file, "%d\n", &ma...
```c++ #include <memory> #include "PPMLoader.hpp" std::shared_ptr<Image> PPMLoader::load(const char *pathToImage) { FILE *file = fopen(pathToImage, "r"); char magicNumber[8]; fscanf(file, "%s\n", magicNumber); int width, height; fscanf(file, "%d %d\n", &width, &height); int maxValue; fscanf(file, "%d\n", &ma...
5b0ef2a5-d5c2-4887-a483-ac82f7705cc2
{ "language": "C++" }
```c++ // Includes. #include "UI/mainwindow.h" #include "App/App.h" #include "App/Factories/AdditionNFDelegate.h" #include "App/Factories/ConstantNFDelegate.h" #include "App/Factories/PrinterNFDelegate.h" #include "App/Factories/TextFileNFDelegate.h" #include "System/QtBasedFileSystem.h" // Qt. #include <QApplicati...
```c++ // Includes. #include "UI/mainwindow.h" #include "App/App.h" #include "App/Factories/AdditionNFDelegate.h" #include "App/Factories/ConstantNFDelegate.h" #include "App/Factories/PrinterNFDelegate.h" #include "App/Factories/TextFileNFDelegate.h" #include "System/QtBasedFileSystem.h" // Qt. #include <QApplicati...
0277d6a7-3d1a-4aa1-a8e7-a5362504392d
{ "language": "C++" }
```c++ #include <QApplication> #include <QtDeclarative> #include <QDeclarativeView> #include <QDeclarativeContext> #include "settingspersistor.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); QSettings settings("qmltweeter.conf", QSettings::IniFormat); settings.sync(); QDeclarativ...
```c++ #include <QApplication> #include <QtDeclarative> #include <QDeclarativeView> #include <QDeclarativeContext> #include "settingspersistor.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); QSettings settings("qmltweeter.conf", QSettings::IniFormat); settings.sync(); QDeclarativ...
d9561ab2-f122-4bd3-9de8-848d0a684ede
{ "language": "C++" }
```c++ // request symbols #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/CValuePrinter.h" #include "cling/Interpreter/DynamicExprInfo.h" #include "cling/Interpreter/InterpreterCallbacks.h" #include "cling/Interpreter/LookupHelper.h" #include "cling/Interpreter/ValuePrinter.h" #include "cling/Int...
```c++ // request symbols #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/CValuePrinter.h" #include "cling/Interpreter/DynamicExprInfo.h" #include "cling/Interpreter/InterpreterCallbacks.h" #include "cling/Interpreter/LookupHelper.h" #include "cling/Interpreter/ValuePrinter.h" #include "cling/Int...
9aeab388-fb43-481f-829d-42d9baa25414
{ "language": "C++" }
```c++ /* * Copyright (c) , Arm Limited and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LI...
```c++ /* * Copyright (c) , Arm Limited and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LI...
9b9ae9d5-a757-4f6a-a770-53cdc577620a
{ "language": "C++" }
```c++ /* * dis.cpp * * Created on: Sep 20, 2015 * Author: anon */ #include "arm/ARMDisassembler.h" #include <memory> #include <string> #include <cstdint> #include <iostream> using namespace std; using namespace Disassembler; int main(int argc, char **argv) { if (argc < 2) { cerr << "Usage: ....
```c++ /* * dis.cpp * * Created on: Sep 20, 2015 * Author: anon */ #include "arm/ARMDisassembler.h" #include <memory> #include <string> #include <cstdint> #include <iostream> using namespace std; using namespace Disassembler; int main(int argc, char **argv) { if (argc < 2) { cerr << "Usage: ....
b1e90060-1b5a-4b3b-a920-16ebbc5466cb
{ "language": "C++" }
```c++ #include "util/testing.h" #include <gflags/gflags.h> #include <glog/logging.h> #include <gtest/gtest.h> namespace cert_trans { namespace test { void InitTesting(const char* name, int* argc, char*** argv, bool remove_flags) { // Change the defaults. Can be overridden on command line. // Lo...
```c++ #include "util/testing.h" #include <event2/thread.h> #include <gflags/gflags.h> #include <glog/logging.h> #include <gtest/gtest.h> namespace cert_trans { namespace test { void InitTesting(const char* name, int* argc, char*** argv, bool remove_flags) { // Change the defaults. Can be overridd...
0180a542-a10f-427b-b7fd-260f2191cb4a
{ "language": "C++" }
```c++ // REQUIRES: static-analyzer // RUN: clang-tidy %s -checks='-*,clang-analyzer-*' -- | FileCheck %s extern void *malloc(unsigned long); extern void free(void *); void f() { int *p = new int(42); delete p; delete p; // CHECK: warning: Attempt to free released memory [clang-analyzer-cplusplus.NewDelete] } ...
```c++ // REQUIRES: static-analyzer // RUN: clang-tidy %s -checks='-*,clang-analyzer-*' -- | FileCheck %s extern void *malloc(unsigned long); extern void free(void *); void f() { int *p = new int(42); delete p; delete p; // CHECK: warning: Attempt to delete released memory [clang-analyzer-cplusplus.NewDelete] ...
d017ee33-2421-426c-9a97-f6097070b800
{ "language": "C++" }
```c++ #include "arithmetics.hpp" namespace arithmetics { int add(int a, int b) { return a + b; } int add_buggy(int a, int b) { return a + b + 1; } } ``` Fix bug to see Travis succeed
```c++ #include "arithmetics.hpp" namespace arithmetics { int add(int a, int b) { return a + b; } int add_buggy(int a, int b) { return a + b; } } ```
2887b7ad-3268-4379-ba06-fb10f3a74e9c
{ "language": "C++" }
```c++ #include <numeric> #include <vector> #include SPECIFIC_HEADER int main(int /*argc*/, char** /*argv*/) { constexpr unsigned num_entries = 1e7; std::vector<int> in(num_entries); std::iota(std::begin(in), std::end(in), 0); auto out = product_except(in); bool success = out[1] == 0; return !success; ...
```c++ #include <numeric> #include <vector> #include SPECIFIC_HEADER int main(int /*argc*/, char** /*argv*/) { constexpr unsigned num_entries = 10000000; std::vector<int> in(num_entries); std::iota(std::begin(in), std::end(in), 0); auto out = product_except(in); bool success = out[1] == 0; return !succ...
4a1339bd-6d6b-4dbd-a6b2-77148e27ed72
{ "language": "C++" }
```c++ #include <iostream> #include <algorithm> #include "io/PGMIO.hpp" #include "matrix/Matrix.hpp" using namespace sipl; int main(int argc, char** argv) { if (argc < 2) { std::cout << "Usage:" << std::endl; std::cout << " " << argv[0] << " file.pgm" << std::endl; std::exit(1); } ...
```c++ #include <iostream> #include <algorithm> #include "io/PgmIO.hpp" #include "matrix/Matrix.hpp" using namespace sipl; int main(int argc, char** argv) { if (argc < 3) { std::cout << "Usage:" << std::endl; std::cout << " " << argv[0] << " infile.pgm outfile.pgm" << std::end...
0a627553-f075-4080-87ed-4543efe5d212
{ "language": "C++" }
```c++ #include <iostream> #include <fstream> #include <memory> #include "..\..\shared\ProblemEngine.h" int FindSingleElement(const std::shared_ptr<int>& inputArray, int size); int main(int argc, char * argv[]) { ProblemEngine engine("input.txt"); if (!engine.IsFileOk()) { std::cout << "Unable to open input.txt...
```c++ #include <iostream> #include <fstream> #include <memory> #include "..\..\shared\ProblemEngine.h" int FindSingleElement(const std::shared_ptr<int>& inputArray, int size); int main(int argc, char * argv[]) { ProblemEngine engine("input.txt"); if (!engine.IsFileOk()) { std::cout << "Unable to open input.txt...
e239071b-2369-4343-a2a6-bac118acb7b3
{ "language": "C++" }
```c++ #include <Eigen/Core> #include "./test.h" #include "../src/labelling/labels.h" #include "../src/labelling/label.h" TEST(Test_Labels, ChangeNotification) { Labels labels; int changedLabelId = -1; Labels::Action receivedAction; auto removeSubscription = labels.subscribe([&changedLabelId, &receivedAction...
```c++ #include <Eigen/Core> #include "./test.h" #include "../src/labelling/labels.h" #include "../src/labelling/label.h" TEST(Test_Labels, ChangeNotification) { Labels labels; int changedLabelId = -1; Labels::Action receivedAction; auto removeSubscription = labels.subscribe([&changedLabelId, &receivedAction...
df31e56d-2f0f-407a-bde7-998004fd3bb4
{ "language": "C++" }
```c++ //===--------------------- cxa_thread_atexit_test.cpp ---------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
```c++ //===--------------------- cxa_thread_atexit_test.cpp ---------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
e8a9f280-5eca-4625-9df0-b238bd1275ab
{ "language": "C++" }
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_switches.h" IN_PROC_BR...
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_switches.h" IN_PROC_BR...
b0ba4129-4de6-46d2-9b7e-9f1ebf0f3316
{ "language": "C++" }
```c++ #include "pch.h" #include "style.h" using namespace Windows::Foundation; style::style() : fill_(paint_type::color, Colors::Black) , stroke_(paint_type::none, Colors::Black) , strokeWidth_(length{ 0, unit::unspecified }) { } ICanvasBrush^ style::fillBrush(ICanvasResourceCreator^ resourceCreator) ...
```c++ #include "pch.h" #include "style.h" using namespace Windows::Foundation; style::style() : fill_(paint_type::color, Colors::Black) , stroke_(paint_type::none, Colors::Black) , strokeWidth_(length{ 1, unit::unspecified }) { } ICanvasBrush^ style::fillBrush(ICanvasResourceCreator^ resourceCreator) ...
d2373ae8-4518-4701-96f6-c5b1436868af
{ "language": "C++" }
```c++ // // Copyright (c) 2010 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // #include <math.h> #include <stdlib.h> #include "util.h" #ifdef _MSC_VER #include <locale.h> #else #include <sstream> #endi...
```c++ // // Copyright (c) 2010 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // #include <math.h> #include <stdlib.h> #include "util.h" #ifdef _MSC_VER #include <locale.h> #else #include <sstream> #endi...
f6b1ba04-b684-427a-a94c-9f3524fc444b
{ "language": "C++" }
```c++ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "webkit/support/gc_extension.h" #include "v8/include/v8.h" const char kGCExtensionName[] = "v8/GCController"; namespace extensions_...
```c++ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "webkit/support/gc_extension.h" #include "v8/include/v8.h" const char kGCExtensionName[] = "v8/GCController"; namespace extensions_...
8231cbcb-3bdf-4718-bbe7-ed669853e202
{ "language": "C++" }
```c++ #include "HalideRuntime.h" #include "runtime_internal.h" extern "C" { WEAK __attribute__((always_inline)) int halide_profiler_set_current_func(halide_profiler_state *state, int tok, int t) { __sync_synchronize(); state->current_func = tok + t; __sync_synchronize(); return 0; } } ``` Use a vol...
```c++ #include "HalideRuntime.h" #include "runtime_internal.h" extern "C" { WEAK __attribute__((always_inline)) int halide_profiler_set_current_func(halide_profiler_state *state, int tok, int t) { // Do a volatile store to discourage llvm from reordering it. volatile int *ptr = &(state->current_func); *p...
1a1a90e4-d96d-4972-8a01-5193d52fca23
{ "language": "C++" }
```c++ #include "pch.h" #include "json_rpc_debug_logger.h" #include <QDebug> namespace jcon { void JsonRpcDebugLogger::logInfo(const QString& message) { qDebug().noquote() << message; } void JsonRpcDebugLogger::logWarning(const QString& message) { qDebug().noquote() << message; } void JsonRpcDebugLogger::l...
```c++ #include "json_rpc_debug_logger.h" #include <QDebug> namespace jcon { void JsonRpcDebugLogger::logInfo(const QString& message) { qDebug().noquote() << message; } void JsonRpcDebugLogger::logWarning(const QString& message) { qDebug().noquote() << message; } void JsonRpcDebugLogger::logError(const QSt...
b7cf6609-1939-4cb7-99d6-f0ef94780dc5
{ "language": "C++" }
```c++ #include "reg_filter_mode_translator.h" #include "orz/types.h" namespace Reg { namespace Internal { boost::optional<FilterModeTranslator::external_type> FilterModeTranslator::get_value(internal_type const sval) { if (sval.empty()) return boost::none; if (sval == "Bilinear") { return Filter::Mode::B...
```c++ #include "reg_filter_mode_translator.h" #include "orz/types.h" namespace Reg { namespace Internal { boost::optional<FilterModeTranslator::external_type> FilterModeTranslator::get_value(internal_type const sval) { if (sval.empty()) return boost::none; if (sval == "Bilinear") { return Filter::Mode::B...
65fc7d11-b5bd-4983-83b6-cd15e4abd079
{ "language": "C++" }
```c++ #ifndef SCHEDULER_CORO_OSTHREAD # include "Coro.c" #endif ``` Include sdk/config.h before testing configuration macros.
```c++ #include <sdk/config.h> #ifndef SCHEDULER_CORO_OSTHREAD # include "Coro.c" #endif ```
cff40f00-16f1-49ea-b5d0-d186a3c8be7f
{ "language": "C++" }
```c++ //===- MachineDominators.cpp - Machine Dominator Calculation --------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===- MachineDominators.cpp - Machine Dominator Calculation --------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
0d8d8003-b23c-4272-a16b-be4e73aec808
{ "language": "C++" }
```c++ #include "gtest/gtest.h" #include "braincloud/BrainCloudClient.h" #include "TestResult.h" #include "TestBCGlobalFile.h" #include <vector> using namespace BrainCloud; static const std::string testfileName = "png1.png"; static const std::string testFileId = "34802251-0da0-419e-91b5-59d91790af15"; static const std...
```c++ #include "gtest/gtest.h" #include "braincloud/BrainCloudClient.h" #include "TestResult.h" #include "TestBCGlobalFile.h" #include <vector> using namespace BrainCloud; static const std::string testfileName = "testGlobalFile.png"; static const std::string testFileId = "ed2d2924-4650-4a88-b095-94b75ce9aa18"; static...
1b3b588a-9879-4261-9799-381f4e267d7d
{ "language": "C++" }
```c++ #include "JNIRhodes.h" #include "gapikey.h" #include <common/rhoparams.h> #undef DEFAULT_LOGCATEGORY #define DEFAULT_LOGCATEGORY "MapView" RHO_GLOBAL void mapview_create(rho_param *p) { #ifdef GOOGLE_API_KEY jclass clsMapView = getJNIClass(RHODES_JAVA_CLASS_MAPVIEW); if (!clsMapView) return; jmet...
```c++ #include "JNIRhodes.h" #include "gapikey.h" #include <common/rhoparams.h> #undef DEFAULT_LOGCATEGORY #define DEFAULT_LOGCATEGORY "MapView" extern "C" void alert_show_popup(char *); RHO_GLOBAL void mapview_create(rho_param *p) { #ifdef GOOGLE_API_KEY jclass clsMapView = getJNIClass(RHODES_JAVA_CLASS_MAPV...
dfc5cdf9-52d8-40b8-8301-a7b4a0ba4ec6
{ "language": "C++" }
```c++ #include "DotGraphOutput.hh" #include "EdgeType.hh" string getEdgeStyle(EdgeType t) { switch (t) { case EdgeType::Plane: return "[color=red]"; case EdgeType::Train: return "[color=blue,style=dotted]"; default: return ""; } } template <typename V> void DotGraphOutput<V>::output(string path...
```c++ #include "DotGraphOutput.hh" #include "EdgeType.hh" #include <sstream> template <typename V> string getEdgeStyle(EdgeType t, V val) { stringstream ss; string end("\"]"); switch (t) { case EdgeType::Plane: ss << string("[color=red, label=\"") << val << end; break; case EdgeType::Train: ...
c3b81b3d-c94a-406f-a881-b94d99945e70
{ "language": "C++" }
```c++ #ifdef LEGACY_LINUX // Wrappers for eventfd(), since CentOS backported the system // calls but not the libc wrappers. #include "arch/linux/system_event/eventfd.hpp" #include "utils.hpp" #include <sys/syscall.h> int eventfd(int count, int flags) { rassert(flags == 0); // Legacy kernel doesn't have eventfd2...
```c++ #ifdef LEGACY_LINUX // Wrappers for eventfd(), since CentOS backported the system // calls but not the libc wrappers. #include "arch/linux/system_event/eventfd.hpp" #include "utils.hpp" #include <sys/syscall.h> int eventfd(int count, UNUSED int flags) { rassert(flags == 0); // Legacy kernel doesn't have e...
f3412208-6afa-411c-a0ba-ead482c285c1
{ "language": "C++" }
```c++ /* * This file is part of the UnTech Editor Suite. * Copyright (c) 2016 - 2019, Marcus Rowe <undisbeliever@gmail.com>. * Distributed under The MIT License: https://opensource.org/licenses/MIT */ #include "mainwindow.h" #include "version.h" #include <QApplication> #include <QCommandLineParser> using namespa...
```c++ /* * This file is part of the UnTech Editor Suite. * Copyright (c) 2016 - 2019, Marcus Rowe <undisbeliever@gmail.com>. * Distributed under The MIT License: https://opensource.org/licenses/MIT */ #include "mainwindow.h" #include "version.h" #include <QApplication> #include <QCommandLineParser> #include <QSet...
e966723b-b830-4726-959b-a5a5eb05c0f5
{ "language": "C++" }
```c++ #include "nwg_service.h" #include "nwg_eventloop.h" namespace Nwg { Service::Service(EventLoop *eventLoop) : _eventLoop(eventLoop), _protocolCodec(nullptr), _handler(nullptr) { } Service::~Service() { _protocolCodec.reset(); _handler.reset(); } void Service::setBuffSize(int buffSize)...
```c++ #include "nwg_service.h" #include "nwg_eventloop.h" #include "nwg_basicprotocolcodec.h" namespace Nwg { Service::Service(EventLoop *eventLoop) : _eventLoop(eventLoop), _protocolCodec(nullptr), _handler(nullptr) { } Service::~Service() { _protocolCodec.reset(); _handler.reset(); } voi...
ea1cda80-7828-4b51-a014-4f9ad1b92443
{ "language": "C++" }
```c++ #include "PrologInterface.h" void PrologLifetime::begin(int argc, char *argv[]) { if (!PL_initialise(argc, argv)) { PL_halt(EXIT_FAILURE); } } void PrologLifetime::end() { PL_halt(EXIT_SUCCESS); } ``` Use PL_cleanup instead of PL_halt
```c++ #include "PrologInterface.h" void PrologLifetime::begin(int argc, char *argv[]) { if (!PL_initialise(argc, argv)) { PL_halt(EXIT_FAILURE); } } void PrologLifetime::end() { PL_cleanup(EXIT_SUCCESS); } ```
0e211b84-f222-46c3-9be4-6bf79e148a8f
{ "language": "C++" }
```c++ // Copyright (c) 2015 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #include "atom/common/event_emitter_caller.h" namespace mate { namespace internal { v8::Local<v8::Value> CallEmitWithArgs(v8::Isolate* isolate, ...
```c++ // Copyright (c) 2015 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #include "atom/common/event_emitter_caller.h" #include "atom/common/node_includes.h" namespace mate { namespace internal { v8::Local<v8::Value> CallEmitWithArgs(v8::Isolate*...
e51f041a-e1dd-4595-bc79-83bf97740c82
{ "language": "C++" }
```c++ #include "GoogleLogFatalHandler.hpp" #include "Headers.hpp" namespace google { namespace glog_internal_namespace_ { void DumpStackTraceToString(string* stacktrace); } } // namespace google static void DumpStackTraceToFileAndExit() { string s; google::glog_internal_namespace_::DumpStackTraceToString(&s); ...
```c++ #include "GoogleLogFatalHandler.hpp" #include "Headers.hpp" namespace google { namespace glog_internal_namespace_ { void DumpStackTraceToString(string* stacktrace); } } // namespace google static void DumpStackTraceToFileAndExit() { string s; google::glog_internal_namespace_::DumpStackTraceToString(&s); ...
8ba8f847-97fd-4b4a-976f-e54c23ef12bc
{ "language": "C++" }
```c++ #include <RGBColor.h> RGBColor RGBColor::black(glm::vec3(0.f, 0.f, 0.f)); RGBColor RGBColor::red(glm::vec3(1.f, 0.f, 0.f)); RGBColor::RGBColor() : color(glm::vec3(0.f, 0.f, 0.f)) { } RGBColor::RGBColor(const glm::vec3& color) : color(color) { } glm::vec3 RGBColor::GetRGBComponents() const { retur...
```c++ #include <RGBColor.h> RGBColor RGBColor::black(glm::vec3(0.f, 0.f, 0.f)); RGBColor RGBColor::red(glm::vec3(1.f, 0.f, 0.f)); RGBColor::RGBColor() : color(glm::vec3(0.f, 0.f, 0.f)) { } RGBColor::RGBColor(const glm::vec3& color) : color(color) { } glm::vec3 RGBColor::GetRGBComponents() const { retur...
efb38bc3-2ce8-4eb7-b05e-aa0c0be8a9aa
{ "language": "C++" }
```c++ // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp // RUN: clang-tidy %t.cpp -fix -checks=llvm.* -- // RUN: FileCheck -input-file=%t.cpp %s namespace i { } // CHECK: } // namespace i class A { A(int i); }; // Not fixing this, because the check is in google-. // CHECK: class A { A(int i); }; ``` Use more specific che...
```c++ // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp // RUN: clang-tidy %t.cpp -fix -checks=^llvm-.* -- // RUN: FileCheck -input-file=%t.cpp %s namespace i { } // CHECK: } // namespace i class A { A(int i); }; // Not fixing this, because the check is in google-. // CHECK: class A { A(int i); }; ```
a5fa1eda-8f45-4370-a3e6-a40059281369
{ "language": "C++" }
```c++ // XFAIL: hexagon // Test this without pch. // RUN: %clang_cc1 -include %S/cxx-typeid.h -fsyntax-only -verify %s // RUN: %clang_cc1 -x c++-header -emit-pch -o %t.pch %S/cxx-typeid.h // RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -verify %s // expected-no-diagnostics void f() { (void)typeid(int); } `...
```c++ // Test this without pch. // RUN: %clang_cc1 -include %S/cxx-typeid.h -fsyntax-only -verify %s // RUN: %clang_cc1 -x c++-header -emit-pch -o %t.pch %S/cxx-typeid.h // RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -verify %s // expected-no-diagnostics void f() { (void)typeid(int); } ```
d001774f-8ccd-4281-9330-4425f36ac100
{ "language": "C++" }
```c++ #include <tabulate/table.hpp> using namespace tabulate; int main() { Table employees; // Add rows employees.add_row({"Emp. ID", "First Name", "Last Name", "Department / Business Unit"}); employees.add_row({"101", "Donald", "Patrick", "Finance"}); employees.add_row({"102", "Donald", "Patrick", "Marke...
```c++ #include <tabulate/table.hpp> using namespace tabulate; int main() { Table employees; // Add rows employees.add_row({"Emp. ID", "First Name", "Last Name", "Department / Business Unit"}); employees.add_row({"101", "Donald", "Patrick", "Finance"}); employees.add_row({"102", "Donald", "Patrick", "Marke...
620bc573-15af-4aad-9f67-03e18e9d2067
{ "language": "C++" }
```c++ #include <iostream> #include <ctime> #include <QCPP.h> int main() { // make it more non-deterministic srand(time(NULL)); // initialize Quantum state with 5 qubits Quantum qubits(5); // turns all qubits into every state with same probabilities qubits.Hadamard(0, 1, 2, 3, 4); // or // for(int i = 0;i <...
```c++ #include <iostream> #include <ctime> #include <QCPP.h> int main() { // make it more non-deterministic srand(time(NULL)); // initialize Quantum state with 5 qubits Quantum qubits(5); // turns all qubits into every state with same probabilities qubits.hadamard(0, 1, 2, 3, 4); // or // for(int i = 0;i <...
76f6ce59-36a4-4a73-bc25-7c4ed95aa47e
{ "language": "C++" }
```c++ #include <iostream> #include <fstream> #include <spv_utils.h> #include <cstdint> int main() { // Read spv binary module from a file std::ifstream spv_file("../sample_spv_modules/test.frag.spv", std::ios::binary | std::ios::ate | std::ios::in); if (spv_file.is_open()) { std::st...
```c++ #include <iostream> #include <fstream> #include <spv_utils.h> #include <cstdint> int main() { // Read spv binary module from a file std::ifstream spv_file("../sample_spv_modules/test.frag.spv", std::ios::binary | std::ios::ate | std::ios::in); if (spv_file.is_open()) { std::st...
5ccf8c57-687b-4873-8cf9-b783f8435f56
{ "language": "C++" }
```c++ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include <stdio.h> #include "Arduino.h" asm(".global _printf_float"); asm(".global _scanf_float"); extern "C" { size_t _write(int handle, const unsigned c...
```c++ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include <stdio.h> #include "Arduino.h" // these are needed by the serializer, so force link asm(".global _printf_float"); asm(".global _scanf_float"); extern...
7a08b80f-b38b-4e31-9309-4f4da167c32f
{ "language": "C++" }
```c++ /********************************************************************* * thread-sleep: Force Node.js to sleep * * Copyright (c) 2015 Forbes Lindesay * Copyright (c) 2015 Tiancheng "Timothy" Gu * * MIT License ********************************************************************/ #include <nan.h> #ifdef _W...
```c++ /********************************************************************* * thread-sleep: Force Node.js to sleep * * Copyright (c) 2015 Forbes Lindesay * Copyright (c) 2015 Tiancheng "Timothy" Gu * * MIT License ********************************************************************/ #include <nan.h> #ifdef _W...
40188c10-1ec7-4c6f-aa43-6601695aaddd
{ "language": "C++" }
```c++ // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -g -emit-llvm -o - | FileCheck %s // This test is for a crash when emitting debug info for not-yet-completed types. // Test that we don't actually emit a forward decl for the offending class: // CHECK: [ DW_TAG_class_type ] [Derived<const __CFString, Foo>] {{.*}...
```c++ // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -g -emit-llvm -o - | FileCheck %s // This test is for a crash when emitting debug info for not-yet-completed types. // Test that we don't actually emit a forward decl for the offending class: // CHECK: [ DW_TAG_class_type ] [Derived<Foo>] {{.*}} [def] // rdar://...
750886e4-bbe1-4c97-8f2a-abe9a8f9648c
{ "language": "C++" }
```c++ // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ui/ozone/platform/drm/gpu/gpu_lock.h" #include <fcntl.h> #include <unistd.h> #include "base/logging.h" #include "base/posix/eintr_wrapp...
```c++ // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ui/ozone/platform/drm/gpu/gpu_lock.h" #include <sys/file.h> #include <unistd.h> #include "base/logging.h" #include "base/posix/eintr_wr...
296ccbeb-7fdb-4aa5-af19-93a46d677e10
{ "language": "C++" }
```c++ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector < ll > vl; vl arr(3); /* returs gcd(a,b) and find the coeficcients of bezout such that d = ax + by arr[0] gcd arr[1] x arr[2] y */ void extended(ll a, ll b){ ll y =0; ll x =1; ll xx =0; ll yy =1; while(b){ ll q = a...
```c++ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector < ll > vl; vl arr(3); /* returs gcd(a,b) and find the coeficcients of bezout such that d = ax + by arr[0] gcd arr[1] x arr[2] y */ void extended(ll a, ll b){ ll y =0; ll x =1; ll xx =0; ll yy =1; while(b){ ll q = a...
dcdf8d2b-a157-43f6-a4dd-e3900fc0bffe
{ "language": "C++" }
```c++ #include <cstdio> #include <algorithm> using namespace std; #define X(a,b) (x[a]*10+x[b]) int main() { int x[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9 }; do { int ab = X(0, 1), cd = X(2, 3), ef = X(4, 5), gh = X(6, 7); if ((ab >= 10 && cd >= 10 && ef >= 10 && gh >= 10) && (ab - cd) == ef && (ef ...
```c++ #include <iostream> #include <vector> #include <algorithm> using namespace std; #define X(a,b) (x[a]*10+x[b]) int mkInt(vector<int> &v) { int ret = 0; for (vector<int>::iterator it = v.begin(); it != v.end(); ++it) { ret = ret * 10 + *it; } return ret; } int main() { int init_x[] ...
f83ca1b0-b291-4368-aaf8-d7fea745e981
{ "language": "C++" }
```c++ #include <iostream> using namespace std; const int MAX = 100; struct Person { string firstName; string lastName; void input() { cout << "Enter person's first and last names separated by a space: "; cin >> firstName >> lastName; } void print() { cout << firstName << ' ' << lastName << '...
```c++ #include <iostream> using namespace std; struct Person { char firstName[32]; char lastName[32]; void input() { cout << "Enter person's first and last names separated by a space: "; cin >> firstName >> lastName; } void print() { cout << firstName << ' ' << lastName << '\n'; } }; struc...
2269b706-9f82-454d-9b5b-1604c0b4ad98
{ "language": "C++" }
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "remoting/host/event_executor_mac.h" namespace remoting { EventExecutorMac::EventExecutorMac(Capturer* capturer) : EventExecutor(c...
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "remoting/host/event_executor_mac.h" #include "remoting/protocol/messages_decoder.h" namespace remoting { EventExecutorMac::EventEx...
5e90fd89-61a5-4e1f-95d6-ade9a1265e4e
{ "language": "C++" }
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/disk_cache/cache_util.h" #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" namespace dis...
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/disk_cache/cache_util.h" #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" namespace dis...
e6e0690d-6406-4164-b124-36decebf6359
{ "language": "C++" }
```c++ #include <QApplication> #include <QSettings> #include <QLocale> #include <QTranslator> #include <QLibraryInfo> #include "trayicon.h" int main(int argc, char **argv) { QApplication app(argc, argv); QApplication::setOrganizationName("Restnotifier"); app.setQuitOnLastWindowClosed(false); // Set...
```c++ #include <QApplication> #include <QSettings> #include <QLocale> #include <QTranslator> #include <QLibraryInfo> #include "trayicon.h" int main(int argc, char **argv) { QApplication app(argc, argv); QApplication::setOrganizationName("Restnotifier"); app.setQuitOnLastWindowClosed(false); // Set...
37467a3e-3848-4261-aadc-5afa80c81099
{ "language": "C++" }
```c++ #include "common/application_info.h" #include "base/file_version_info.h" #include "base/memory/scoped_ptr.h" #include "base/strings/utf_string_conversions.h" namespace brightray { std::string GetApplicationName() { auto module = GetModuleHandle(nullptr); auto info = make_scoped_ptr( FileVersionInfo:...
```c++ #include "common/application_info.h" #include "base/file_version_info.h" #include "base/memory/scoped_ptr.h" #include "base/strings/utf_string_conversions.h" namespace brightray { std::string GetApplicationName() { auto module = GetModuleHandle(nullptr); auto info = make_scoped_ptr( FileVersionInfo:...
cd57b253-1686-4d6f-a03e-7c9c11ddbcc3
{ "language": "C++" }
```c++ /* * Copyright 2015 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "GrDrawBatch.h" GrDrawBatch::GrDrawBatch(uint32_t classID) : INHERITED(classID), fPipelineInstalled(false) { } GrDrawBatch::~GrDrawBatch() { if (fPipelin...
```c++ /* * Copyright 2015 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "GrDrawBatch.h" GrDrawBatch::GrDrawBatch(uint32_t classID) : INHERITED(classID), fPipelineInstalled(false) { } GrDrawBatch::~GrDrawBatch() { if (fPipelin...
50c6ea97-9b2c-4152-970f-21dd3272fa70
{ "language": "C++" }
```c++ // This file is part of the GLERI project // // Copyright (c) 2012 by Mike Sharov <msharov@users.sourceforge.net> // This file is free software, distributed under the MIT License. #include "rglrp.h" #define N(n,s) #n "\0" #s "\0" /*static*/ const char PRGLR::_cmdNames[] = "\0" // Dirty trick: object name ...
```c++ // This file is part of the GLERI project // // Copyright (c) 2012 by Mike Sharov <msharov@users.sourceforge.net> // This file is free software, distributed under the MIT License. #include "rglrp.h" #define N(n,s) #n "\0" #s "\0" /*static*/ const char PRGLR::_cmdNames[] = N(Error,s) N(Restate,(nnqqyy...
b469e773-3330-4ebc-aa61-0cd7faa3788e
{ "language": "C++" }
```c++ #include "forth_common.th" // A little Forth. .set link, 0 .global __zero __zero: __boot: S <- [reloc(_PSPinit)] R <- [reloc(_RSPinit)] I <- reloc(QUIT) // enter text interpreter goto(NEXT) .global _PSPinit .global _RSPinit _PSPinit: .word 0x007fffff _RSPinit: .word 0x00...
```c++ #include "forth_common.th" // A little Forth. .set link, 0 .global __zero __zero: __boot: S <- [reloc(_PSPinit)] R <- [reloc(_RSPinit)] I <- reloc(QUIT) // enter text interpreter goto(NEXT) .global _PSPinit .global _RSPinit _PSPinit: .word 0x007fffff _RSPinit: .word 0x00...