doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
75a1f54e-942d-423a-8bcd-c43066071f3c
{ "language": "C++" }
```c++ // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // Make sure LLVMFuzzerInitialize is called. #include <assert.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> static char *argv0; extern "C" i...
```c++ // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // Make sure LLVMFuzzerInitialize is called. #include <assert.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> static char *argv0; extern "C" i...
3065b1dc-fce6-4d61-8753-1c9214a8e1bd
{ "language": "C++" }
```c++ // https://github.com/KubaO/stackoverflown/tree/master/questions/html-get-24965972 #include <QtNetwork> #include <functional> void htmlGet(const QUrl &url, const std::function<void(const QString&)> & fun) { QScopedPointer<QNetworkAccessManager> manager(new QNetworkAccessManager); QNetworkReply * response ...
```c++ // https://github.com/KubaO/stackoverflown/tree/master/questions/html-get-24965972 #include <QtNetwork> #include <functional> void htmlGet(const QUrl &url, const std::function<void(const QString&)> &fun) { QScopedPointer<QNetworkAccessManager> manager(new QNetworkAccessManager); QNetworkReply *response = ...
f9e5c7c8-90d5-4381-8427-d8d832741642
{ "language": "C++" }
```c++ #include <Python.h> #include "Quantuccia/ql/time/calendars/unitedstates.hpp" static PyObject* get_holiday_date(PyObject *self, PyObject *args) { return NULL; } static PyMethodDef QuantucciaMethods[] = { {"get_holiday_date", (PyCFunction)get_holiday_date, METH_VARARGS, NULL}, {NULL, NULL} /* S...
```c++ #include <Python.h> #include "Quantuccia/ql/time/calendars/unitedstates.hpp" static PyObject* get_holiday_date(PyObject *self, PyObject *args) { return NULL; } static PyMethodDef QuantucciaMethods[] = { {"get_holiday_date", (PyCFunction)get_holiday_date, METH_VARARGS, NULL}, {NULL, NULL} /* S...
e74c6214-8369-461e-8761-c053d9532578
{ "language": "C++" }
```c++ ``` Add basic implemention of icalc interface
```c++ //// Basic implementation of the icalcterm interface #include "icalc/icalc.h" #include <stdio.h> #include <string.h> #include <stdlib.h> #define EXPORT __attribute__ ((visibility ("default"))) extern "C" { void EXPORT CI_init( CI_Config* config ) { printf("Starting defcalc.\n"); } // Note: this functi...
6dcf60af-6464-4fb2-bd6b-b61a17f56ea7
{ "language": "C++" }
```c++ // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s // REQUIRES: compiler-rt-optimiz...
```c++ // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s // REQUIRES: compiler-rt-optimiz...
b29cdfb4-645f-41ce-8546-fe2ec60b83f0
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -fexceptions -fcxx-exceptions -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name trymacro.cpp %s | FileCheck %s // CHECK: Z3fn1v: void fn1() try { return; } // CHECK: [[@LINE]]:12 -> [[@LINE+1]]:14 = #1 cat...
```c++ // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -fexceptions -fcxx-exceptions -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name trymacro.cpp %s | FileCheck %s // CHECK: Z3fn1v: void fn1() try { return; } // CHECK: [[@LINE]]:12 -> [[@LINE+1]]:14 = #1 cat...
796672c3-bb15-4763-ae5c-b5f6631202f5
{ "language": "C++" }
```c++ /* * rngs * ECE 541 Project 2 * Kashev Dalmia - dalmia3 * David Huang - huang157 */ #include <iostream> #include "ranlux32.h" namespace rng { RANLUX32::RANLUX32() : RandomNumberGenerator(), prev(0), count(0), state(), index(0) {} void RANLUX32::seed(f...
```c++ /* * rngs * ECE 541 Project 2 * Kashev Dalmia - dalmia3 * David Huang - huang157 */ #include "ranlux32.h" namespace rng { RANLUX32::RANLUX32() : RandomNumberGenerator(), prev(0), count(0), state(), index(0) {} void RANLUX32::seed(fuint seed_num) { ...
18e14751-c2d0-49c3-bfad-6b5f2ecebe31
{ "language": "C++" }
```c++ //===-- ARMTargetAsmInfo.cpp - ARM asm properties ---------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file was developed by James M. Laskey and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. // //===-----------...
```c++ //===-- ARMTargetAsmInfo.cpp - ARM asm properties ---------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file was developed by James M. Laskey and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. // //===-----------...
0ccb0c42-7c97-48c1-8b30-57b234fea769
{ "language": "C++" }
```c++ #include <iostream> #include "word.h" using namespace std; string make_outfile(string namefile); int main(int argc, char* argv[]) { Word word; if (argc < 2) { cerr << "Usage: si [origin].si [destination].cpp" << endl; exit(EXIT_FAILURE); ...
```c++ #include <iostream> #include "word.h" using namespace std; string make_outfile(string namefile); int main(int argc, char* argv[]) { Word word; if (argc < 2) { cerr << "Usage: si origin.si [destination.cpp]" << endl; exit(EXIT_FAILURE); } else i...
9f2b816f-d38d-4e6e-8c48-4fe6b4dc52bd
{ "language": "C++" }
```c++ #include <iostream> #include <string> #include "job.h" Job::Job(int id, std::string machine_name) : job_id(id), state(State::Moveable), machine(machine_name) { std::cout << "Created new job: " << id << std::endl; } int Job::get_id() const { return job_id; } const std::string& Job::get_machine() c...
```c++ #include <iostream> #include <string> #include "job.h" Job::Job(int id, std::string machine_name) : job_id(id), machine(machine_name), state(State::Moveable) { std::cout << "Created new job: " << id << std::endl; } int Job::get_id() const { return job_id; } const std::string& Job::get_machine() c...
3b5db8ae-d1c5-4dcb-9931-ec6a670ae652
{ "language": "C++" }
```c++ #include <GL/glx.h> #include "linuxwindow.hh" #include "system/openglcontext.hh" #include <iostream> class LinuxOpenGLContext : public System::OpenGLContext { public: LinuxOpenGLContext(System::Window *window) : _window((LinuxWindow *)window) { Display *display = _window->getDisplay();...
```c++ #include <GL/glx.h> #include "linuxwindow.hh" #include "system/openglcontext.hh" class LinuxOpenGLContext : public System::OpenGLContext { public: LinuxOpenGLContext(System::Window *window) : _window((LinuxWindow *)window) { Display *display = _window->getDisplay(); ::Window win...
df527ad9-c739-4206-944c-32861ff6e64e
{ "language": "C++" }
```c++ #include <libclientserver.h> RateLimit::RateLimit() { m_last = {0, 0}; } RateLimit::~RateLimit() { } void RateLimit::SetTimeout(const struct timespec *tv) { memcpy(&m_timeout, tv, sizeof(*tv)); } bool RateLimit::Check() { struct timespec now; struct timespec when; Time::MonoTonic(&now); Time::Add(&no...
```c++ #include <libclientserver.h> RateLimit::RateLimit() { m_last.tv_sec = 0; m_last.tv_nsec = 0; } RateLimit::~RateLimit() { } void RateLimit::SetTimeout(const struct timespec *tv) { memcpy(&m_timeout, tv, sizeof(*tv)); } bool RateLimit::Check() { struct timespec now; struct timespec when; Time::MonoToni...
927beb34-fcbc-4e3c-8cc2-e2c7dcac8821
{ "language": "C++" }
```c++ // Copyright (c) 2009 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/extensions/extension_apitest.h" // Flaky, http://crbug.com/19866. Please consult phajdan.jr before re-enabling. IN_PR...
```c++ // Copyright (c) 2009 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/extensions/extension_apitest.h" // Flaky, http://crbug.com/19866. Please consult phajdan.jr before re-enabling. IN_PR...
7f015542-a1e2-4ad9-a832-4ebec13df43b
{ "language": "C++" }
```c++ #include <stdio.h> int main(void) { int a, b, c; scanf("%d %d %d", &a, &b, &c); int t; if(a > b) t = a, a = b, b = t; if(b > c) t = b, b = c, c = t; if(a > b) t = a, a = b, b = t; printf("%d %d %d\n", a, b, c); return 0; } ``` Reduce a scope of the temporary variable
```c++ #include <stdio.h> int main(void) { int a, b, c; scanf("%d %d %d", &a, &b, &c); if(a > b) { int tmp = a; a = b; b = tmp; } if(b > c) { int tmp = b; b = c; c = tmp; } if(a > b) { int tmp = a; a = b; b = tmp; } printf("%d %d %d\n", a, b, c); return 0; } ```
f5a960c2-4072-44f3-8b55-809b598b0ab1
{ "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 ```
cbdeffae-cfdc-4560-ad47-3eefb2abb476
{ "language": "C++" }
```c++ // Copyright 2014 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/path_service.h" #include "chrome/test/remoting/qunit_browser_test_runner.h" #if defined(OS_MACOSX) #include "base/mac/foundation_ut...
```c++ // Copyright 2014 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/path_service.h" #include "chrome/test/remoting/qunit_browser_test_runner.h" #if defined(OS_MACOSX) #include "base/mac/foundation_ut...
b7a098d4-e46e-47a2-ae27-332ba374842b
{ "language": "C++" }
```c++ /* * MRustC - Rust Compiler * - By John Hodge (Mutabah/thePowersGang) * * expand/rustc_diagnostics.cpp * - Stubbed handling for __register_diagnostic and __diagnostic_used */ #include <synext.hpp> #include <parse/common.hpp> // TokenTree etc #include <parse/ttstream.hpp> class CExpanderRegisterDiagnostic...
```c++ /* * MRustC - Rust Compiler * - By John Hodge (Mutabah/thePowersGang) * * expand/rustc_diagnostics.cpp * - Stubbed handling for __register_diagnostic and __diagnostic_used */ #include <synext.hpp> #include <parse/common.hpp> // TokenTree etc #include <parse/ttstream.hpp> class CExpanderRegisterDiagnostic...
512f6321-0c05-41b3-a56c-251fc51c3f2c
{ "language": "C++" }
```c++ //===-- TargetOptionsCommandFlags.cpp ---------------------------*- C++ -*-===// // // The LLVM Linker // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===---------------------------------------------------------...
```c++ //===-- TargetOptionsCommandFlags.cpp ---------------------------*- C++ -*-===// // // The LLVM Linker // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===---------------------------------------------------------...
9a80f04c-6e77-4662-9516-030792d3335c
{ "language": "C++" }
```c++ /* * Copyright (C) 2017 Mario Alviano (mario@alviano.net) * * 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 re...
```c++ /* * Copyright (C) 2017 Mario Alviano (mario@alviano.net) * * 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 re...
3f2aff4a-9c69-4049-a2be-de2fceef5fc3
{ "language": "C++" }
```c++ // RUN: clang-cc %s -emit-llvm -o - -std=c++0x class A { public: virtual void foo(); }; static_assert (sizeof (A) == (sizeof(void *)), "vtable pointer layout"); ``` Test cases for some recent work.
```c++ // RUN: clang-cc -triple x86_64-apple-darwin -frtti=0 -std=c++0x -S %s -o %t-64.s && // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && // RUN: clang-cc -triple i386-apple-darwin -frtti=0 -std=c++0x -S %s -o %t-32.s && // RUN: FileCheck -check-prefix LP32 -input-file=%t-32.s %s && // RUN: true clas...
85d9f549-3a48-4368-ba05-297a2609819c
{ "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 "ComponentDescriptorProviderRegistry.h" namespace facebook { namespace react { void ComponentDescriptorProviderR...
```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 "ComponentDescriptorProviderRegistry.h" namespace facebook { namespace react { void ComponentDescriptorProviderR...
b3cb9b2b-233a-445f-8e73-b9808a062178
{ "language": "C++" }
```c++ // PluginHelpers.cpp : Defines the exported functions for the DLL application. // #include "stdafx.h" #include "pluginhelpers.h" #include "ContentControl.h" #include "..\..\ToDoList_Dev\Interfaces\UITheme.h" #include "..\..\ToDoList_Dev\Interfaces\IContentControl.h" ///////////////////////////////////////////...
```c++ // PluginHelpers.cpp : Defines the exported functions for the DLL application. // #include "stdafx.h" #include "pluginhelpers.h" #include "ContentControl.h" #include "..\..\ToDoList_Dev\Interfaces\UITheme.h" #include "..\..\ToDoList_Dev\Interfaces\IContentControl.h" ///////////////////////////////////////////...
b98429b6-67fb-432d-8ae6-87c3451bc194
{ "language": "C++" }
```c++ #include "HotkeyInput.h" #include "../../3RVX/Logger.h" #include "../Controls/Controls.h" #include "KeyGrabber.h" HotkeyInput::HotkeyInput(HWND parent) : Dialog(parent, MAKEINTRESOURCE(IDD_HOTKEYPROMPT)) { } void HotkeyInput::Initialize() { _prompt = new Label(LBL_PROMPT, *this); } ``` Set the dest hwnd...
```c++ #include "HotkeyInput.h" #include "../../3RVX/Logger.h" #include "../Controls/Controls.h" #include "KeyGrabber.h" HotkeyInput::HotkeyInput(HWND parent) : Dialog(parent, MAKEINTRESOURCE(IDD_HOTKEYPROMPT)) { } void HotkeyInput::Initialize() { _prompt = new Label(LBL_PROMPT, *this); KeyGrabber::Instance...
031ab829-5540-4e69-81c9-57049a90be4f
{ "language": "C++" }
```c++ /* * Copyright (C) 2018 The Android Open Source Project * * 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...
```c++ /* * Copyright (C) 2018 The Android Open Source Project * * 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...
f61691b0-1775-418a-98b3-e5e493803035
{ "language": "C++" }
```c++ //===- Support/FileUtilities.cpp - File System Utilities ------------------===// // // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===-...
```c++ //===- lib/Debugger/FDHandle.cpp - File Descriptor Handle -----------------===// // // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===-...
6a5bb4fa-c7a8-41cc-a7a8-605ef65d0b84
{ "language": "C++" }
```c++ #include "caffe2/operators/accumulate_op.h" namespace caffe2 { namespace { REGISTER_CPU_OPERATOR(Accumulate, AccumulateOp<float, CPUContext>); OPERATOR_SCHEMA(Accumulate) .NumInputs(1) .NumOutputs(1) // TODO: add Shape inference function (bootcamp) .SetDoc(R"DOC( Accumulate operator accumulates the inp...
```c++ #include "caffe2/operators/accumulate_op.h" namespace caffe2 { namespace { REGISTER_CPU_OPERATOR(Accumulate, AccumulateOp<float, CPUContext>); OPERATOR_SCHEMA(Accumulate) .NumInputs(1) .NumOutputs(1) .IdenticalTypeAndShape() .SetDoc(R"DOC( Accumulate operator accumulates the input tensor to the output ...
46f0a63a-413b-4a6f-8099-bc411dd05ede
{ "language": "C++" }
```c++ #include "HelloWorld.h" void HelloWorld::respond() { out << "Content-type: text/html\r\n\r\n" << flush; out << "<h1>hello, world</h1>"; dumpHash(tr("Get variables"), request.getData()); dumpHash(tr("Server variables"), request.serverData()); } void HelloWorld::dumpHash(const QString& label, const QHash<QSt...
```c++ #include "HelloWorld.h" void HelloWorld::respond() { out << "Content-type: text/html\r\n\r\n" << flush; out << "<h1>hello, world</h1>"; dumpHash(tr("Get variables"), request.getData()); dumpHash(tr("Post variables"), request.postData()); dumpHash(tr("Server variables"), request.serverData()); } void Hello...
488923f0-9f3d-49da-b327-95f2e2bc267a
{ "language": "C++" }
```c++ #include <test.hpp> TEST_CASE("exceptions messages for pbf exception") { protozero::exception e; REQUIRE(std::string{e.what()} == std::string{"pbf exception"}); } TEST_CASE("exceptions messages for varint too long") { protozero::varint_too_long_exception e; REQUIRE(std::string{e.what()} == std...
```c++ #include <test.hpp> TEST_CASE("exceptions messages for pbf exception") { protozero::exception e; REQUIRE(std::string{e.what()} == std::string{"pbf exception"}); } TEST_CASE("exceptions messages for varint too long") { protozero::varint_too_long_exception e; REQUIRE(std::string{e.what()} == std...
ed70b8d8-a1ec-4146-a816-09b048fc8f30
{ "language": "C++" }
```c++ #ifdef STAN_OPENCL #include <stan/math/opencl/opencl.hpp> #include <stan/math/opencl/kernel_cl.hpp> #include <gtest/gtest.h> using stan::math::matrix_cl; using stan::math::opencl_kernels::in_buffer; using stan::math::opencl_kernels::in_out_buffer; using stan::math::opencl_kernels::internal::assign_events; usin...
```c++ #ifdef STAN_OPENCL #include <stan/math/opencl/opencl.hpp> #include <stan/math/opencl/kernel_cl.hpp> #include <gtest/gtest.h> using stan::math::matrix_cl; using stan::math::opencl_kernels::in_buffer; using stan::math::opencl_kernels::in_out_buffer; using stan::math::opencl_kernels::internal::assign_events; usin...
0cd75351-0364-42eb-bd3f-ffaa136857ce
{ "language": "C++" }
```c++ #include "thingspeakSender.h" #include "ThingSpeak.h" #define USE_WIFI101_SHIELD #include "BridgeClient.h" BridgeClient client; void ThingspeakSender::init() { ThingSpeak.begin(client); Serial.println("\nconnected to ThingSpeak!"); } void ThingspeakSender::sendCounter(int counter) { //send '1' to the ...
```c++ #include "thingspeakSender.h" #include "ThingSpeak.h" #define USE_WIFI101_SHIELD #include "BridgeClient.h" BridgeClient client; void ThingspeakSender::init() { ThingSpeak.begin(client); Serial.println("\nBottle-Opener is now connected to ThingSpeak!"); } void ThingspeakSender::sendCounter(int counter) {...
20d10c59-62b9-40ca-b549-5761bc66c756
{ "language": "C++" }
```c++ #include "DirListMapModel.h" #include <QtCore/QDebug> #include <QtCore/QDir> namespace web { namespace page { namespace model { DirListMapModel::DirListMapModel(const QString & dirPath, const QString & addressPath, QObject *parent) : AbstractListModel(parent) { generateAllModels(dirPath, addressPath);...
```c++ #include "DirListMapModel.h" #include <QtCore/QDebug> #include <QtCore/QDir> namespace web { namespace page { namespace model { DirListMapModel::DirListMapModel(const QString & dirPath, const QString & addressPath, QObject *parent) : AbstractListModel(parent) { generateAllModels(dirPath, addressPath);...
2270df06-5ee1-44de-b590-b81fabb551fd
{ "language": "C++" }
```c++ #include "Game.h" #include "SFML/Graphics.hpp" #include "SFML/Window.hpp" void Game::start() { if (s_game_state != Uninitialized) { return; } s_main_window.create(sf::VideoMode(1024, 768, 32), "Pang!"); s_game_state = Game::Playing; while(!is_exiting()) { game_loop(); }...
```c++ #include "Game.h" #include "SFML/Graphics.hpp" #include "SFML/Window.hpp" void Game::start() { if (s_game_state != Uninitialized) { return; } s_main_window.create(sf::VideoMode(1024, 768, 32), "Pang!"); s_game_state = Game::Playing; while(!is_exiting()) { game_loop(); }...
0215baf1-ab44-4f9a-aa03-73fbcfc6dbd8
{ "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/prerender/prerender_config.h" namespace prerender { Config::Config() : max_bytes(150 * 1024 * 1024), ...
```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/prerender/prerender_config.h" namespace prerender { Config::Config() : max_bytes(150 * 1024 * 1024), ...
7867fefe-88b6-4b88-8a70-c14a9a567a3b
{ "language": "C++" }
```c++ #include "Genes/Draw_Value_Gene.h" #include <string> #include <map> #include "Game/Color.h" #include "Utility/Random.h" class Board; std::string Draw_Value_Gene::name() const noexcept { return "Draw Value Gene"; } double Draw_Value_Gene::draw_value() const noexcept { return value_of_draw_in_centipaw...
```c++ #include "Genes/Draw_Value_Gene.h" #include <string> #include <map> #include "Game/Color.h" #include "Utility/Random.h" class Board; std::string Draw_Value_Gene::name() const noexcept { return "Draw Value Gene"; } double Draw_Value_Gene::draw_value() const noexcept { return value_of_draw_in_centipaw...
543ee87a-0978-4c41-9d2d-d6628b62e484
{ "language": "C++" }
```c++ #include "tutorial_storage_facility.h" namespace tutorial_storage { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Tutorial_storageFacility::Tutorial_storageFacility(cyclus::Context* ctx) : cyclus::Facility(ctx) {} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ...
```c++ #include "tutorial_storage_facility.h" namespace tutorial_storage { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Tutorial_storageFacility::Tutorial_storageFacility(cyclus::Context* ctx) : cyclus::Facility(ctx) {} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ...
b750e463-96fe-4d83-9495-3f9bed033936
{ "language": "C++" }
```c++ /* * Copyright 2010 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkTypes.h" static const size_t kBufferSize = 2048; #include <stdarg.h> #include <stdio.h> #include <windows.h> void SkDebugf(const char format[], ...) {...
```c++ /* * Copyright 2010 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkTypes.h" static const size_t kBufferSize = 2048; #include <stdarg.h> #include <stdio.h> #include <windows.h> void SkDebugf(const char format[], ...) {...
cff63b95-fa5b-4646-bc97-24530a6e93e3
{ "language": "C++" }
```c++ /* * This file is part of ATLAS. It is subject to the license terms in * the LICENSE file found in the top-level directory of this distribution. * (Also avialable at http://www.apache.org/licenses/LICENSE-2.0.txt) * You may not use this file except in compliance with the License. */ #include <iostream> #include ...
```c++ /* * This file is part of ATLAS. It is subject to the license terms in * the LICENSE file found in the top-level directory of this distribution. * (Also avialable at http://www.apache.org/licenses/LICENSE-2.0.txt) * You may not use this file except in compliance with the License. */ #include <iostream> #include ...
ba4cd118-70f9-4e5c-9959-f3d25c7883ca
{ "language": "C++" }
```c++ /** * This file is part of the CernVM File System. */ #include "lease_path_util.h" namespace receiver { bool IsPathInLease(const PathString& lease, const PathString& path) { // If lease is "", any path falls within item if (!strcmp(lease.c_str(), "")) { return true; } // Is the lease string is ...
```c++ /** * This file is part of the CernVM File System. */ #include "lease_path_util.h" namespace receiver { bool IsPathInLease(const PathString& lease, const PathString& path) { // If lease is "", then any path is a subpath if (lease.GetLength() == 0) { return true; } // If the lease string is the...
757a3fd8-1b5c-40a6-88d0-104d8578733a
{ "language": "C++" }
```c++ // Copyright (c) 2020 The Orbit 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 "ProcessServiceImpl.h" #include <memory> #include <string> using grpc::ServerContext; using grpc::Status; Status ProcessServiceImpl::G...
```c++ // Copyright (c) 2020 The Orbit 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 "ProcessServiceImpl.h" #include <memory> #include <string> using grpc::ServerContext; using grpc::Status; Status ProcessServiceImpl::G...
9080650c-802a-4c77-a85a-de262d1d27bb
{ "language": "C++" }
```c++ #include <iostream> #include "fixed_point.hpp" int main() { auto g1 = [](double x) -> double { return (x * x + 2) / 3; }; auto g2 = [](double x) -> double { return std::sqrt(3 * x - 2); }; auto g3 = [](double x) -> double { return 3 - (2 / x); }; auto g4 ...
```c++ #include <iostream> #include "fixed_point.hpp" int main() { auto g1 = [](double x) -> double { return (x * x + 2) / 3; }; // will result in NaNs because the value under the square root // will become negative at some point. auto g2 = [](double x) -> double { return std::sq...
4d5f0308-6369-4813-b16c-fee552316222
{ "language": "C++" }
```c++ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) University College London (UCL). All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PART...
```c++ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) University College London (UCL). All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PART...
422dd59a-cd18-4a08-9ab1-a02ec3869126
{ "language": "C++" }
```c++ /* mbed Microcontroller Library * Copyright (c) 2013-2014 ARM Limited * * 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 * * Un...
```c++ /* mbed Microcontroller Library * Copyright (c) 2013-2014 ARM Limited * * 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 * * Un...
5f9f453a-84b9-43ce-8cb5-5ae21cc823d9
{ "language": "C++" }
```c++ #include <QApplication> #include <QQmlApplicationEngine> #include <QQuickStyle> #include "world.hpp" int main(int argc, char** argv) { QApplication app(argc, argv); app.setApplicationName("Headway"); #ifdef Q_OS_WINDOWS QQuickStyle::setStyle("Universal"); #else QQuickStyle::setStyle("Basic"); ...
```c++ #include <QApplication> #include <QQmlApplicationEngine> #include <QQuickStyle> #include "world.hpp" int main(int argc, char** argv) { QApplication app(argc, argv); app.setApplicationName("Headway"); #ifdef Q_OS_WINDOWS QQuickStyle::setStyle("Universal"); #endif QQmlApplicationEngine engine; ...
2c964309-1604-4be1-89b1-f599ba3a7e0f
{ "language": "C++" }
```c++ #include <iostream> using namespace std; int main() { cout << "Hello world!" << endl; } ``` Add an include to trigger Travis
```c++ #include <iostream> #include <ncurses.h> using namespace std; int main() { cout << "Hello world!" << endl; } ```
5e368cca-5b61-422b-a767-d61f70e6d609
{ "language": "C++" }
```c++ #include "models/bucket.h" #include "views/session_view.h" SessionView::SessionView(Session* session, QWidget* parent) : QWidget(parent), m_session(session) { m_hostFileSystem = new QFileSystemModel(this); m_hostFileSystem->setRootPath(QDir::rootPath()); m_hostBrowser = new QTreeView; m_hostBrowser->se...
```c++ #include "models/bucket.h" #include "views/session_view.h" SessionView::SessionView(Session* session, QWidget* parent) : QWidget(parent), m_session(session) { m_hostFileSystem = new QFileSystemModel(this); m_hostFileSystem->setRootPath(QDir::rootPath()); m_hostBrowser = new QTreeView; m_hostBrowser->se...
368c5742-8466-4e0c-93bc-d16d8e2f1e1f
{ "language": "C++" }
```c++ // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #include "platform/globals.h" #if defined(TARGET_OS_FUCHSIA) #include "vm/native_symbol.h" #in...
```c++ // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #include "vm/globals.h" #if defined(TARGET_OS_FUCHSIA) #include "platform/memory_sanitizer.h" #...
fa114e6f-d36b-4640-8d8d-aee83dd05e82
{ "language": "C++" }
```c++ /* * Justin's Awesome Game Engine * or * * Just Another Game Engine * * Copyright 2016 Justin White * * See included LICENSE file for distribution and reuse. */ #include <Engine.hpp> static std::unique_ptr<Engine> theGame; int success(const std::string& msg); int fail(const std::string& msg); int main...
```c++ /* * Justin's Awesome Game Engine * or * * Just Another Game Engine * * Copyright 2016 Justin White * * See included LICENSE file for distribution and reuse. */ #include <Engine.hpp> int done(std::unique_ptr<Engine> theGame, int exitCode, const std::string& msg = "Done"); int main(const int argc, const...
87e939f3-8a66-42a8-8d65-4add13c09290
{ "language": "C++" }
```c++ // Copyright (c) 2014 eeGeo. All rights reserved. #import <EegeoWorld.h> #include "TrafficCongestionExample.h" namespace Examples { TrafficCongestionExample::TrafficCongestionExample( Eegeo::TrafficCongestion::ITrafficCongestionService& trafficCongestionService, Eegeo::EegeoWorld& wo...
```c++ // Copyright (c) 2014 eeGeo. All rights reserved. #import <EegeoWorld.h> #include "TrafficCongestionExample.h" namespace Examples { TrafficCongestionExample::TrafficCongestionExample( Eegeo::TrafficCongestion::ITrafficCongestionService& trafficCongestionService, Eegeo::EegeoWorld& wo...
52ea63f2-3f10-4cd9-97eb-c1342744f8f3
{ "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 "sky/engine/tonic/dart_error.h" #include "base/logging.h" namespace blink { namespace DartError { const char kInvalidArgument[] = "Inv...
```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 "sky/engine/tonic/dart_error.h" #include "base/logging.h" namespace blink { namespace DartError { const char kInvalidArgument[] = "Inval...
d9f96fe6-786a-48dd-b123-670a9294d5cb
{ "language": "C++" }
```c++ #include "variant/digital_platform.hpp" #include "hal.h" DigitalPlatform::DigitalPlatform() { palSetPadMode(GPIOA, 4, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOA, 5, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOC, 4, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOC, 5, PAL_MODE_OUTPUT_PUSHPULL); pa...
```c++ #include "variant/digital_platform.hpp" #include "hal.h" DigitalPlatform::DigitalPlatform() { palSetPadMode(GPIOA, 4, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOA, 5, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOC, 4, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOC, 5, PAL_MODE_OUTPUT_PUSHPULL); pal...
2a346be7-1e7c-4a61-846e-acfd3e615304
{ "language": "C++" }
```c++ /* * Podrios.cpp * * Created on: 2014年10月23日 * Author: nemo */ #include <iostream> #include <stdlib.h> using namespace std; int main() { cout << "Show Message." << endl; system("pause"); return 0; }``` Remove system pause, Linux doesn't have this function.
```c++ /* * Podrios.cpp * * Created on: 2014年10月23日 * Author: nemo */ #include <iostream> using namespace std; int main() { cout << "Show Message." << endl; return 0; }```
f5789094-042b-470b-8201-9d3ef90fa1a1
{ "language": "C++" }
```c++ #include <QTest> #include <QObject> #include "uritests.h" // This is all you need to run all the tests int main(int argc, char *argv[]) { URITests test1; QTest::qExec(&test1); } ``` Return !0 when qt tests fail.
```c++ #include <QTest> #include <QObject> #include "uritests.h" // This is all you need to run all the tests int main(int argc, char *argv[]) { bool fInvalid = false; URITests test1; if (QTest::qExec(&test1) != 0) fInvalid = true; return fInvalid; } ```
afac87d3-e3b9-41e1-ab10-4cf2793195f5
{ "language": "C++" }
```c++ /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkColorMatrixFilter.h" static SkScalar byte_to_scale(U8CPU byte) { if (0xFF == byte) { // want to get this exact return 1; } else { ...
```c++ /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkColorMatrixFilter.h" static SkScalar byte_to_scale(U8CPU byte) { if (0xFF == byte) { // want to get this exact return 1; } else { ...
2cfabe85-758e-4410-b2d5-0b537e094621
{ "language": "C++" }
```c++ #include<math.h> #include<stdio.h> /*#include<iostream> using namespace std;*/ int isPrimeBruteForce(int x) { if (x < 2) return false; double sqroot_x; sqroot_x = sqrt (x); for(int i=0; i <= sqroot_x; i++) { /* If there were only factors above the square root of x, they would be bigger than x itself. */ ...
```c++ #include <iostream> #include <cmath> //using namespace std; int isPrimeBruteForce(int x) { if (x < 2) return false; double sqroot_x; double square = x; sqroot_x = std::sqrt(square); for(int i=0; i <= sqroot_x; i++) { /* If there were only factors above the square root of x, they would be bigger than x it...
1305f2bc-3534-4188-97db-a1a0cf2e59ef
{ "language": "C++" }
```c++ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved. 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 l...
```c++ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved. 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 l...
b6d378ed-cc96-4a04-891b-49887b8e6f3c
{ "language": "C++" }
```c++ #include <iostream> #include "lotto.h" using namespace std; /* So I guess I should use arrays? Seems like quite good idea, hopefully it'll work as intended. * Also I'm still not sure how to avoid duplicates... */ void lotto::lotek(){ for(int i = 0; i < 6; i++) { int a = rand()%49+1; cout <...
```c++ #include <iostream> #include "lotto.h" using namespace std; /* So I guess I should use arrays? Seems like quite good idea, hopefully it'll work as intended. * Also I'm still not sure how to avoid duplicates... */ void lotto::lotek(){ int lotteryPool[50]; for(int x = 0; x < 50; x++) { lotteryPool[...
95a3f187-7892-44dc-830a-82bd3a86f3dc
{ "language": "C++" }
```c++ /* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #include "halfling/halfling_engine.h" #include "deferred_shading_demo/graphics_manager.h" #include "deferred_shading_demo/game_state_manager.h" int WI...
```c++ /* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #include "halfling/halfling_engine.h" #include "deferred_shading_demo/graphics_manager.h" #include "deferred_shading_demo/game_state_manager.h" int WI...
a1ea9132-5256-4173-ba5c-22c191edf5c1
{ "language": "C++" }
```c++ /* Author: vpetrigo Task: 0. , , , . , 0 ( 0 , ). . Sample Input 1: 4 4 2 3 0 Sample Output 1: 4 Sample Input 2: 2 1 0 Sample Output 2: 1 */ #include <iostream> using namespace std; int main() { int n; int max = -1; int s_max = -1; while (c...
```c++ /* Author: vpetrigo Task: 0. , , , . , 0 ( 0 , ). . Sample Input 1: 4 4 2 3 0 Sample Output 1: 4 Sample Input 2: 2 1 0 Sample Output 2: 1 */ #include <iostream> using namespace std; int main() { int n; int max = -1; int s_max = -1; while (c...
22fef1df-d662-4e81-ab8b-8437de776161
{ "language": "C++" }
```c++ /* * Copyright (c) 2015 Roc authors * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <CppUTest/CommandLineArguments.h> #include <CppUTest/Comm...
```c++ /* * Copyright (c) 2015 Roc authors * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <CppUTest/CommandLineArguments.h> #include <CppUTest/Comm...
94fc6ca9-9581-4988-be10-504655d41944
{ "language": "C++" }
```c++ #include "ros/ros.h" #include "pattern_posture_generator_node.hpp" int main(int argc, char* argv[]) { ros::init(argc, argv, "pattern_posture_generator"); ros::NodeHandle nh; PatternPostureGenerator ppg(nh); ros::spin(); return 0; } PatternPostureGenerator::PatternPostureGenerator(){} PatternPostu...
```c++ #include "ros/ros.h" #include "pattern_posture_generator_node.hpp" int main(int argc, char* argv[]) { ros::init(argc, argv, "pattern_posture_generator"); ros::NodeHandle nh; PatternPostureGenerator ppg(nh); ros::spin(); return 0; } PatternPostureGenerator::PatternPostureGenerator(){} PatternPostu...
8be32a47-8bf1-4356-b472-a649257aefda
{ "language": "C++" }
```c++ #include "ros/ros.h" #include "pattern_posture_generator_node.hpp" PatternPostureGenerator::PatternPostureGenerator(){} PatternPostureGenerator::PatternPostureGenerator(ros::NodeHandle& nh) { if (!nh.getParam("pattern", pattern_names)) return; for (std::map<std::string, std::string >::iterator it = patter...
```c++ #include "ros/ros.h" #include "pattern_posture_generator_node.hpp" int main(int argc, char* argv[]) { ros::init(argc, argv, "pattern_posture_generator"); ros::NodeHandle nh; PatternPostureGenerator ppg(nh); ros::spin(); return 0; } PatternPostureGenerator::PatternPostureGenerator(){} PatternPostu...
ff2976fc-670d-49e9-8a1b-427b60bb4afe
{ "language": "C++" }
```c++ /* * Copyright 2014-2015 Adam Chyła, adam@chyla.org * All rights reserved. Distributed under the terms of the MIT License. */ #include "../config.h" #if defined(HAVE_GTEST) && defined(HAVE_GMOCK) #include <gtest/gtest.h> int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); retu...
```c++ /* * Copyright 2014-2015 Adam Chyła, adam@chyla.org * All rights reserved. Distributed under the terms of the MIT License. */ #include "../config.h" #if defined(HAVE_GTEST) && defined(HAVE_GMOCK) #include <boost/log/common.hpp> #include <gtest/gtest.h> int main(int argc, char **argv) { boost::log::core:...
7fb8ce6f-4691-4377-9f46-8b9a762c3df6
{ "language": "C++" }
```c++ #include <cstring> #include "board.h" #include <aery32/all.h> using namespace aery; int main(void) { int errno; uint16_t page = FLASH_LAST_PAGE; char buf[512] = {'\0'}; init_board(); gpio_init_pin(LED, GPIO_OUTPUT|GPIO_HIGH); /* If page is empty, write "foo". Else read page. */ if (flashc_page_isempty...
```c++ #include <cstring> #include "board.h" #include <aery32/all.h> using namespace aery; void lock_flash_programspace(void) { int i = FLASH_LAST_PAGE; for (; flashc_page_isempty(i); i--); for (; i >= 0; i--) { flashc_lock_page(i); } } int main(void) { int errno; uint16_t page = FLASH_LAST_PAGE; char buf[5...
3e018b43-a356-408d-b76d-6a67090d6617
{ "language": "C++" }
```c++ //===----------------------------------------------------------------------===// // // 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++ //===----------------------------------------------------------------------===// // // 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. // //===---------------------------------...
bd764e3a-264d-4577-9eaf-ab7e2da62dac
{ "language": "C++" }
```c++ #include <algorithm> #include <iostream> #include <numeric> #include <string> int main() { size_t T; std::cin >> T; for (auto testCase{1u}; testCase <= T; ++testCase) { size_t N; std::cin >> N; std::string beautyScores; std::cin >> beautyScores; std::transform(beautyScores.begin(), bea...
```c++ #include <algorithm> #include <iostream> #include <numeric> #include <string> int main() { size_t T; std::cin >> T; for (auto testCase{1u}; testCase <= T; ++testCase) { size_t N; std::cin >> N; std::string beautyScores; std::cin >> beautyScores; std::transform(beautyScores.begin(), bea...
c1fd0d31-aaa0-47e7-a991-b87e0b83fe28
{ "language": "C++" }
```c++ // Tests -fsanitize-coverage=inline-8bit-counters // // REQUIRES: has_sancovcc,stable-runtime // UNSUPPORTED: i386-darwin, x86_64-darwin // // RUN: %clangxx -O0 %s -fsanitize-coverage=inline-8bit-counters 2>&1 #include <stdio.h> #include <assert.h> const char *first_counter; extern "C" void __sanitizer_cov_8b...
```c++ // Tests -fsanitize-coverage=inline-8bit-counters // // REQUIRES: has_sancovcc,stable-runtime // UNSUPPORTED: i386-darwin, x86_64-darwin, x86_64h-darwin // // RUN: %clangxx -O0 %s -fsanitize-coverage=inline-8bit-counters 2>&1 #include <stdio.h> #include <assert.h> const char *first_counter; extern "C" void __...
362f5806-cf0e-443b-a2b1-6ac698ad50a9
{ "language": "C++" }
```c++ #include "configs/includes.h" #include "power/gb_abstract_battery.h" #include "power/gb_battery.h" #include "utilities/gb_utility.h" #include <Arduino.h> class FakeBattery : public GbAbstractBattery { public: FakeBattery() : GbAbstractBattery(1, 3.4, 3.5, 3){}; float GetVoltage() { return (sin(millis()/...
```c++ #include "configs/includes.h" #include "power/gb_abstract_battery.h" #include "power/gb_battery.h" #include "utilities/gb_utility.h" #include <Arduino.h> class FakeBattery : public GbAbstractBattery { private: char _scheme; public: FakeBattery(char scheme) : GbAbstractBattery(1, 3.4, 3.5, 3), _scheme(scheme...
b78d1870-9639-4d89-868e-9b4ba7c7e074
{ "language": "C++" }
```c++ #include "Thread/Unix/ThreadImpl.hh" #include "Thread/ThreadException.hh" namespace LilWrapper { ThreadImpl::ThreadImpl(Thread *thread) { this->_isActive = pthread_create(&this->_thread, NULL, &ThreadImpl::entryPoint, thread) == 0; if (!this->_isActive) throw ThreadException("Thread Ex...
```c++ #include "Thread/Unix/ThreadImpl.hh" #include "Thread/ThreadException.hh" namespace LilWrapper { ThreadImpl::ThreadImpl(Thread *thread) { this->_isActive = pthread_create(&this->_thread, NULL, &ThreadImpl::entryPoint, thread) == 0; if (!this->_isActive) throw ThreadException("Thread Ex...
d4b2b0a1-1585-4da2-afd9-c71818b1d3e4
{ "language": "C++" }
```c++ // RUN: clang-cc -fsyntax-only -pedantic -std=c++0x -verify %s void foo(); void bar() { }; void wibble(); ; ``` Improve top-level-semicolon test a bit
```c++ // RUN: clang-cc -fsyntax-only -pedantic -std=c++0x -verify %s void foo(); void bar() { }; void wibble(); ; namespace Blah { void f() { }; void g(); } ```
49a7f930-7402-4150-8d5b-f54acdf8c947
{ "language": "C++" }
```c++ /* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkNullCanvas.h" #include "SkCanvas.h" #include "SKNWayCanvas.h" SkCanvas* SkCreateNullCanvas() { // An N-Way canvas forwards calls to N canvas's. When ...
```c++ /* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkNullCanvas.h" #include "SkCanvas.h" #include "SKNWayCanvas.h" SkCanvas* SkCreateNullCanvas() { // An N-Way canvas forwards calls to N canvas's. When ...
d001780d-51bf-4b31-9bb7-e4e1aaf1d657
{ "language": "C++" }
```c++ /* The MIT License (MIT) Copyright (c) 2013-2019 Winlin 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, m...
```c++ /* The MIT License (MIT) Copyright (c) 2013-2019 Winlin 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, m...
2c44a5e6-c336-404e-bf76-0363274b7122
{ "language": "C++" }
```c++ // This code is based on Sabberstone project. // Copyright (c) 2017-2019 SabberStone Team, darkfriend77 & rnilva // RosettaStone is hearthstone simulator using C++ with reinforcement learning. // Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon #include <Rosetta/Actions/Summon.hpp> #include <Rosetta...
```c++ // This code is based on Sabberstone project. // Copyright (c) 2017-2019 SabberStone Team, darkfriend77 & rnilva // RosettaStone is hearthstone simulator using C++ with reinforcement learning. // Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon #include <Rosetta/Actions/Summon.hpp> #include <Rosetta...
6153cf66-4cbf-4b65-94e4-9d1686d578c2
{ "language": "C++" }
```c++ #include "sleepy_discord/sleepy_discord.h" class myClientClass : public SleepyDiscord::DiscordClient { public: using SleepyDiscord::DiscordClient::DiscordClient; void onMessage(SleepyDiscord::Message message) { if (message.startsWith("whcg hello")) sendMessage(message.channelID, "Hello " + message.author...
```c++ #include "sleepy_discord/sleepy_discord.h" class myClientClass : public SleepyDiscord::DiscordClient { public: using SleepyDiscord::DiscordClient::DiscordClient; void onMessage(SleepyDiscord::Message message) { if (message.startsWith("whcg hello")) sendMessage(message.channelID, "Hello " + message.author...
659a00d8-3683-45c5-bcbf-e4a175e2f1fa
{ "language": "C++" }
```c++ /* * var_len_pool_test.cpp - Test suite for varrable lengthed allocation pool */ #include "test_suite.h" /* * VarLenPoolBasicTest() - This function allocates a series of memory * using an increasing sequence and then check * for correctness */ void VarLenP...
```c++ /* * var_len_pool_test.cpp - Test suite for varrable lengthed allocation pool */ #include "test_suite.h" #include "../src/VarLenPool.h" /* * VarLenPoolBasicTest() - This function allocates a series of memory * using an increasing sequence and then check * f...
a29477a6-3a7b-4093-b331-b7259d2b50d2
{ "language": "C++" }
```c++ // Copyright (C) 2011-2012, Zeex // // 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 or agr...
```c++ // Copyright (C) 2011-2012, Zeex // // 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 or agr...
57fce906-91da-4e0a-bfa5-7598b3a603df
{ "language": "C++" }
```c++ #include "compress.hpp" #include "huffman.hpp" std::string compress(const std::string& data) { using uch = unsigned char; std::array<uint64_t, BYTES_COUNT> freq_table; freq_table.fill(0); for(uch c : data) ++freq_table[c]; auto root = buildHuffmanTree(freq_table); auto table = buildCompressTable(root); ...
```c++ #include "compress.hpp" #include "huffman.hpp" std::string compress(const std::string& data) { using uch = unsigned char; std::array<uint64_t, BYTES_COUNT> freq_table; freq_table.fill(0); for(uch c : data) ++freq_table[c]; auto root = buildHuffmanTree(freq_table); auto table = buildCompressTable(root); ...
b29006d8-0269-4def-9838-61c5deafdcb6
{ "language": "C++" }
```c++ // Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "CreationRules.h" #include <cstdlib> void* autowiring::aligned_malloc(size_t ncb, size_t align) { void* pRetVal; if(posix_memalign(&pRetVal, ncb, align)) return nullptr; return pRetVal; } void autowiring::a...
```c++ // Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "CreationRules.h" #include <cstdlib> void* autowiring::aligned_malloc(size_t ncb, size_t align) { void* pRetVal; if(posix_memalign(&pRetVal, align, ncb)) return nullptr; return pRetVal; } void autowiring::a...
2892d58a-d13e-4acc-b430-d93ec177eeda
{ "language": "C++" }
```c++ #include "shape.hpp" Shape::Shape(): name_{}, color_{0.0, 0.0, 0.0} {} Shape::Shape(std::string const& name): name_{name}, color_{1.0, 1.0, 1.0} {} Shape::Shape(Color const& color): name_{}, color_{color} {} Shape::Shape(std::string cons...
```c++ #include "shape.hpp" Shape::Shape(): name_{}, color_{0.0, 0.0, 0.0} {} Shape::Shape(std::string const& name): name_{name}, color_{1.0, 1.0, 1.0} {} Shape::Shape(Color const& color): name_{}, color_{color} {} Shape::Shape(std::string cons...
9895e426-efc1-48cc-9125-8442aeaef090
{ "language": "C++" }
```c++ #define CATCH_CONFIG_MAIN #include "../catch.hpp" #include "../../NumberTheory/Fibonacci.cpp" TEST_CASE("Base cases", "[fibonacci]") { REQUIRE(fibonacci(0) == 0); REQUIRE(fibonacci(1) == 1); } TEST_CASE("Normal cases", "[fibonacci]") { REQUIRE(fibonacci(2) == 1); REQUIRE(fibonacci(7) == 13); ...
```c++ #define CATCH_CONFIG_MAIN #define TEST #include "../catch.hpp" #include "../../NumberTheory/Fibonacci.cpp" TEST_CASE("Base cases", "[fibonacci]") { REQUIRE(fibonacci(0) == 0); REQUIRE(fibonacci(1) == 1); } TEST_CASE("Normal cases", "[fibonacci]") { REQUIRE(fibonacci(2) == 1); REQUIRE(fibonacci...
a7c9f24a-8aac-4ae0-977c-bd18727cea1e
{ "language": "C++" }
```c++ // Copyright (c) 2009 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. // This is a simple allocator based on the windows heap. extern "C" { HANDLE win_heap; bool win_heap_init(bool use_lfh) { win_heap = HeapC...
```c++ // Copyright (c) 2009 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. // This is a simple allocator based on the windows heap. extern "C" { HANDLE win_heap; bool win_heap_init(bool use_lfh) { win_heap = HeapC...
c856c2af-e3cd-48b6-bad7-cc93b22e63e4
{ "language": "C++" }
```c++ #pragma push_macro("N") #undef N #include <llvm/IR/IRBuilder.h> #pragma pop_macro("N") namespace eosio { namespace chain { namespace eosvmoc { namespace LLVMJIT { llvm::Value* CreateInBoundsGEPWAR(llvm::IRBuilder<>& irBuilder, llvm::Value* Ptr, llvm::Value* v1, llvm::Value* v2) { if(!v2) return irBuild...
```c++ #include <llvm/IR/IRBuilder.h> namespace eosio { namespace chain { namespace eosvmoc { namespace LLVMJIT { llvm::Value* CreateInBoundsGEPWAR(llvm::IRBuilder<>& irBuilder, llvm::Value* Ptr, llvm::Value* v1, llvm::Value* v2) { if(!v2) return irBuilder.CreateInBoundsGEP(Ptr, v1); else return irBu...
11c129b9-e81b-48fa-b357-4a84023864ee
{ "language": "C++" }
```c++ #include <QGuiApplication> #include <QQuickView> #include <QQmlContext> #include "sailfishapplication.h" #include "servercomm.h" Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QGuiApplication> app(Sailfish::createApplication(argc, argv)); QScopedPointer<QQuickView> view(Sailfish::crea...
```c++ #include <QGuiApplication> #include <QQuickView> #include <QQmlContext> #include <QQuickWindow> #include "sailfishapplication.h" #include "servercomm.h" Q_DECL_EXPORT int main(int argc, char *argv[]) { QQuickWindow::setDefaultAlphaBuffer(true); QScopedPointer<QGuiApplication> app(Sailfish::createAppli...
daeef71c-f79e-4e40-883b-8789d71ae6d2
{ "language": "C++" }
```c++ #include <ncurses.h> #include "print.hpp" #include "lightsout.hpp" using namespace roadagain; int main() { initscr(); cbreak(); noecho(); start_color(); init_colors(); board b(5, 5); while (!b.is_perfect()){ char c = getch(); switch (c){ case 'h': ...
```c++ #include <ncurses.h> #include <cstring> #include <cstdlib> #include "print.hpp" #include "lightsout.hpp" using namespace roadagain; int main(int argc, char** argv) { initscr(); cbreak(); noecho(); start_color(); init_colors(); int width = 5; int height = 5; for (int i = 1; i < ...
23875dd6-426d-4b34-9f0d-42a42e8baf21
{ "language": "C++" }
```c++ #include <iostream> using namespace std; int week_day(int day, int month, int year) { int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; year -= month < 3; return (year + year / 4 - year / 100 + year / 400 + t[month - 1] + day) % 7; } int main() { int y, m, count = 0; for (y = 1901; y <=...
```c++ #include <iostream> using namespace std; int week_day(int day, int month, int year) { int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; year -= month < 3; return (year + year / 4 - year / 100 + year / 400 + t[month - 1] + day) % 7; } int main() { int y, m, count = 0; for (y = 1901; y <= 200...
c33ee4fe-494b-44ae-89b7-da09da5de781
{ "language": "C++" }
```c++ #include <iostream> #include <vector> #include <string> using namespace std; class StringBuilder { vector<string> _buffer; StringBuilder() { // this._buffer = new List(); } public: StringBuilder append(string text) { _buffer.push_back(text); return *this; } /* ...
```c++ #include <iostream> #include <vector> #include <string> using namespace std; class StringBuilder { vector<string> _buffer; public: StringBuilder() { } StringBuilder append(string text) { _buffer.push_back(text); return *this; } StringBuilder insert(int index, strin...
6147d0d9-c9ed-464c-b078-33b3b91f0538
{ "language": "C++" }
```c++ #include "gamescreen.hpp" #include "ui/menu.hpp" #include "ui/event.hpp" #include "world.hpp" #include "player.hpp" #include "scenery.hpp" namespace Space { void GameScreen::handleEvent(UI::Event const &evt) { switch (evt.type) { case UI::KeyDown: case UI::KeyUp: handleKey(evt.keyEvent()); ...
```c++ #include "gamescreen.hpp" #include "ui/menu.hpp" #include "ui/event.hpp" #include "world.hpp" #include "player.hpp" #include "scenery.hpp" namespace Space { void GameScreen::handleEvent(UI::Event const &evt) { switch (evt.type) { case UI::KeyDown: case UI::KeyUp: handleKey(evt.keyEvent()); ...
d4b712b2-cf4a-4053-bd5f-359816c65a73
{ "language": "C++" }
```c++ #include <bitcoin/utility/timed_section.hpp> #include <bitcoin/utility/logger.hpp> namespace libbitcoin { timed_section::timed_section( const std::string& context, const std::string& section) : context_(context), section_(section) { clock_gettime(CLOCK_REALTIME, &start_); } timed_section::~timed_se...
```c++ #include <bitcoin/utility/timed_section.hpp> #include <bitcoin/utility/logger.hpp> #ifdef __MACH__ #include <mach/clock.h> #include <mach/mach.h> #define CLOCK_REALTIME 0 void clock_gettime(int ign, struct timespec * ts) { clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_...
ce6ad206-ca75-4814-b6ba-c2c53c965740
{ "language": "C++" }
```c++ // Copyright 2014-present Bill Fisher. All rights reserved. #include "ofpx_jsonrpc.h" #include "ofp/api/apiserver.h" using namespace ofpx; using ExitStatus = JsonRpc::ExitStatus; const int STDIN = 0; const int STDOUT = 1; //-------// // r u n // //-------// int JsonRpc::run(int argc, char **argv) { cl::Pa...
```c++ // Copyright 2014-present Bill Fisher. All rights reserved. #include "ofpx_jsonrpc.h" #include "ofp/api/apiserver.h" using namespace ofpx; using ExitStatus = JsonRpc::ExitStatus; const int STDIN = 0; const int STDOUT = 1; //-------// // r u n // //-------// int JsonRpc::run(int argc, char **argv) { cl::Pa...
55ab5f2f-a62f-418d-9abf-dff0242357eb
{ "language": "C++" }
```c++ #define CAT(X,Y) CAT_(X,Y) #define CAT_(X,Y) X ## Y #define COUNTSTRING(Stem,Val) \ Stem: \ CAT(.L_,Stem): \ .wor...
```c++ #define CAT(X,Y) CAT_(X,Y) #define CAT_(X,Y) X ## Y #define COUNTSTRING(Stem,Val) \ Stem: \ CAT(.L_,Stem): \ .wor...
fc853d9a-f4a9-4809-bc4d-e3531e5c6ad8
{ "language": "C++" }
```c++ #include <string.h> #include <stdlib.h> #include <stdio.h> #include <3ds.h> #include "constants.h" #include "patches.h" #define log(...) fprintf(stderr, __VA_ARGS__) int main(int argc, char** argv) { gfxInitDefault(); consoleInit(GFX_TOP, NULL); GetVersionConstants(); PatchSrvAccess(); // ON...
```c++ #include <string.h> #include <stdlib.h> #include <stdio.h> #include <3ds.h> #include "constants.h" #include "patches.h" #define log(...) fprintf(stderr, __VA_ARGS__) int main(int argc, char** argv) { gfxInitDefault(); consoleInit(GFX_TOP, NULL); if (!GetVersionConstants()) { log("Warning...
6c21d8c7-30c8-4527-ae8e-fe4da013f84d
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-pch -o %t.1 %s // RUN: %clang_cc1 -triple x86_64-linux-gnu -error-on-deserialized-decl S1_keyfunc -error-on-deserialized-decl S3 -include-pch %t.1 -emit-pch -o %t.2 %s // RUN: %clang_cc1 -triple x86_64-linux-gnu -error-on-deserialized-decl S1_method -error-on-des...
```c++ // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-pch -o %t.1 %s // RUN: %clang_cc1 -triple x86_64-linux-gnu -error-on-deserialized-decl S1_keyfunc -error-on-deserialized-decl S3 -include-pch %t.1 -emit-pch -o %t.2 %s // RUN: %clang_cc1 -triple x86_64-linux-gnu -error-on-deserialized-decl S1_method -error-on-des...
a1e5fe0a-9200-434e-89c0-941c5fbc0078
{ "language": "C++" }
```c++ #include "library.h" #include "libs/console.h" // console.log, console.error namespace grok { namespace libs { using namespace grok::vm; using namespace grok::obj; int LoadLibraries(VMContext *ctx) { // just console for now auto V = GetVStore(ctx); auto C = std::make_shared<Console>(); auto ...
```c++ #include "library.h" #include "libs/console.h" // console.log, console.error namespace grok { namespace libs { using namespace grok::vm; using namespace grok::obj; int LoadLibraries(VMContext *ctx) { // just console for now auto V = GetVStore(ctx); auto C = std::make_shared<Console>(); Defin...
4e404ed0-3f2a-4809-83c4-6e15b436bd10
{ "language": "C++" }
```c++ #include "thread_cache.h" #include "allocators/dq_sc_allocator.h" #include "runtime_vars.h" namespace { cache_aligned SpinLock g_threadcache_lock(LINKER_INITIALIZED); cache_aligned scalloc::PageHeapAllocator<scalloc::ThreadCache, 64> g_threadcache_alloc; cache_aligned uint64_t g_thread_id; } // namespace n...
```c++ #include "thread_cache.h" #include "allocators/dq_sc_allocator.h" #include "runtime_vars.h" namespace { cache_aligned SpinLock g_threadcache_lock(LINKER_INITIALIZED); cache_aligned scalloc::PageHeapAllocator<scalloc::ThreadCache, 64> g_threadcache_alloc; cache_aligned uint64_t g_thread_id; } // namespace n...
d490b07d-81c9-446e-9fe6-2d74486b736c
{ "language": "C++" }
```c++ #include "./test.h" #include "../src/camera.h" TEST(Test_Camera, ConstructorFromMatrices) { Camera expected; Camera camera(expected.getViewMatrix(), expected.getProjectionMatrix(), expected.getOrigin()); EXPECT_Vector3f_NEAR(expected.getPosition(), camera.getPosition(), 1e-5f); EXPECT...
```c++ #include "./test.h" #include "../src/camera.h" TEST(Test_Camera, ConstructorFromMatricesWithDefaultValues) { Camera expected; Camera camera(expected.getViewMatrix(), expected.getProjectionMatrix(), expected.getOrigin()); EXPECT_Vector3f_NEAR(expected.getPosition(), camera.getPosition(), ...
7693b956-42fd-466e-85ac-14b16067aedc
{ "language": "C++" }
```c++ /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkColorMatrixFilter.h" static SkScalar byte_to_scale(U8CPU byte) { if (0xFF == byte) { // want to get this exact return 1; } else { ...
```c++ /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkColorMatrixFilter.h" static SkScalar byte_to_scale(U8CPU byte) { if (0xFF == byte) { // want to get this exact return 1; } else { ...
bec77e53-2b9a-44fa-aeb4-41b328c03ec1
{ "language": "C++" }
```c++ #include <QApplication> #include "mainwindow.h" #include "runguard.h" int main(int argc, char **argv) { RunGuard guard("UwNDcyZjc6MjE1tN2Ma3NGIf5OGx"); if (!guard.tryToRun()) return 0; QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } ``` Allow to run ...
```c++ #include <QApplication> #include "mainwindow.h" #include "runguard.h" QString getUserName() { QString name = qgetenv("USER"); if (name.isEmpty()) name = qgetenv("USERNAME"); return name; } int main(int argc, char **argv) { RunGuard guard(getUserName() + "-doer-UwNDcyZjc6MjE1tN2Ma3NGI...
c9cd9bbf-a9b4-4cb6-8f14-648cec8ba54a
{ "language": "C++" }
```c++ #include <iostream> #include <cstdlib> // for RAND_MAX #include <ctime> using namespace std; int main(int argc, char* argv[]) { const int LARGEST_POSSIBLE = 100; srand(time(0)); // seed the random number generator based on current time //srand(10); rand(); // the rand() function generates a rand...
```c++ #include <iostream> #include <random> using namespace std; int main(int argc, char* argv[]) { const int LARGEST_POSSIBLE = 100; // Some of this will look funny for now; we will explain later. // A random_device helps to "seed" a number generator. random_device rd; // a compiler-chosen "good" ra...
fc393d5b-e94c-4a5a-a1cd-6c7a75f54cb7
{ "language": "C++" }
```c++ #include <Pith/Config.hpp> #include <Pith/Page.hpp> #include <gtest/gtest.h> using namespace Pith; TEST(TestPage, StackAllocate) { Page p; } TEST(TestPage, mapOnePage) { Span<Page> pages{nullptr, 1}; auto result = Page::map(pages); EXPECT_TRUE(result); EXPECT_NE(result(), nullptr); pages.value(result())...
```c++ #include <Pith/Config.hpp> #include <Pith/Page.hpp> #include <gtest/gtest.h> using namespace Pith; TEST(TestPage, stackAllocate) { [[maybe_unused]] Page p; } TEST(TestPage, mapOnePage) { Span<Page> pages{nullptr, 1}; auto result = Page::map(pages); EXPECT_TRUE(result); EXPECT_NE(result(), nullptr); page...
18b0d5b2-eeec-468a-91da-384f86a08465
{ "language": "C++" }
```c++ // // Copyright (c) 2018 The nanoFramework project contributors // See LICENSE file in the project root for full license information. // #include "nf_networking_sntp.h" static const CLR_RT_MethodHandler method_lookup[] = { NULL, Library_nf_networking_sntp_nanoFramework_Networking_Sntp::Start___STATIC_...
```c++ // // Copyright (c) 2018 The nanoFramework project contributors // See LICENSE file in the project root for full license information. // #include "nf_networking_sntp.h" static const CLR_RT_MethodHandler method_lookup[] = { NULL, Library_nf_networking_sntp_nanoFramework_Networking_Sntp::Start___STATIC_...
a486b758-ee0d-489c-8d55-fe854ddc32d4
{ "language": "C++" }
```c++ /** * Zillians MMO * Copyright (C) 2007-2010 Zillians.com, Inc. * For more information see http://www.zillians.com * * Zillians MMO is the library and runtime for massive multiplayer online game * development in utility computing model, which runs as a service for every * developer to build their virtual ...
```c++ /** * Zillians MMO * Copyright (C) 2007-2010 Zillians.com, Inc. * For more information see http://www.zillians.com * * Zillians MMO is the library and runtime for massive multiplayer online game * development in utility computing model, which runs as a service for every * developer to build their virtual ...