doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
07467554-d36d-447e-97d0-ee6ed4a757d0
{ "language": "C++" }
```c++ #ifndef INPUTHELPER_CPP #define INPUTHELPER_CPP #include <termios.h> #include <iostream> #include <cstring> #include "InputHelper.h" using namespace std; void InputHelper::handleEvents(sf::RenderWindow *window) { m_input = '\0'; sf::Event event; while(window->pollEvent(event)) { switch(event.type) { ...
```c++ #ifndef INPUTHELPER_CPP #define INPUTHELPER_CPP #include <termios.h> #include <iostream> #include <cstring> #include "InputHelper.h" using namespace std; void InputHelper::handleEvents(sf::RenderWindow *window) { m_input = '\0'; sf::Event event; while(window->pollEvent(event)) { switch(event.type) { ...
785e193c-b2e2-4d27-bcb1-316a337094eb
{ "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 "crypto/ec_signature_creator.h" #include "crypto/ec_signature_creator_impl.h" namespace crypto { namespace { ECSignatureCreatorFac...
```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 "crypto/ec_signature_creator.h" #include "base/logging.h" #include "crypto/ec_signature_creator_impl.h" namespace crypto { namespac...
17602b00-5582-4630-8d26-5b0c704bfb57
{ "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:...
35eb5053-3394-4b1d-82d9-b26e3a93f95d
{ "language": "C++" }
```c++ #include "includes/SWidgets/SSearchArea.hpp" #include "includes/SMainWindow.hpp" SSearchArea::SSearchArea(const QIcon & icon, SMainWindow * parent) : QLineEdit(parent), m_parent(parent), m_icon(icon) { setTextMargins(18, 0, 0, 0); connect(this, &SSearchArea::returnPressed, this, &SSearchArea::loadSearch);...
```c++ #include "includes/SWidgets/SSearchArea.hpp" #include "includes/SMainWindow.hpp" SSearchArea::SSearchArea(const QIcon & icon, SMainWindow * parent) : QLineEdit(parent), m_parent(parent), m_icon(icon) { setTextMargins(18, 0, 0, 0); connect(this, &SSearchArea::returnPressed, this, &SSearchArea::loadSearc...
fbaaedab-4eb5-4ed8-ace3-f432b737b475
{ "language": "C++" }
```c++ // RUN: %clangxx -O2 %s -o %t && %run %t 2>&1 | FileCheck %s // XFAIL: android #include <stdio.h> // getauxval() used instead of sysconf() in GetPageSize() is defined starting // glbc version 2.16. #if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 16) extern "C" long sysconf(int name) { fprintf(stderr, "sysc...
```c++ // RUN: %clangxx -O2 %s -o %t && %run %t 2>&1 | FileCheck %s #include <stdio.h> #if !defined(__GLIBC_PREREQ) #define __GLIBC_PREREQ(a, b) 0 #endif // getauxval() used instead of sysconf() in GetPageSize() is defined starting // glbc version 2.16. #if __GLIBC_PREREQ(2, 16) extern "C" long sysconf(int name) { ...
956b7226-ffe3-4c09-b02c-c9f8c5477b24
{ "language": "C++" }
```c++ // xml_writer.cc see license.txt for copyright and terms of use #include "xml_writer.h" #include "xmlhelp.h" // xmlAttrDeQuote() etc. #include "exc.h" // xBase bool sortNameMapDomainWhenSerializing = true; XmlWriter::XmlWriter(IdentityManager &idmgr0, ostream *out0, int &...
```c++ // xml_writer.cc see license.txt for copyright and terms of use #include "xml_writer.h" #include "xmlhelp.h" // xmlAttrDeQuote() etc. #include "exc.h" // xBase bool sortNameMapDomainWhenSerializing = true; XmlWriter::XmlWriter(IdentityManager &idmgr0, ostream *out0, int &...
4dcace96-1cb2-4908-a478-29e4c91c5b7d
{ "language": "C++" }
```c++ #define BOOST_TEST_MODULE Utility_function_tests #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_CASE( fieldListFromString_tests ) { } ``` Add first test, trigger Travis CI
```c++ #define BOOST_TEST_MODULE Utility_function_tests #include <boost/test/unit_test.hpp> #include "easyprint" template <typename T, typename DELIMITER> std::string easyprint_test(T&& container, DELIMITER d ){ std::stringstream ss; print_line(ss, std::forward<T>(container), d); return ss.str(); }; BOOS...
213571c2-f5d7-4d83-8f11-642eb67a83f2
{ "language": "C++" }
```c++ #include <dlib/image_loader/png_loader.cpp> #include <dlib/image_saver/save_png.cpp> #include <dlib/image_loader/jpeg_loader.cpp> #include <dlib/image_saver/save_jpeg.cpp> ``` Revert "Exchange the order to load jpeg and png"
```c++ #include <dlib/image_loader/jpeg_loader.cpp> #include <dlib/image_saver/save_jpeg.cpp> #include <dlib/image_loader/png_loader.cpp> #include <dlib/image_saver/save_png.cpp> ```
eaba0ca2-8d03-4028-80dd-f6c244a52201
{ "language": "C++" }
```c++ #include "UnitTest++/UnitTest++.h" #include "StrongAI/AI/DarwinAI/DarwinAI.hpp" class MyDarwinAI : public DarwinAI { public: MyDarwinAI() : DarwinAI( 0, 1, 0, 1 ) { } //Select for highest output float fitnessEval( NeuralNetAI& ai ) { ...
```c++ #include "UnitTest++/UnitTest++.h" #include "StrongAI/AI/DarwinAI/DarwinAI.hpp" class MyDarwinAI : public DarwinAI { public: MyDarwinAI() : DarwinAI( 0, 1, 0, 1 ) { } //Select for highest output float fitnessEval( NeuralNetAI& ai ) { ...
5ade488e-d52c-4243-aff6-850013b54e48
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -x c++ -emit-llvm < %s | FileCheck %s struct A { A(int); ~A(); }; int f(const A &); // CHECK: call void @_ZN1AC1Ei // CHECK-NEXT: call i32 @_Z1fRK1A // CHECK-NEXT: call void @_ZN1AD1Ev // CHECK: call void @_ZN1AC1Ei // CHECK-NEXT: call i32 @_Z1fRK1A // CHECK-NEXT: call void @_ZN1AD1Ev templat...
```c++ // RUN: %clang_cc1 -x c++ -triple x86_64-pc-linux-gnu -emit-llvm < %s | FileCheck %s struct A { A(int); ~A(); }; int f(const A &); // CHECK: call void @_ZN1AC1Ei // CHECK-NEXT: call i32 @_Z1fRK1A // CHECK-NEXT: call void @_ZN1AD1Ev // CHECK: call void @_ZN1AC1Ei // CHECK-NEXT: call i32 @_Z1fRK1A // CHECK-NEXT: ...
e7fae8f2-203f-4c35-ad47-d39269fac8b5
{ "language": "C++" }
```c++ #include "U8Gettext.h" #include <Arduino.h> #define ENSURE(condition) do { if (!(condition)) {Serial.println("ENSURE failed at: "#condition); while(1); } } while(0) #define SIZE_OF_ARRAY(array) (sizeof((array))/sizeof((array)[0])) #define PTR_OFFSET_BYTES(ptr, nBytes) ((void*)(((char *)(ptr)) + (nBytes))...
```c++ #include "U8Gettext.h" #include <Arduino.h> #define ENSURE(condition) do { if (!(condition)) {Serial.println("ENSURE failed at: "#condition); while(1); } } while(0) #define SIZE_OF_ARRAY(array) (sizeof((array))/sizeof((array)[0])) #define PTR_OFFSET_BYTES(ptr, nBytes) ((void*)(((char *)(ptr)) + (nBytes))...
be6331d1-fa21-4ee6-9bbd-d5e6dedd89d9
{ "language": "C++" }
```c++ #include "game.h" #include "button.h" #include "screen.h" #include "led.h" #include "timer.h" #include "const.h" #include "logger.h" #include "helper.h" #include "controller.h" namespace game { namespace { unsigned long startTime; const unsigned long GAME_TIME = 3000; unsigned int buttonsPressed ...
```c++ #include "game.h" #include "button.h" #include "screen.h" #include "led.h" #include "timer.h" #include "const.h" #include "logger.h" #include "helper.h" #include "controller.h" namespace game { namespace { const unsigned long GAME_TIME = 3000; unsigned long endTime; unsigned int buttons...
06fcf0c2-2aba-473b-a0e1-04463fa7775c
{ "language": "C++" }
```c++ /** * @file example.cpp * @author Marcus Edel * * Simple random agent. */ #include <iostream> #include "environment.hpp" using namespace gym; int main(int argc, char* argv[]) { const std::string environment = "CartPole-v0"; const std::string host = "kurg.org"; const std::string port = "4040"; d...
```c++ /** * @file example.cpp * @author Marcus Edel * * Simple random agent. */ #include <iostream> #include "environment.hpp" using namespace gym; int main(int argc, char* argv[]) { const std::string environment = "CartPole-v0"; const std::string host = "kurg.org"; const std::string port = "4040"; d...
34e54850-d719-4c95-8a0c-0b72a25ddcf0
{ "language": "C++" }
```c++ #include "PatternMatcherOnig.h" #include <cstring> // Static member initiallization PatternMatcherOnig::Mutex PatternMatcherOnig::mutex; PatternMatcherOnig::PatternMatcherOnig( const char * regexp ) { int r; UChar * pattern = (UChar *) regexp; OnigErrorInfo einfo; { ScopedLock guard(m...
```c++ #include "PatternMatcherOnig.h" #include <cstring> // Static member initiallization PatternMatcherOnig::Mutex PatternMatcherOnig::mutex; PatternMatcherOnig::PatternMatcherOnig( const char * regexp ) { int r; UChar * pattern = (UChar *) regexp; OnigErrorInfo einfo; { ScopedLock guard(m...
f3f5a141-7dff-45ab-806f-e50121d391c4
{ "language": "C++" }
```c++ #include "HaxeRuntime.h" #include "IntPtr.h" #include "HaxeInit.h" #include <uhx/GcRef.h> ::uhx::GcRef::GcRef() { check_hx_init(); this->ref = ::uhx::expose::GcRefStatic::init(); } ::uhx::GcRef::~GcRef() { ::uhx::expose::GcRefStatic::destruct(this->ref); } ::uhx::GcRef::GcRef(const GcRef& rhs) { this-...
```c++ #include "HaxeRuntime.h" #include "CoreMinimal.h" #include "IntPtr.h" #include "HaxeInit.h" #include "uhx/GcRef.h" #include "CoreGlobals.h" ::uhx::GcRef::GcRef() { if (!GIsRetrievingVTablePtr) { check_hx_init(); this->ref = ::uhx::expose::GcRefStatic::init(); } else { this->ref = 0; } } ::uhx...
89b6c1e1-519b-46e1-9993-056f48a38b9d
{ "language": "C++" }
```c++ #include <iostream> #include "reader.h" namespace { class Repl { std::istream& in_; std::ostream& out_; std::string prompt_ = "mclisp> "; mclisp::Reader reader_; public: explicit Repl(std::istream& in=std::cin, std::ostream& out=std::cout): in_(in), out_(out), reader_(in_) {}; int lo...
```c++ #include <iostream> #include "reader.h" namespace { class Repl { std::istream& in_; std::ostream& out_; std::string prompt_ = "mclisp> "; mclisp::Reader reader_; public: explicit Repl(std::istream& in=std::cin, std::ostream& out=std::cout): in_(in), out_(out), reader_(in_) {}; int lo...
263819da-73a6-4e6d-8d4a-e4dfb953b718
{ "language": "C++" }
```c++ // Source : https://oj.leetcode.com/problems/container-with-most-water/ // Author : Hao Chen // Date : 2014-06-22 /********************************************************************************** * * Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). * n v...
```c++ // Source : https://oj.leetcode.com/problems/container-with-most-water/ // Author : Hao Chen // Date : 2014-06-22 /********************************************************************************** * * Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). * n v...
89727e71-b13c-4d49-9a32-a6e693f4eb61
{ "language": "C++" }
```c++ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/clock.h> #include <vespa/fastos/thread.h> using vespalib::Clock; using vespalib::duration; using vespalib::steady_time...
```c++ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/clock.h> #include <vespa/fastos/thread.h> using vespalib::Clock; using vespalib::duration; using vespalib::steady_time...
046ed931-2f48-4b54-8c13-3d68f7375925
{ "language": "C++" }
```c++ /** * Author: Denis Anisimov 2015 * * Implementation of telegram bot * */ #include "telegram_bot.h" #include <chrono> #include <thread> #include <cpprest/http_client.h> constexpr char kTelegramEndpoint[] = "https://api.telegram.org/bot"; TelegramBot::TelegramBot(std::string token) : token_(token), ...
```c++ /** * Author: Denis Anisimov 2015 * * Implementation of telegram bot * */ #include "telegram_bot.h" #include <chrono> #include <thread> #include <cpprest/http_client.h> constexpr char kTelegramEndpoint[] = "https://api.telegram.org/bot"; TelegramBot::TelegramBot(std::string token) : token_(token), ...
1ee315ec-e6e8-43f0-b1c9-afa6ab91827e
{ "language": "C++" }
```c++ // Copyright (c) 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/system_monitor.h" namespace base { void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) { PowerEvent po...
```c++ // Copyright (c) 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/system_monitor.h" namespace base { void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) { PowerEvent po...
36d33fb2-8340-4316-9f78-bbdff4ac2185
{ "language": "C++" }
```c++ /** * \file dynamiclibrary.cpp * \author Thibault Schueller <ryp.sqrt@gmail.com> * \brief DynamicLibrary class */ #include "dynamiclibrary.hpp" #include "exception/dynlibexception.hpp" DynamicLibrary::DynamicLibrary(const std::string& file) : _file(file), _handle(nullptr) {} void DynamicLibrary::ope...
```c++ /** * \file dynamiclibrary.cpp * \author Thibault Schueller <ryp.sqrt@gmail.com> * \brief DynamicLibrary class */ #include "dynamiclibrary.hpp" #include "exception/dynlibexception.hpp" DynamicLibrary::DynamicLibrary(const std::string& file) : _file(file), _handle(nullptr) {} void DynamicLibrary::ope...
423db625-4b34-4e5c-a741-f94c77cc2171
{ "language": "C++" }
```c++ #include <cuda_runtime_api.h> #include <stdio.h> int main(void) { int num_devices = 0; cudaGetDeviceCount(&num_devices); if(num_devices > 0) { cudaDeviceProp properties; cudaGetDeviceProperties(&properties, 0); printf("--gpu-architecture=sm_%d%d", properties.major, properties.minor); ret...
```c++ #include <cuda_runtime_api.h> #include <stdio.h> #include <stdlib.h> void usage(const char *name) { printf("usage: %s [device_id]\n", name); } int main(int argc, char **argv) { int num_devices = 0; int device_id = 0; if(argc == 2) { device_id = atoi(argv[1]); } else if(argc > 2) { usage...
15de6807-8e9b-4407-b7db-954a0b036490
{ "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 "base/cancellation_flag.h" #include "base/logging.h" namespace base { void CancellationFlag::Set() { #if !defined(NDEBUG) DCHECK(...
```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/cancellation_flag.h" #include "base/logging.h" namespace base { void CancellationFlag::Set() { #if !defined(NDEBUG) DCHECK_...
ffd0fca3-ebc1-4204-ae14-ff65087806b0
{ "language": "C++" }
```c++ // infoware - C++ System information Library // // Written in 2017 by nabijaczleweli <nabijaczleweli@gmail.com> and ThePhD <phdofthehouse@gmail.com> // // To the extent possible under law, the author(s) have dedicated all copyright and related // and neighboring rights to this software to the public domain world...
```c++ // infoware - C++ System information Library // // Written in 2017 by nabijaczleweli <nabijaczleweli@gmail.com> and ThePhD <phdofthehouse@gmail.com> // // To the extent possible under law, the author(s) have dedicated all copyright and related // and neighboring rights to this software to the public domain world...
74963cff-d074-49cc-8e68-7765706a5f7e
{ "language": "C++" }
```c++ // Copyright (C) 2015 by Pedro Mendes, Virginia Tech Intellectual // Properties, Inc., University of Heidelberg, and The University // of Manchester. // All rights reserved. #include "sstream" #include "qtUtilities.h" #include "CQValidatorUnit.h" CQValidatorUnit::CQValidatorUnit(QLineEdit * parent, const char ...
```c++ // Copyright (C) 2015 by Pedro Mendes, Virginia Tech Intellectual // Properties, Inc., University of Heidelberg, and The University // of Manchester. // All rights reserved. #include "sstream" #include "qtUtilities.h" #include "CQValidatorUnit.h" #include "utilities/CCopasiException.h" CQValidatorUnit::CQValid...
c837dd34-31b3-4416-9edb-6b0a2e785b74
{ "language": "C++" }
```c++ #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } ``` Add Main Window Title + version
```c++ #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); setWindowTitle("CRC Calculator ver " + QString::number(MAJOR_VERSION) + '.' + QString::number(MINOR_VERSION)); } MainWindow::~Main...
5299a55f-580e-4b4c-99c2-349e95527186
{ "language": "C++" }
```c++ #include "usbCamera.h" enum Default { DEFAULT_CAMERA_INDEX = 0, DEFAULT_FPS = 1 }; USBCamera::USBCamera(int frameRate, int cameraIndex, string hostname): it(nh), videoStream(cameraIndex) { nh.param<int>("cameraIndex", cameraIndex, DEFAULT_CAMERA_INDEX); nh.param...
```c++ #include "usbCamera.h" enum Default { DEFAULT_CAMERA_INDEX = 0, DEFAULT_FPS = 1 }; USBCamera::USBCamera(int frameRate, int cameraIndex, string hostname): it(nh), videoStream(cameraIndex) { nh.param<int>("cameraIndex", cameraIndex, DEFAULT_CAMERA_INDEX); nh.param...
ba7a6b80-4f6c-400e-a5e2-04507813e7d0
{ "language": "C++" }
```c++ /** * @file compressor_test.cpp * @author Chase Geigle */ #include <array> #include <iostream> #include <fstream> #include "util/gzstream.h" using namespace meta; int main(int argc, char** argv) { if (argc < 3) { std::cerr << "Usage: " << argv[0] << " input output" << std::endl; ret...
```c++ /** * @file compressor_test.cpp * @author Chase Geigle */ #include <array> #include <iostream> #include <fstream> #include "io/gzstream.h" using namespace meta; int main(int argc, char** argv) { if (argc < 3) { std::cerr << "Usage: " << argv[0] << " input output" << std::endl; retur...
cb6bb7f2-89f0-4827-96ee-c302db992f89
{ "language": "C++" }
```c++ #include "startuplaunch.h" #include <QDesktopServices> StartupLaunch::StartupLaunch() { } bool StartupLaunch::addOnStartup(QString name, QString executable, QString comments) { qWarning() << " add to startup not yet implemented on macx"; return false; } bool StartupLaunch::removeFromStartup(QString ...
```c++ #include "startuplaunch.h" #include <QDesktopServices> StartupLaunch::StartupLaunch() { } bool StartupLaunch::addOnStartup(QString name, QString executable, QString comments) { QString autostartPath = QDesktopServices::storageLocation(QDesktopServices::HomeLocation)+"/Library/LaunchAgents"; if(false=...
15807070-a766-4061-9369-2a2fcf909434
{ "language": "C++" }
```c++ //////////////////////////////////////////////////////////////////////////////////////////////// /// /// @file /// @author Kuba Sejdak /// @date 21.08.2016 /// /// @copyright This file is a part of cosmos OS. All rights reserved. /// ////////////////////////////////////////////////////////////////////...
```c++ //////////////////////////////////////////////////////////////////////////////////////////////// /// /// @file /// @author Kuba Sejdak /// @date 21.08.2016 /// /// @copyright This file is a part of cosmos OS. All rights reserved. /// ////////////////////////////////////////////////////////////////////...
756ea2fe-0dd0-49af-b486-a98acafbedd6
{ "language": "C++" }
```c++ #include "webrtc/base/thread.h" #include "webrtc/p2p/base/basicpacketsocketfactory.h" #include "webrtc/api/peerconnectioninterface.h" #include "webrtc/api/test/fakeconstraints.h" #include "webrtc/media/engine/webrtcvideocapturerfactory.h" int main(int argc, char* argv[]) { // something from base rtc::Thread...
```c++ #include "webrtc/rtc_base/thread.h" #include "webrtc/p2p/base/basicpacketsocketfactory.h" #include "webrtc/api/peerconnectioninterface.h" #include "webrtc/api/test/fakeconstraints.h" #include "webrtc/media/engine/webrtcvideocapturerfactory.h" int main(int argc, char* argv[]) { // something from base rtc::Th...
c09c0efd-7d8a-4e8a-8554-064c346f4c60
{ "language": "C++" }
```c++ //Copyright (c) 2015 Ultimaker B.V. //UltiScanTastic is released under the terms of the AGPLv3 or higher. #include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/ui/text/TestRunner.h> /*! * \brief Runs the test cases. */ int main(int argc,char** argv) { CppUnit::TextUi::TestRunner runner; ...
```c++ //Copyright (c) 2015 Ultimaker B.V. //UltiScanTastic is released under the terms of the AGPLv3 or higher. #include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/ui/text/TestRunner.h> /*! * \brief Runs the test cases. */ int main(int argc,char** argv) { CppUnit::TextUi::TestRunner runner; ...
793cbdd7-0597-483a-b686-a3b7212881d5
{ "language": "C++" }
```c++ #include <bits/stdc++.h> #define NUM_NODES 8 using namespace std; vector < int > g[NUM_NODES]; int vis[NUM_NODES]; enum {WHITE, GRAY, BLACK}; /* * o -> origin */ void dfs(int o){ vis [o] = GRAY; //semi-visited for (int i = 0; i < g[o].size(); i++){ int v = g[o][i]; if (vis[v] == WHIT...
```c++ #include <bits/stdc++.h> #define NUM_NODES 20 using namespace std; vector < int > g[NUM_NODES]; int vis[NUM_NODES]; enum {WHITE, GRAY, BLACK}; /* * o -> origin */ void dfs(int o){ vis [o] = GRAY; //semi-visited for (int i = 0; i < g[o].size(); i++){ int v = g[o][i]; if (vis[v] == GRA...
a7fe8735-66f7-4708-869f-5dfca89a4068
{ "language": "C++" }
```c++ #include <iostream> #include <cassert> #include <cmath> using namespace std; int main ( int argc, char *argv[] ) { assert ( argc == 2 ); unsigned long maxnumber = atol(argv[1]); // Create the sieve end initialize all numbers as prime (true) bool *numbers = new bool[maxnumber+1]; for ( unsi...
```c++ #include <iostream> #include <cassert> #include <cmath> using namespace std; int main ( int argc, char *argv[] ) { unsigned long maxnumber = 0; if ( 2 == argc ) maxnumber = atol(argv[1]); else { cout << "Enter the highest number to test: "; cin >> maxnumber; } ...
6eadc840-da4f-45ed-9f2f-d8f50bc9f3e2
{ "language": "C++" }
```c++ #include "MyOpenCVIF.hpp" MyOpenCVIF::MyOpenCVIF() : m_FPSCounter(), m_humanDetector("/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml") { } void MyOpenCVIF::ProcessFrame(Mat& frame) { m_FPSCounter.ProcessFrame(frame); m_systemMonitor.ProcessFrame(frame); m_humanDetector.Proce...
```c++ #include "MyOpenCVIF.hpp" MyOpenCVIF::MyOpenCVIF() : m_FPSCounter(), m_humanDetector("/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml") { } void MyOpenCVIF::ProcessFrame(Mat& frame) { m_FPSCounter.ProcessFrame(frame); //m_systemMonitor.ProcessFrame(frame); //m_humanDetector.P...
e4575133-a3c0-41ba-a8ca-ca3c1c409013
{ "language": "C++" }
```c++ #include "Pool.h" #include <iostream> #include <math.h> const float Pool::BALL_RADIUS = 0.5/40; void Pool::setWhiteBall(Vec2 whiteBall) { this->whiteBall = whiteBall; } void Pool::setTargetBall(Vec2 targetBall) { this->targetBall = targetBall; } void Pool::setPocket(Vec2 pocket) { this->pocket = p...
```c++ #include "Pool.h" #include <iostream> #include <math.h> const float Pool::BALL_RADIUS = 0.5/40; void Pool::setWhiteBall(Vec2 whiteBall) { this->whiteBall = whiteBall; } void Pool::setTargetBall(Vec2 targetBall) { this->targetBall = targetBall; } void Pool::setPocket(Vec2 pocket) { this->pocket = p...
3c52c438-d654-43c7-a2d1-494777ac9dc4
{ "language": "C++" }
```c++ /** * Coverity Scan model * * Manage false positives by giving coverity some hints. * * Updates to this file must be manually submitted by an admin to: * * https://scan.coverity.com/projects/1222 * */ // When tag is 1 or 2, let coverity know that execution is halting. Those // tags correspond to INT_...
```c++ /** * Coverity Scan model * * Manage false positives by giving coverity some hints. * * Updates to this file must be manually submitted by an admin to: * * https://scan.coverity.com/projects/1222 * */ // When tag is 1 or 2, let coverity know that execution is halting. Those // tags correspond to INT_...
6fda34c2-c37c-4f48-ba28-686c8c1c018e
{ "language": "C++" }
```c++ /***************************************************************************** * Licensed to Qualys, Inc. (QUALYS) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * QUALYS licenses this file to You...
```c++ /***************************************************************************** * Licensed to Qualys, Inc. (QUALYS) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * QUALYS licenses this file to You...
2da536cd-e968-4156-b863-bf6510d4de41
{ "language": "C++" }
```c++ #include <gtest/gtest.h> int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } ``` Add a trivial init test
```c++ #include <gtest/gtest.h> #if defined (WIN32) #include <windows.h> #include <tchar.h> #else #include <string.h> #endif #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include "codec_def.h" #include "codec_app_def.h" #include "codec_api.h" class CodecTest : public ::testing::Test { public: CodecTe...
c12c4f97-a0fe-483a-a56c-369aa92dc36c
{ "language": "C++" }
```c++ #include "common/application_info.h" #include "base/file_version_info.h" #include "base/memory/scoped_ptr.h" #include "base/utf_string_conversions.h" namespace brightray { std::string GetApplicationName() { auto info = make_scoped_ptr(FileVersionInfo::CreateFileVersionInfoForModule(GetModuleHandle(nullptr))...
```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 info = make_scoped_ptr(FileVersionInfo::CreateFileVersionInfoForModule(GetModuleHandle(n...
7f6ae6b6-72f2-4617-ae39-47cfd97e7fe9
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -Wold-style-cast %s void test1() { long x = (long)12; // expected-warning {{use of old-style cast}} (long)x; // expected-warning {{use of old-style cast}} expected-warning {{expression result unused}} (void**)x; // expected-warning {{use of old-style cast}} expecte...
```c++ // RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -verify -Wold-style-cast %s void test1() { long x = (long)12; // expected-warning {{use of old-style cast}} (long)x; // expected-warning {{use of old-style cast}} expected-warning {{expression result unused}} (void**)x; // expected-warning {{use...
fc80ca64-e726-4df4-b4f3-ad4bdfb1c8b7
{ "language": "C++" }
```c++ #include "aboutdialog.h" #include "qt/decoration.h" #include "ui_aboutdialog.h" #include "clientmodel.h" AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) { ui->setupUi(this); ui->copyrightLabel->setText("Copyright 2009-2021 The Bitcoin/Peercoin/Black-Coin/Grid...
```c++ #include "aboutdialog.h" #include "qt/decoration.h" #include "ui_aboutdialog.h" #include "clientmodel.h" AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) { ui->setupUi(this); ui->copyrightLabel->setText("Copyright 2009-2022 The Bitcoin/Peercoin/Black-Coin/Grid...
1cabe9a8-ccd5-41ef-ae71-7291cf96efc6
{ "language": "C++" }
```c++ // RUN: %clangxx_msan -O0 %s -o %t && %run %t #include <assert.h> #include <execinfo.h> #include <stdio.h> #include <string.h> #include <stdlib.h> __attribute__((noinline)) void f() { void *buf[10]; int sz = backtrace(buf, sizeof(buf) / sizeof(*buf)); assert(sz > 0); for (int i = 0; i < sz; ++i) if...
```c++ // RUN: %clangxx_msan -O0 %s -o %t && %run %t #include <assert.h> #include <execinfo.h> #include <stdio.h> #include <string.h> #include <stdlib.h> __attribute__((noinline)) void f() { void *buf[10]; int sz = backtrace(buf, sizeof(buf) / sizeof(*buf)); assert(sz > 0); for (int i = 0; i < sz; ++i) if...
163abba9-9fc2-44ca-aa95-b2ac0bcd92e1
{ "language": "C++" }
```c++ #include "ros/ros.h" #include "servo_msgs/KrsServoDegree.h" #include <string> #include "krs_servo_driver.hpp" class KrsServoNode { public: KrsServoNode(); explicit KrsServoNode(ros::NodeHandle& nh, const char* path); private: void krsServoDegreeCallback(const servo_msgs::KrsServoDegree::ConstPtr& msg);...
```c++ #include "ros/ros.h" #include "servo_msgs/KrsServoDegree.h" #include <string> #include "krs_servo_driver.hpp" class KrsServoNode { public: KrsServoNode(); explicit KrsServoNode(ros::NodeHandle& nh, const char* path); private: void krsServoDegreeCallback(const servo_msgs::KrsServoDegree::ConstPtr& msg);...
f7030312-9b66-4fa2-83cb-92a9084650c8
{ "language": "C++" }
```c++ #include <stan/math/rev.hpp> #include <gtest/gtest.h> #include <vector> TEST(ProbDistributionsNegBinomial2, derivatives_lccdf) { using stan::math::neg_binomial_2_lccdf; using stan::math::var; std::vector<double> N{1, 2, 3}; double alpha_dbl = 8; double beta_dbl = 1.5; var alpha(alpha_dbl); var b...
```c++ #include <stan/math/rev.hpp> #include <gtest/gtest.h> #include <vector> TEST(ProbDistributionsNegBinomial2, derivatives_lccdf) { using stan::math::neg_binomial_2_lccdf; using stan::math::var; std::vector<double> N{1, 2, 3}; double alpha_dbl = 8; double beta_dbl = 1.5; var alpha(alpha_dbl); var b...
f75a5735-a2b3-45c1-802f-d63ef4f6460e
{ "language": "C++" }
```c++ #include <OSGBaseInitFunctions.h> #include <OSGNode.h> #include <OSGNodeCore.h> //#include <OSGRefPtr.h> int main (int argc, char **argv) { OSG::osgInit(argc, argv); // Test getting pointers OSG::NodeRecPtr node_ptr = OSG::Node::create(); #ifdef OSG_MT_FIELDCONTAINERPTRX OSG::Node* node_cptr...
```c++ #include <OSGBaseInitFunctions.h> #include <OSGNode.h> #include <OSGNodeCore.h> //#include <OSGRefPtr.h> int main (int argc, char **argv) { OSG::osgInit(argc, argv); // Test getting pointers OSG::NodeRecPtr node_ptr = OSG::Node::create(); #ifdef OSG_MT_FIELDCONTAINERPTRX OSG::Node* node_cptr...
5f154eae-6576-4fe8-87e1-8e8ddbc4dd65
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-output=text -verify %s struct S { int *x; int y; }; S &getSomeReference(); void test(S *p) { S &r = *p; //expected-note {{'r' initialized here}} if (p) return; //expected-note@-1{{Taking false branch}} //expect...
```c++ // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-output=text -verify %s struct S { int *x; int y; }; S &getSomeReference(); void test(S *p) { S &r = *p; //expected-note {{'r' initialized here}} if (p) return; //expected-note@-1{{Taking false branch}} //expect...
d8ae920a-2df2-4973-8dc8-d1f10a989d66
{ "language": "C++" }
```c++ #include "one_to_one_test.h" using namespace std; OneToOneTest::OneToOneTest() {} TestError OneToOneTest::setUp() { auto & im = InstanceManager::getInstance(); im.startMs(); left = im.nextNonColidingApp(); right = im.nextNonColidingApp(); left->run(); right->run(); std::this_thr...
```c++ #include "one_to_one_test.h" using namespace std; OneToOneTest::OneToOneTest() {} TestError OneToOneTest::setUp() { auto & im = InstanceManager::getInstance(); im.startMs(); left = im.nextNonColidingApp(); right = im.nextNonColidingApp(); left->run(); right->run(); std::this_thr...
8ea5ccf8-42c3-4564-a3d5-9d7105a13556
{ "language": "C++" }
```c++ #define BOOST_TEST_MODULE Gridcoin Test Suite #include <boost/test/unit_test.hpp> #include "db.h" #include "main.h" #include "wallet.h" CWallet* pwalletMain; CClientUIInterface uiInterface; extern bool fPrintToConsole; extern void noui_connect(); struct TestingSetup { TestingSetup() { fPrintToDeb...
```c++ #define BOOST_TEST_MODULE Gridcoin Test Suite #include <boost/test/unit_test.hpp> #include "db.h" #include "main.h" #include "wallet.h" CWallet* pwalletMain; CClientUIInterface uiInterface; extern bool fPrintToConsole; extern void noui_connect(); struct TestingSetup { TestingSetup() { fPrintToDeb...
4b218b8e-d474-4dc2-985a-cc020eb8ed6e
{ "language": "C++" }
```c++ #include "projet.h" #include <QtDebug> #include <QProcess> Projet::Projet(QString &name, QDir &workspace, QFile &video, int frequence) { if(workspace.exists()) { if(video.exists()) { if(workspace.mkdir(name)) { _project = new QDir(workspace.path()+...
```c++ #include "projet.h" #include <QtDebug> #include <QProcess> Projet::Projet(QString &name, QDir &workspace, QFile &video, int frequence) { if(workspace.exists()) { if(video.exists()) { if(workspace.mkdir(name)) { _project = new QDir(workspace.path()+...
d2076202-1307-4778-ae00-839249991826
{ "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 "content/browser/renderer_host/render_view_host_observer.h" #include "content/browser/renderer_host/render_view_host.h" RenderViewHo...
```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 "content/browser/renderer_host/render_view_host_observer.h" #include "content/browser/renderer_host/render_view_host.h" RenderViewHo...
5392dc6c-0218-43b2-8673-95bbfbdfd39c
{ "language": "C++" }
```c++ #include "read_private.h" int buffered_io::init() { int ret; for (int i = 0; i < num; i++) { fds[i] = open(file_names[i], flags); if (fds[i] < 0) { perror("open"); exit (1); } ret = posix_fadvise(fds[i], 0, 0, POSIX_FADV_RANDOM); if (ret < 0) { perror("posix_fadvise"); exit(1); } } ...
```c++ #include "read_private.h" int buffered_io::init() { int ret; for (int i = 0; i < num; i++) { fds[i] = open(file_names[i], flags); if (fds[i] < 0) { perror("open"); exit (1); } ret = posix_fadvise(fds[i], 0, 0, POSIX_FADV_RANDOM); if (ret < 0) { perror("posix_fadvise"); exit(1); } } ...
782f16be-695c-4396-a910-6157ce1cac15
{ "language": "C++" }
```c++ // RUN: %llvmgxx %s -S -o - | grep '%XX = global int 4' struct S { int A[2]; }; int XX = (int)&(((struct S*)0)->A[1]); ``` Adjust this test to pass after recent CFE changes. We now generate:
```c++ // RUN: %llvmgxx %s -S -o - | not grep 'llvm.global_ctor' struct S { int A[2]; }; int XX = (int)&(((struct S*)0)->A[1]); ```
a8e78663-0278-41f7-8103-3765a3f8d394
{ "language": "C++" }
```c++ #include "../Physics/Shape.hpp" #include "../Util/Json.hpp" #include "Shape.hpp" namespace Component { Json::Value Shape::Save() const { Json::Value component; Json::Value concreteShape; switch (shape->GetKind()) { case ::Physics::Shape::Kind::Sphere: { a...
```c++ #include <Utility/Log.hpp> #include "../Physics/Shape.hpp" #include "../Util/Json.hpp" #include "Shape.hpp" namespace Component { Json::Value Shape::Save() const { Json::Value component; Json::Value concreteShape; switch (shape->GetKind()) { case Physics::Shape::Kind::Sp...
f43928ff-b78d-4178-b0c7-e33c8bb01be1
{ "language": "C++" }
```c++ #include "./coordinate_system_node.h" #include <Eigen/Core> CoordinateSystemNode::CoordinateSystemNode() { persistable = false; x = std::make_shared<Graphics::Connector>(Eigen::Vector3f(0, 0, 0), Eigen::Vector3f(1, 0, 0)); x->color = Eigen::Vector4f(1, 0, 0, 1)...
```c++ #include "./coordinate_system_node.h" #include <Eigen/Core> CoordinateSystemNode::CoordinateSystemNode() { persistable = false; x = std::make_shared<Graphics::Connector>(Eigen::Vector3f(0, 0, 0), Eigen::Vector3f(1, 0, 0)); x->color = Eigen::Vector4f(1, 0, 0, 1)...
087cff26-3b40-4cad-9b31-0d5a18155e9a
{ "language": "C++" }
```c++ /* Name: Velvet Author: Alvy Piper (no contact email currently) CSGO adaptation: aixxe <aixxe@skyenet.org> Copyright: 2015 Usage: More complex than GreenTea and also SDKless. A simple internal cheat with bunnyhop and norecoil, written for CSPromod BETA 1.10b for fun. Using content created by: Casual_Hacker ( ht...
```c++ /* Name: Velvet Author: Alvy Piper (no contact email currently) CSGO adaptation: aixxe <aixxe@skyenet.org> Copyright: 2015 Usage: More complex than GreenTea and also SDKless. A simple internal cheat with bunnyhop and norecoil, written for CSPromod BETA 1.10b for fun. Using content created by: Casual_Hacker ( ht...
3c1980fc-469c-4cf1-bed5-d47ab8ef2d71
{ "language": "C++" }
```c++ //---------------------------- parameter_handler_1.cc --------------------------- // $Id$ // Version: $Name$ // // Copyright (C) 2002, 2003 by the deal.II authors and Anna Schneebeli // // This file is subject to QPL and may not be distributed // without copyright and license information. Pleas...
```c++ //---------------------------- parameter_handler_1.cc --------------------------- // $Id$ // Version: $Name$ // // Copyright (C) 2002, 2003 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer // to the...
c4bbac82-35f1-4c7d-987a-154451273f09
{ "language": "C++" }
```c++ /* * Copyright (c) 2012 Stanford University * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AU...
```c++ /* * Copyright (c) 2012 Stanford University * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AU...
f93643fb-9e1b-42e3-9908-da11878f9769
{ "language": "C++" }
```c++ /******************************************************************************\ * This example illustrates how to use aout. * \ ******************************************************************************/ #include <chrono> #include <cstdlib> #include <iostream> #include "ca...
```c++ /******************************************************************************\ * This example illustrates how to use aout. * \ ******************************************************************************/ #include <random> #include <chrono> #include <cstdlib> #include <iost...
19ad42fd-1432-423a-ba23-2ce08916de1b
{ "language": "C++" }
```c++ // RxUN: %clang_cc1 -ast-dump %s | FileCheck %s // RUN: %clang_cc1 -ast-dump %s > /dev/null template <int X, typename Y, int Z = 5> struct foo { int constant; foo() {} Y getSum() { return Y(X + Z); } }; template <int A, typename B> B bar() { return B(A); } void baz() { int x = bar<5, int>(); int y...
```c++ // RUN: %clang_cc1 -ast-dump %s > %t // RUN: FileCheck < %t %s -check-prefix=CHECK1 // RUN: FileCheck < %t %s -check-prefix=CHECK2 template <int X, typename Y, int Z = 5> struct foo { int constant; foo() {} Y getSum() { return Y(X + Z); } }; template <int A, typename B> B bar() { return B(A); } void b...
12bb0b8d-c2aa-403f-86d2-f01959a825d1
{ "language": "C++" }
```c++ #include <map> #include <kms++util/cpuframebuffer.h> using namespace std; namespace kms { CPUFramebuffer::CPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format) : m_width(width), m_height(height), m_format(format) { const PixelFormatInfo& format_info = get_pixel_format_info(m_format); m_num_...
```c++ #include <map> #include <kms++util/cpuframebuffer.h> using namespace std; namespace kms { CPUFramebuffer::CPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format) : m_width(width), m_height(height), m_format(format) { const PixelFormatInfo& format_info = get_pixel_format_info(m_format); m_num_...
4dc1308e-81f1-4153-949f-db5ac25dcc97
{ "language": "C++" }
```c++ #define TEST_INSITU #define TEST_PARSE_FLAG kParseInsituFlag #define TEST_NAME "RapidJSON_Insitu (C++)" #define TEST_CLASS RapidjsonInsituTest #include "rapidjsontest.cpp" ``` Fix RapidJSON Insitu Test on Windows
```c++ #define TEST_INSITU #define TEST_PARSE_FLAG kParseInsituFlag #define TEST_NAME "RapidJSON_Insitu (C++)" #define TEST_CLASS RapidjsonInsituTest #define RapidjsonParseResult RapidjsonParseInsituResult #include "rapidjsontest.cpp" ```
9655c04c-08a7-432a-a9df-b6446fb6eccc
{ "language": "C++" }
```c++ // Copyright (c) 2013 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/base/ui_base_switches_util.h" #include "base/command_line.h" #include "ui/base/ui_base_switches.h" namespace switches { bool Is...
```c++ // Copyright (c) 2013 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/base/ui_base_switches_util.h" #include "base/command_line.h" #include "ui/base/ui_base_switches.h" namespace switches { bool Is...
633e5b54-1b03-49a4-b03d-486048fc77c7
{ "language": "C++" }
```c++ // // positions.cc // GameEngine // // Created by Jon Sharkey on 2013-02-19. // Copyright 2013 Sharkable. All rights reserved. // #include "gameengine/positions.h" #include "thirdparty/tinyxml2/tinyxml2.h" #include "gameengine/asset_reader.h" double str2double(const char *str) { char *end_ptr; double...
```c++ // // positions.cc // GameEngine // // Created by Jon Sharkey on 2013-02-19. // Copyright 2013 Sharkable. All rights reserved. // #include "gameengine/positions.h" #include "gameengine/asset_reader.h" #include "gameengine/thirdparty/tinyxml2/tinyxml2.h" void Positions::LoadFile(AssetReader &asset_reader) ...
6e52ab68-faef-4d3b-a192-13b49d4868b4
{ "language": "C++" }
```c++ #pragma GCC diagnostic ignored "-Wdeprecated" #include "remoteclient.hpp" #include "core/messages/client/clientmsg.hpp" #include "core/messages/server/servermsg.hpp" #include "core/serveriface.hpp" namespace { struct ClientLauncher { void operator()(RemoteClient* c) { c->run(); } }; } Remote...
```c++ #pragma GCC diagnostic ignored "-Wdeprecated" #include "remoteclient.hpp" #include "core/messages/client/clientmsg.hpp" #include "core/messages/server/servermsg.hpp" #include "core/serveriface.hpp" namespace { struct ClientLauncher { void operator()(RemoteClient* c) { c->run(); } }; } Remote...
cc6f6292-ae56-4f4c-bdbf-6ad39b2c57f4
{ "language": "C++" }
```c++ // RUN: %clang_cc1 %s -emit-llvm -o - // https://bugs.llvm.org/show_bug.cgi?id=38356 // We only check that we do not crash. template <typename a, a b(unsigned), int c, unsigned...> struct d : d<a, b, c - 1> {}; template <typename a, a b(unsigned), unsigned... e> struct d<a, b, 0, e...> { a f[0]; }; struct g ...
```c++ // RUN: %clang_cc1 %s -emit-llvm-only -o - // https://bugs.llvm.org/show_bug.cgi?id=38356 // We only check that we do not crash. template <typename a, a b(unsigned), int c, unsigned...> struct d : d<a, b, c - 1> {}; template <typename a, a b(unsigned), unsigned... e> struct d<a, b, 0, e...> { a f[0]; }; stru...
9da4acdc-eddc-4f03-a628-cc5d7b4121f7
{ "language": "C++" }
```c++ /** \file * File for the string fonts. * * @author Nathan Samson */ #include <sstream> #include "resources/stringfontresource.h" #include "resources/fontresource.h" namespace Zabbr { /** * Constructor. * * @param surface The surface. * @param id The ID of the string fonts. */ StringFontResource...
```c++ /** \file * File for the string fonts. * * @author Nathan Samson */ #include <sstream> #include "resources/stringfontresource.h" #include "resources/fontresource.h" namespace Zabbr { /** * Constructor. * * @param surface The surface. * @param id The ID of the string fonts. */ StringFontResource...
1ca42a39-19a4-4fd2-899e-cfb14921c424
{ "language": "C++" }
```c++ //===--- CallInliner.cpp - Transfer function that inlines callee ----------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===--- CallInliner.cpp - Transfer function that inlines callee ----------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
bb9f3044-aa1e-4688-a9eb-c993b140cc75
{ "language": "C++" }
```c++ //===-- StringSaver.cpp ---------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===-- StringSaver.cpp ---------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
8c526841-3887-495e-a9d1-08827d50ed1a
{ "language": "C++" }
```c++ #include "Arduino.h" #include "Game.h" Game::Game() { } void Game::init() { restart(1); } int Game::p1Score() { return _p1Score; } int Game::p2Score() { return _p2Score; } int Game::server() { return _server; } bool Game::over() { return (_p1Score >= 11 || _p2Score >= 11) && abs(_p1Score - _p2Score) >=...
```c++ #include "Arduino.h" #include "Game.h" Game::Game() { } void Game::init() { restart(1); } int Game::p1Score() { return _p1Score; } int Game::p2Score() { return _p2Score; } int Game::server() { return _server; } bool Game::over() { return (_p1Score >= 11 || _p2Score >= 11) && abs(_p1Score - _p2Score) >=...
d2a0694d-02e2-42e2-90fd-80e3cf610c30
{ "language": "C++" }
```c++ #include <iostream> #include <boost/array.hpp> #include <boost/asio.hpp> #include "common/CLOpts.h" #include "common/config.h" #include "common/file_operations.h" #include "common/packets.h" // Shorten the crazy long namespacing to asio tcp using boost::asio::ip::tcp; int main(int argc, char **argv) { // P...
```c++ #include <iostream> #include <boost/asio.hpp> #include "client/Client.h" #include "common/CLOpts.h" #include "common/config.h" // Shorten the crazy long namespacing to asio tcp using boost::asio::ip::tcp; int main(int argc, char **argv) { // Parse out command line options sc2tm::CLOpts opts; if (!opt...
657ac4f9-d0a2-464f-a175-3719e17678dc
{ "language": "C++" }
```c++ // Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "descriptors.h" #include <atomic> using namespace leap; descriptor_entry::descriptor_entry(const std::type_info& ti, const descriptor& (*pfnDesc)()) : Next(descriptors::Link(*this)), ti(ti), pfnDesc(pfnDesc) {}...
```c++ // Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "descriptors.h" #include <atomic> using namespace leap; descriptor_entry::descriptor_entry(const std::type_info& ti, const descriptor& (*pfnDesc)()) : Next(descriptors::Link(*this)), ti(ti), pfnDesc(pfnDesc) {}...
5d90c00d-a959-4d88-8df8-cb8b32ae12c6
{ "language": "C++" }
```c++ /* utils.cc Louis Solofrizzo 2019-10-17 Utilities for pistache */ #include <pistache/peer.h> #include <unistd.h> ssize_t SSL_sendfile(SSL *out, int in, off_t *offset, size_t count) { unsigned char buffer[4096] = { 0 }; ssize_t ret; ssize_t written; size_t ...
```c++ /* utils.cc Louis Solofrizzo 2019-10-17 Utilities for pistache */ #include <pistache/peer.h> #include <unistd.h> #ifdef PISTACHE_USE_SSL ssize_t SSL_sendfile(SSL *out, int in, off_t *offset, size_t count) { unsigned char buffer[4096] = { 0 }; ssize_t ret; ssize_t ...
45e1b871-016a-4c0a-81a9-4ea18d5c98de
{ "language": "C++" }
```c++ // For conditions of distribution and use, see copyright notice in license.txt #if SKYX_ENABLED #include "EC_SkyX.h" #endif #if HYDRAX_ENABLED #include "EC_Hydrax.h" #endif #include "Framework.h" #include "SceneAPI.h" #include "IComponentFactory.h" extern "C" { DLLEXPORT void TundraPluginMain(Framework *fw) {...
```c++ // For conditions of distribution and use, see copyright notice in license.txt #if SKYX_ENABLED #include "EC_SkyX.h" #endif #if HYDRAX_ENABLED #include "EC_Hydrax.h" #endif #include "Framework.h" #include "SceneAPI.h" #include "IComponentFactory.h" ///\todo HydraxConfigFile support //#include "AssetAPI.h" //#in...
5a496f54-6daa-4bd2-acae-ac95b8702d2c
{ "language": "C++" }
```c++ #include "env.hpp" #include "java_classes.hpp" #include <atomic> #include <fmo/benchmark.hpp> #include <thread> namespace { struct { Reference<Callback> callbackRef; JavaVM* javaVM; JNIEnv* threadEnv; std::atomic<bool> stop; } global; } void Java_cz_fmo_Lib_benchmarkingS...
```c++ #include "env.hpp" #include "java_classes.hpp" #include <atomic> #include <fmo/benchmark.hpp> #include <thread> namespace { struct { Reference<Callback> callbackRef; JavaVM* javaVM; JNIEnv* threadEnv; std::atomic<bool> stop; } global; } void Java_cz_fmo_Lib_benchmarkingS...
d82e79f7-c498-460a-a492-0316538763ba
{ "language": "C++" }
```c++ // Tests for instrumentation of C++ constructors and destructors. // // RUN: %clang_cc1 -triple x86_64-apple-macosx10.11.0 -x c++ %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck %s struct Foo { Foo() {} Foo(int) {} ~Foo() {} }; struct Bar : public Foo { Bar() {} Bar(int x) : Foo(x) {} ~Ba...
```c++ // Tests for instrumentation of C++ constructors and destructors. // // RUN: %clang_cc1 -triple x86_64-apple-macosx10.11.0 -x c++ %s -o %t -emit-llvm -fprofile-instrument=clang // RUN: FileCheck %s -input-file=%t -check-prefix=INSTR // RUN: FileCheck %s -input-file=%t -check-prefix=NOINSTR struct Foo { Foo() ...
d0545e15-f95a-41f4-9eaf-ca19853bb862
{ "language": "C++" }
```c++ // RUN: %clangxx -O0 -g %s -o %t -lcrypt && %run %t // crypt() is missing from Android and -lcrypt from darwin. // UNSUPPORTED: android, darwin #include <assert.h> #include <unistd.h> #include <cstring> int main (int argc, char** argv) { { char *p = crypt("abcdef", "xz"); volatile size_t z = strlen(...
```c++ // RUN: %clangxx -O0 -g %s -o %t -lcrypt && %run %t // crypt() is missing from Android and -lcrypt from darwin. // UNSUPPORTED: android, darwin #include <assert.h> #include <unistd.h> #include <cstring> #include <crypt.h> int main (int argc, char** argv) { { char *p = crypt("abcdef", "xz"); volatile...
08e1703a-1524-4409-8905-6519c84c1cfa
{ "language": "C++" }
```c++ #include <test/unit/math/test_ad.hpp> #include <limits> TEST(mathMixScalFun, std_normal_cdf_derivatives) { auto f = [](const auto& y) { return stan::math::std_normal_cdf(y); }; stan::test::expect_ad(f, -50.0); // stan::test::expect_ad(f, -20.0 * stan::math::SQRT_TWO); // stan::test::expect_ad(f, -10.0)...
```c++ #include <test/unit/math/test_ad.hpp> #include <limits> TEST(mathMixScalFun, std_normal_cdf_derivatives) { auto f = [](const auto& y) { return stan::math::std_normal_cdf(y); }; stan::test::expect_ad(f, -50.0); // the following fails because AD returns -nan in the Hessian // stan::test::expect_ad(f, -20...
c0390aca-7bca-4f30-9680-30809d6f0e96
{ "language": "C++" }
```c++ // Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #include "Slider.h" void Slider::Buddy(Control *buddy, bool bottomOrRight) { _buddyWnd = buddy->Handle(); SendMessage(_hWnd, TBM_SETBUDDY, (WPARAM) bottomOrRight ? FALSE : TRUE, ...
```c++ // Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #include "Slider.h" void Slider::Buddy(Control *buddy, bool bottomOrRight) { _buddyWnd = buddy->Handle(); SendMessage(_hWnd, TBM_SETBUDDY, (WPARAM) bottomOrRight ? FALSE : TRUE, ...
40f54106-f43b-4be2-b0b2-6af6e320816a
{ "language": "C++" }
```c++ #include "qlazerdriveplayer.h" QLazerDrivePlayer::QLazerDrivePlayer(const uint &id, const QString &name, const uint &r, const uint &g, const uint &b, const uint &score) { m_id = id; m_name = name; m_r = r; m_g = g; m_b = b; m_score = score; } uint QLazerDrivePlayer::r() const { retu...
```c++ #include "qlazerdriveplayer.h" QLazerDrivePlayer::QLazerDrivePlayer(const uint &id, const QString &name, const uint &r, const uint &g, const uint &b, const uint &score) { m_id = id; m_name = name; m_r = r; m_g = g; m_b = b; m_score = score; } uint QLazerDrivePlayer::id() const { ret...
3b464e03-7072-4a84-bd6d-b17a5925d35a
{ "language": "C++" }
```c++ #include "..\include\Game.h" // // TO-DO: // - add more enemies // - implement arena // - implement custom moves (e.g. specific moves to each class, custom Attack(); stuff) // - add advanced AI (when taking a risk attack and miss, heal) // - store and sell (buy with coins, sell arrows/bombs/etc for money or exp...
```c++ #include "..\include\Game.h" // // TO-DO: // - add more enemies // - implement arena // - implement custom moves (e.g. specific moves to each class, custom Attack(); stuff) // - add advanced AI (when taking a risk attack and miss, heal) // - store and sell (buy with coins, sell arrows/bombs/etc for money or exp...
173474d5-ab0d-42a1-97c2-79cf5501d2b5
{ "language": "C++" }
```c++ /* * qca_systemstore_flatfile.cpp - Qt Cryptographic Architecture * Copyright (C) 2004,2005 Justin Karneges * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * versi...
```c++ /* * qca_systemstore_flatfile.cpp - Qt Cryptographic Architecture * Copyright (C) 2004,2005 Justin Karneges * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * versi...
14d58f3b-1aeb-4738-a800-e4151b1e52cf
{ "language": "C++" }
```c++ //The injector source file for the Consume hook module. #include "consume.h" #include <hook_tools.h> namespace { void __declspec(naked) consumeHitWrapper() { CUnit *target, *caster; __asm { PUSHAD MOV caster, ESI MOV target, EAX } hooks::consumeHitHook(target, caster); __asm { ...
```c++ //The injector source file for the Consume hook module. #include "consume.h" #include <hook_tools.h> namespace { void __declspec(naked) consumeHitWrapper() { static CUnit *target, *caster; __asm { PUSHAD MOV caster, ESI MOV target, EAX } hooks::consumeHitHook(target, caster); __...
1bb57829-ebff-45bc-963c-18b4311fdf14
{ "language": "C++" }
```c++ // Copyright eeGeo Ltd (2012-2015), All Rights Reserved #include "WatermarkDataFactory.h" namespace ExampleApp { namespace Watermark { namespace View { WatermarkDataFactory::WatermarkDataFactory(const std::string& appName, ...
```c++ // Copyright eeGeo Ltd (2012-2015), All Rights Reserved #include "WatermarkDataFactory.h" namespace ExampleApp { namespace Watermark { namespace View { WatermarkDataFactory::WatermarkDataFactory(const std::string& appName, ...
6cf39f76-094d-4486-b250-113cb97efe0d
{ "language": "C++" }
```c++ // RUN: rm -rf %t // RUN: mkdir -p %t/Src // RUN: cp "%s" "%t/Src/test.cpp" // RUN: mkdir -p %t/Include // RUN: cp "%S/Inputs/fixed-header.h" "%t/Include/" // -I flag is relative to %t (where compile_flags is), not Src/. // RUN: echo '-IInclude/' >> %t/compile_flags.txt // RUN: echo "-Dklazz=class" >> %t/compile...
```c++ // RUN: rm -rf %t // RUN: mkdir -p %t/Src // RUN: cp "%s" "%t/Src/test.cpp" // RUN: mkdir -p %t/Include // RUN: cp "%S/Inputs/fixed-header.h" "%t/Include/" // -I flag is relative to %t (where compile_flags is), not Src/. // RUN: echo '-IInclude/' >> %t/compile_flags.txt // RUN: echo "-Dklazz=class" >> %t/compile...
a7014c1c-477d-4e78-92d5-61e427a2c54e
{ "language": "C++" }
```c++ /************************************************************************ * * Flood Project (2008-201x) * Licensed under the simplified BSD license. All rights reserved. * ************************************************************************/ #include "GameRuntime/API.h" #include "GameRuntime/Game.h" //---...
```c++ /************************************************************************ * * Flood Project (2008-201x) * Licensed under the simplified BSD license. All rights reserved. * ************************************************************************/ #include "GameRuntime/API.h" #include "GameRuntime/Game.h" //---...
88bac709-4993-4bcb-b195-a723347c6d99
{ "language": "C++" }
```c++ #include "character/classes/class.h" namespace d20 { bool Class::operator==(const Class &other) const { this->get_name() == other.get_name(); } float Class::bab_progression() const { throw("called bab_progression on class base!"); } std::string Class::get_name() const { throw("called get_name on cl...
```c++ #include "character/classes/class.h" namespace d20 { bool Class::operator==(const Class &other) const { return this->get_name() == other.get_name(); } float Class::bab_progression() const { throw("called bab_progression on class base!"); } std::string Class::get_name() const { throw("called get_nam...
7bef3ce6-9aed-4f2c-b9fd-3f46c1816897
{ "language": "C++" }
```c++ // Copyright 2010-2021, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of...
```c++ // Copyright 2010-2021, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of...
2be688c5-7032-4a1d-8abb-08595fb6f832
{ "language": "C++" }
```c++ //===- unittests/TimerTest.cpp - Timer tests ------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===- unittests/TimerTest.cpp - Timer tests ------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
0a352875-a4f5-4a6a-85d0-1b8049f182b6
{ "language": "C++" }
```c++ #include<math.h> bool isPrimeBruteForce(int x) { if (x < 2) return false; float sqroot_x = sqrt(x); for(int i=0; i <= sqroot_x; i++) { if (x%i==0) return false; } return true; } ``` Add comment to sqrt calculation
```c++ #include<math.h> bool isPrimeBruteForce(int x) { if (x < 2) return false; float 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. */ if (x%i==0) return false; } return true; } ```
cff98a11-df63-4ae9-bf42-de6ef8948506
{ "language": "C++" }
```c++ //===--- RewriteTest.cpp - Rewriter playground ----------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===--- RewriteTest.cpp - Rewriter playground ----------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
6fb24b14-162c-4e93-a16f-09b4efcd48b2
{ "language": "C++" }
```c++ #include "geometry/vertex.h" namespace aten { std::vector<int> VertexManager::s_indices; std::vector<vertex> VertexManager::s_vertices; GeomVertexBuffer VertexManager::s_vb; void VertexManager::build() { s_vb.init( sizeof(vertex), s_vertices.size(), 0, &s_vertices[0]); } } ``` Modify to in...
```c++ #include "geometry/vertex.h" namespace aten { std::vector<int> VertexManager::s_indices; std::vector<vertex> VertexManager::s_vertices; GeomVertexBuffer VertexManager::s_vb; void VertexManager::build() { if (!s_vertices.empty() && !s_vb.isInitialized()) { s_vb.init( sizeof(vertex), s_ver...
0c802810-4284-4d50-9161-b6a64856596f
{ "language": "C++" }
```c++ #include <TimerMessage.h> #include <QDebug> TimerMessage::TimerMessage(QObject *parent) : QObject(parent), m_pTimer(new QTimer(this)), m_counter(0) { connect(m_pTimer, SIGNAL(timeout()), this, SLOT(printCounter()) ); m_pTimer->setInterval(1000); m_pTimer->start(); } void TimerMessage::...
```c++ #include <TimerMessage.h> #include <QDebug> TimerMessage::TimerMessage(QObject *parent) : QObject(parent), m_pTimer(new QTimer(this)), m_counter(0) { connect(m_pTimer, SIGNAL(timeout()), this, SLOT(printCounter()) ); m_pTimer->setInterval(750); m_pTimer->start(); } void TimerMessage::p...
f3a040b6-fd23-4af4-8acc-1df1534f9373
{ "language": "C++" }
```c++ #include "../quick.hpp" #include "../swap.hpp" void quick(int *data, const int size_of_data) { return quick(data, 0, size_of_data - 1); } void quick(int *data, const int start, const int end) { int size = end - start + 1; if(start >= end) return; /* Base case */ /* Conquer */ int pivot = ...
```c++ #include "../quick.hpp" #include "../swap.hpp" void quick(int *data, const int size_of_data) { return quick(data, 0, size_of_data - 1); } void quick(int *data, const int start, const int end) { int size = end - start + 1; if(start >= end) return; /* Base case */ /* Conquer */ int pivot = ...
4501ca13-062e-49b0-86fe-7f3ef82ce582
{ "language": "C++" }
```c++ #include <iostream> #include <vector> using namespace std; int main() { int length, count = 0; cin >> length; vector<string> vector(length); for (int i = 0; i < length; i++) { cin >> vector[i]; } //sort logic cout << vector[0]; for (int i = 1; i < length; i++) ...
```c++ #include <iostream> #include <vector> using namespace std; class Card { private: string name_; int value_; public: Card(string card) { name_ = card; value_ = stoi(card.substr(1, 1)); }; string name(){return name_;}; int value(){return value_;}; }; void bubbleSort(...
8ba0bd45-a852-49fa-959f-c35970c304f9
{ "language": "C++" }
```c++ #include <Python.h> #include "Quantuccia/ql/time/calendars/unitedstates.hpp" ``` Add a stub function to init the module.
```c++ #include <Python.h> #include "Quantuccia/ql/time/calendars/unitedstates.hpp" PyObject* PyInit_pyQuantuccia(void){ return NULL; }```
37ad931c-7ae3-4f5a-948c-516ea514a37b
{ "language": "C++" }
```c++ #include <orz/types.h> #include "hw3d_opengl_common.h" namespace Hw3D { GLint GetGlInternalFormat(Format fmt) { return GL_RGBA; } GLenum GetGlFormat(Format) { return GL_RGBA; } GLenum GetGlDataType(Format) { return GL_UNSIGNED_BYTE; } ::std::string GetGlErrorString(GLenum error) { switch (...
```c++ #include <orz/types.h> #include "hw3d_opengl_common.h" namespace Hw3D { GLint GetGlInternalFormat(Format fmt) { return GL_RGBA; } GLenum GetGlFormat(Format) { return GL_BGRA; } GLenum GetGlDataType(Format) { return GL_UNSIGNED_BYTE; } ::std::string GetGlErrorString(GLenum error) { switch (...
7621cc61-7f8b-48a1-9c4a-f120c0409fff
{ "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/safe_browsing/safe_browsing_service.h" #include <stddef.h> #include "chrome/browser/safe_browsing/ui_manager.h" nam...
```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/safe_browsing/safe_browsing_service.h" #include <stddef.h> #include "chrome/browser/safe_browsing/ui_manager.h" nam...
bb8f4073-860f-4a95-86ab-a61f87c1f973
{ "language": "C++" }
```c++ #include <cppunit/BriefTestProgressListener.h> #include <cppunit/CompilerOutputter.h> #include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/TestResult.h> #include <cppunit/TestResultCollector.h> #include <cppunit/TestRunner.h> #include "Suite.h" #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 #define...
```c++ #include <cppunit/BriefTestProgressListener.h> #include <cppunit/CompilerOutputter.h> #include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/TestResult.h> #include <cppunit/TestResultCollector.h> #include <cppunit/TestRunner.h> #include "Suite.h" #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 #define...
a33a23e3-d42c-43d7-a064-afdf66c561b9
{ "language": "C++" }
```c++ #include "country_decl.hpp" string storage::CountryInfo::FileName2FullName(string fName) { size_t const i = fName.find('_'); if (i != string::npos) { // replace '_' with ", " fName[i] = ','; fName.insert(i+1, " "); } return fName; } void storage::CountryInfo::FullName2GroupAndMap(string ...
```c++ #include "country_decl.hpp" string storage::CountryInfo::FileName2FullName(string fName) { size_t const i = fName.find('_'); if (i != string::npos) { // replace '_' with ", " fName[i] = ','; fName.insert(i+1, " "); } return fName; } void storage::CountryInfo::FullName2GroupAndMap(string ...