doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
9c293b05-b0c3-48e7-9c5a-8386d7786516
{ "language": "C++" }
```c++ #include "util.h" #include <sstream> #include <vector> Header cpr::util::parseHeader(std::string headers) { Header header; std::vector<std::string> lines; std::istringstream stream(headers); { std::string line; while (std::getline(stream, line, '\n')) { lines.push_b...
```c++ #include "util.h" #include <sstream> #include <vector> Header cpr::util::parseHeader(std::string headers) { Header header; std::vector<std::string> lines; std::istringstream stream(headers); { std::string line; while (std::getline(stream, line, '\n')) { lines.push_b...
4dbad457-25a7-49a7-a092-bf1b87bea4d0
{ "language": "C++" }
```c++ #include "GUI.hpp" #if __APPLE__ #import <IOKit/pwr_mgt/IOPMLib.h> #elif _WIN32 #include <Windows.h> #pragma comment(lib, "user32.lib") #endif namespace Slic3r { namespace GUI { IOPMAssertionID assertionID; void disable_screensaver() { #if __APPLE__ CFStringRef reasonForActivity = CFSTR("Slic3r"); ...
```c++ #include "GUI.hpp" #if __APPLE__ #import <IOKit/pwr_mgt/IOPMLib.h> #elif _WIN32 #include <Windows.h> #pragma comment(lib, "user32.lib") #endif namespace Slic3r { namespace GUI { #if __APPLE__ IOPMAssertionID assertionID; #endif void disable_screensaver() { #if __APPLE__ CFStringRef reasonForActivity ...
b0b8813c-080e-430e-8235-e374a98f75c5
{ "language": "C++" }
```c++ #include <cstdlib> #include <iostream> using namespace std; int const n = 50; long long save[n + 1]; long long fibonanci(int n){ if (n <= 1) return 1; if (save[n]) return save[n]; return save[n] = fibonanci(n - 2) + fibonanci(n - 1); } /* // CAUTION: This code will take too much time int fibonanci...
```c++ #include <cstdlib> #include <iostream> using namespace std; int const n = 50; long long save[n + 1]; long long fibonanci_dp(int n){ if (n <= 0) return 0; if (n <= 2) return 1; if (save[n]) return save[n]; return save[n] = fibonanci_dp(n - 2) + fibonanci_dp(n - 1); } /* // CAUTION: This code will ta...
431a0f48-9b20-4dfd-bd95-3d59156e410a
{ "language": "C++" }
```c++ #include "compress.hpp" #include "decompress.hpp" #include<iostream> #include<fstream> void printUsage() { std::cout << "Give option\n"; } const std::string COMPRESS_COMMAND = "c"; const std::string DECOMPRESS_COMMAND = "d"; int main(int argc, char** argv) { if(argc < 2) { printUsage(); return 1; } ...
```c++ #include "compress.hpp" #include "decompress.hpp" #include<iostream> #include<fstream> void printUsage() { std::cout << "Give option\n"; } const std::string COMPRESS_COMMAND = "c"; const std::string DECOMPRESS_COMMAND = "d"; const std::string ARCHIVE_COMMAND = "a"; const std::string EXTRACT_COMMAND = "x"; i...
583fd8aa-7cd3-4f35-a4b4-4ee8c6136c22
{ "language": "C++" }
```c++ // Copyright (C) 2016 Elviss Strazdins // This file is part of the Ouzel engine. #include "WindowAndroid.h" namespace ouzel { WindowAndroid::WindowAndroid(const Size2& pSize, bool pResizable, bool pFullscreen, uint32_t pSampleCount, const std::string& pTitle): Window(pSize, pResizable, pFullscreen,...
```c++ // Copyright (C) 2016 Elviss Strazdins // This file is part of the Ouzel engine. #include "WindowAndroid.h" #include "Engine.h" #include "opengl/RendererOGL.h" namespace ouzel { WindowAndroid::WindowAndroid(const Size2& pSize, bool pResizable, bool pFullscreen, uint32_t pSampleCount, const std::string& pTi...
aa550de4-b41c-4e9a-8d4a-7b5ba7814645
{ "language": "C++" }
```c++ /* This file is part of python_mapnik (c++/python mapping toolkit) * Copyright (C) 2005 Artem Pavlenko, Jean-Francois Doyon * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version...
```c++ /* This file is part of python_mapnik (c++/python mapping toolkit) * Copyright (C) 2005 Artem Pavlenko, Jean-Francois Doyon * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version...
1f2dfaf4-4b51-4bbe-b71b-f6c34c90a9c2
{ "language": "C++" }
```c++ #include "mainwindow.h" #include <QApplication> #include <QStyleFactory> // TODO int main(int argc, char *argv[]) { using namespace HedgeEdit; QApplication a(argc, argv); QApplication::setStyle(QStyleFactory::create("WindowsVista")); UI::MainWindow w; w.show(); return a.exec(); } ``` ...
```c++ #include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { using namespace HedgeEdit; QApplication a(argc, argv); UI::MainWindow w; w.show(); return a.exec(); } ```
c44520f4-a28e-44c9-aadb-bade90c862b2
{ "language": "C++" }
```c++ #include "CalculatorBase.h" #include <algorithm> #include <numeric> #include "common.h" namespace tilegen { namespace alpha { CalculatorBase::CalculatorBase(): mAlphas((int)CORNERS) { zeroAlphas(); } void CalculatorBase::zeroAlphas() { for (auto& alpha : mAlphas) alpha = 0; } sf::Uint8 & ...
```c++ #include "CalculatorBase.h" #include <algorithm> #include <cmath> #include "common.h" namespace tilegen { namespace alpha { CalculatorBase::CalculatorBase(): mAlphas((int)CORNERS) { zeroAlphas(); } void CalculatorBase::zeroAlphas() { for (auto& alpha : mAlphas) alpha = 0; } sf::Uint8 & Ca...
bc1fb3a1-24b2-4b56-8bdd-8c9d3f30e3ba
{ "language": "C++" }
```c++ #include <netinet/ether.h> #include <netinet/ip.h> #include "sll.h" #include "IPv4Processor.h" #include "LinuxCookedProcessor.h" void LinuxCookedProcessor::process(const struct pcap_pkthdr *pkthdr, const u_char *packet, const vector<NetData> &netData) { struct ip* ipHeader; struct ether_header* etherH...
```c++ #include <netinet/ether.h> #include <netinet/ip.h> #include "sll.h" #include "IPv4Processor.h" #include "LinuxCookedProcessor.h" void LinuxCookedProcessor::process(const struct pcap_pkthdr *pkthdr, const u_char *packet, const vector<NetData> &netData) { struct ip* ipHeader; struct sll_header* linuxCoo...
a503381f-01ba-46b2-8f7e-8f0471f4e1ab
{ "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...
d798eb26-991d-48d8-9c8b-507574dc41d4
{ "language": "C++" }
```c++ // Copyright 2016 Zheng Xian Qiu #include "framework.h" Window::Window() { } // Display Information int Window::DISPLAY_INDEX = 0; bool Window::displayModeLoaded = false; SDL_DisplayMode Window::displayMode; int Window::getDisplayWidth() { loadDisplayMode(); return displayMode.w; } int Window::getDispl...
```c++ // Copyright 2016 Zheng Xian Qiu #include "framework.h" Window::Window() { } // Display Information int Window::DISPLAY_INDEX = 0; bool Window::displayModeLoaded = false; SDL_DisplayMode Window::displayMode; int Window::getDisplayWidth() { loadDisplayMode(); return displayMode.w; } int Window::getDispl...
8c4679e6-b474-4b1e-907d-cdd92f22cb2c
{ "language": "C++" }
```c++ #include "DebugAndroid.hpp" #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <cutils/properties.h> void AndroidEnterDebugger() { ALOGE(__FUNCTION__); #ifndef NDEBUG static volatile int * const makefault = nullptr; char value[PROPERTY_VALUE_MAX]; property_get("debug.db.uid...
```c++ #include "DebugAndroid.hpp" #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <cutils/properties.h> void AndroidEnterDebugger() { ALOGE(__FUNCTION__); #ifndef NDEBUG static volatile int * const makefault = nullptr; char value[PROPERTY_VALUE_MAX]; property_get("debug.db.uid...
736e6da7-6e81-48b5-9a22-193d8f0cb04b
{ "language": "C++" }
```c++ #include "MasterClient_p.h" #include <QtCore/QString> #include <QtDBus/QDBusMessage> #include <QtDBus/QDBusReply> #include <QtDBus/QDBusObjectPath> #include "PositionProvider.h" using namespace GeoCute; static QString createClientPath() { SimpleDBusInterface masterInterface(serviceName, masterPathName,...
```c++ #include "MasterClient_p.h" #include <QtCore/QString> #include <QtDBus/QDBusMessage> #include <QtDBus/QDBusReply> #include <QtDBus/QDBusObjectPath> #include "PositionProvider.h" using namespace GeoCute; static QString createClientPath() { SimpleDBusInterface masterInterface(serviceName, masterPathName,...
a986138d-950b-4a9f-8fd8-eb1c78e9746d
{ "language": "C++" }
```c++ #include "Device.h" #include "../../Drivers/SPIDisplay/SPIDisplay.h" #include "../../Drivers/DevicesInterop/GHIElectronics_TinyCLR_Devices.h" #include "../../Drivers/DevicesInterop/GHIElectronics_TinyCLR_Devices_GHIElectronics_TinyCLR_Devices_Interop.h" void STM32F4_Startup_OnSoftResetDevice(const TinyCLR_Api_P...
```c++ #include "Device.h" #include "../../Drivers/SPIDisplay/SPIDisplay.h" #include "../../Drivers/DevicesInterop/GHIElectronics_TinyCLR_Devices.h" #include "../../Drivers/DevicesInterop/GHIElectronics_TinyCLR_Devices_GHIElectronics_TinyCLR_Devices_Interop.h" void STM32F4_Startup_OnSoftResetDevice(const TinyCLR_Api_M...
2c4f8d73-6fc8-42bd-bcad-ad73c89032c0
{ "language": "C++" }
```c++ #include "helloworld.h" #include <QCoreApplication> #include <QDebug> #include <qhttpserver.h> #include <qhttprequest.h> #include <qhttpresponse.h> Hello::Hello() { QHttpServer *server = new QHttpServer; server->listen(QHostAddress::Any, 5000); connect(server, SIGNAL(newRequest(QHttpRequest*, QHtt...
```c++ #include "helloworld.h" #include <QCoreApplication> #include <qhttpserver.h> #include <qhttprequest.h> #include <qhttpresponse.h> Hello::Hello() { QHttpServer *server = new QHttpServer; server->listen(QHostAddress::Any, 5000); connect(server, SIGNAL(newRequest(QHttpRequest*, QHttpResponse*)), ...
182d6ffa-c4c8-44ba-bd49-231039e208d9
{ "language": "C++" }
```c++ // RUN: clang-cc -emit-llvm %s -o - | FileCheck %s struct A; typedef int A::*param_t; struct { const char *name; param_t par; } *ptr; // CHECK: type { i8*, i32 } ``` Make test 64 bit safe.
```c++ // RUN: clang-cc -emit-llvm %s -o - | FileCheck %s struct A; typedef int A::*param_t; struct { const char *name; param_t par; } *ptr; // CHECK: type { i8*, {{i..}} } ```
c568fe34-c29a-4bc1-83d5-aebd20dc5982
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -emit-llvm %s -gcodeview -debug-info-kind=limited -o - | FileCheck %s struct a { ~a(); }; template <typename b> struct c : a { c(void (b::*)()); }; struct B { virtual void e(); }; c<B> *d() { static c<B> f(&B::e); return &f; } // CHECK: define internal void @"??__Ff@?1??d@@YAPEAU?$c@UB...
```c++ // RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm %s -gcodeview -debug-info-kind=limited -o - | FileCheck %s struct a { ~a(); }; template <typename b> struct c : a { c(void (b::*)()); }; struct B { virtual void e(); }; c<B> *d() { static c<B> f(&B::e); return &f; } // CHECK: define internal void ...
6a38e21b-9e94-4c56-859a-8d7e4c80dc0d
{ "language": "C++" }
```c++ #include "state_machine.hpp" namespace kg { void StateMachine::startState(StateRef newState, bool isReplacing) { if (isReplacing && !_states.empty()) { _states.pop(); } _states.push(std::move(newState)); _states.top()->start(); } void StateMachine::exitS...
```c++ #include "state_machine.hpp" namespace kg { void StateMachine::startState(StateRef newState, bool isReplacing) { if (isReplacing && !_states.empty()) { _states.pop(); } if (!isReplacing) { _states->top()->pause(); } _states.push(std::move(new...
ba0023ac-7510-4f01-8b64-6b81ac04d767
{ "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 "chrome/browser/extensions/chrome_mojo_service_registration.h" #include "base/logging.h" namespace extensions { void RegisterChromeServ...
```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 "chrome/browser/extensions/chrome_mojo_service_registration.h" #include "base/bind.h" #include "base/command_line.h" #include "base/loggi...
205d242b-0e2f-4e04-9b11-29a502b52323
{ "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. // //===---------------------------------...
98081ee3-1c63-43be-a0ca-0c021771802c
{ "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 <limits> #include "skia/ext/paint_simplifier.h" #include "third_party/skia/include/core/SkPaint.h" namespace skia { PaintSimplifier...
```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 "skia/ext/paint_simplifier.h" #include "third_party/skia/include/core/SkPaint.h" namespace skia { PaintSimplifier::PaintSimplifier()...
03e7a6b5-f1b0-4a34-bc73-9fdd021b955c
{ "language": "C++" }
```c++ /******************************************************* * Copyright (c) 2016, ArrayFire * All rights reserved. * * This file is distributed under 3-clause BSD license. * The complete license agreement can be obtained at: * http://arrayfire.com/licenses/BSD-3-Clause ***************************************...
```c++ /******************************************************* * Copyright (c) 2016, ArrayFire * All rights reserved. * * This file is distributed under 3-clause BSD license. * The complete license agreement can be obtained at: * http://arrayfire.com/licenses/BSD-3-Clause ***************************************...
943e97cb-2230-4239-8983-d05cdd616c77
{ "language": "C++" }
```c++ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE JPetEventTest #include <boost/test/unit_test.hpp> #include "../JPetAnalysisTools/JPetAnalysisTools.h" BOOST_AUTO_TEST_SUITE(FirstSuite) BOOST_AUTO_TEST_CASE(constructor_getHitsOrderedByTime) { std::vector<JPetHit> hits(4); hits[0].setTime(2); hits[1...
```c++ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE JPetEventTest #include <boost/test/unit_test.hpp> #include "../JPetAnalysisTools/JPetAnalysisTools.h" BOOST_AUTO_TEST_SUITE(FirstSuite) BOOST_AUTO_TEST_CASE(constructor_getHitsOrderedByTime) { std::vector<JPetHit> hits(4); hits[0].setTime(2); hits[1...
dc291e71-7449-4326-81d7-2f5c87b67ba4
{ "language": "C++" }
```c++ #include "SimpleString.h" #include <string.h> #include <stdio.h> #include <stdlib.h> SimpleString::SimpleString () : buffer(new char [1]) { buffer [0] = '\0'; } SimpleString::SimpleString (const char *otherBuffer) : buffer (new char [strlen (otherBuffer) + 1]) { strcpy (buffer, otherBuffer); } SimpleStri...
```c++ #include "SimpleString.h" #include <string.h> #include <stdio.h> #include <stdlib.h> SimpleString::SimpleString () : buffer(new char [1]) { buffer [0] = '\0'; } SimpleString::SimpleString (const char *otherBuffer) : buffer (new char [strlen (otherBuffer) + 1]) { strcpy (buffer, otherBuffer); } SimpleStri...
433b90c2-ae2f-49dc-9060-bb7936660b16
{ "language": "C++" }
```c++ // Copyright 2017 The CRC32C Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. #include "gtest/gtest.h" #include "./crc32c_arm64.h" #include "./crc32c_extend_unittests.h" namespa...
```c++ // Copyright 2017 The CRC32C Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. #include "gtest/gtest.h" #include "./crc32c_arm64.h" #include "./crc32c_extend_unittests.h" namespa...
43051b83-6757-48cb-ad30-adeed456373b
{ "language": "C++" }
```c++ //============================================================================ // Name : benchpress.cpp // Author : Ulrik Kofoed Pedersen // Version : // Copyright : MIT. See LICENSE file. // Description : Use blosc with different algorithms to compress data from // datasets in an...
```c++ //============================================================================ // Name : benchpress.cpp // Author : Ulrik Kofoed Pedersen // Version : // Copyright : MIT. See LICENSE file. // Description : Use blosc with different algorithms to compress data from // datasets in an...
5015a740-2d77-49d3-a641-7e41cfdc1b8b
{ "language": "C++" }
```c++ #include "paddle.h" int Paddle::numOfPaddles = 0; void Paddle::update() { al_get_mouse_state(&mouseState); mouseY = al_get_mouse_state_axis(&mouseState, 1); setPosition(x, mouseY); } void Paddle::reset() { al_get_mouse_state(&mouseState); mouseY = al_get_mouse_state_axis(&mouseState, 1); ...
```c++ #include "Paddle.h" int Paddle::numOfPaddles = 0; void Paddle::update() { al_get_mouse_state(&mouseState); mouseY = al_get_mouse_state_axis(&mouseState, 1); setPosition(x, mouseY); } void Paddle::reset() { al_get_mouse_state(&mouseState); mouseY = al_get_mouse_state_axis(&mouseState, 1); ...
1240b600-c16d-4ed4-8d52-358b3f0a7393
{ "language": "C++" }
```c++ #include <stdio.h> #include "mutex.h" #include "thread.h" #include "window.h" using System::Window; class DisplayThreadEntry : public System::ThreadEntry { public: virtual ~DisplayThreadEntry() {} virtual void *Run(void *arg) { Window *mainWindow = Window::Create(); int exitValue = mainWindow->DoMessag...
```c++ #include <stdio.h> #include "mutex.h" #include "thread.h" #include "window.h" using System::Window; using System::Thread; using System::ThreadEntry; class DisplayThreadEntry : public ThreadEntry { public: virtual ~DisplayThreadEntry() {} virtual void *Run(void *arg) { Window *mainWindow = Window::Create(...
7c1bda5c-136a-4876-b37b-de87f00a98f5
{ "language": "C++" }
```c++ #include <GL/glew.h> #include <SDL2/SDL.h> int main(void) { int flags = SDL_WINDOW_OPENGL | SDL_RENDERER_PRESENTVSYNC; SDL_Init(SDL_INIT_EVERYTHING); auto window = SDL_CreateWindow("title", 0, 0, 320, 240, flags); auto context = SDL_GL_CreateContext(window); glewInit(); glClearColor(0, 1, 0, 1); ...
```c++ #include <GL/glew.h> #include <SDL2/SDL.h> int main(void) { int flags = SDL_WINDOW_OPENGL | SDL_RENDERER_PRESENTVSYNC; SDL_Init(SDL_INIT_EVERYTHING); auto window = SDL_CreateWindow("title", 0, 0, 320, 240, flags); auto context = SDL_GL_CreateContext(window); glewInit(); glClearColor(0, 1, 0, 1); ...
0c965546-75f1-4aab-b91a-cf66e74ef400
{ "language": "C++" }
```c++ #include <iostream> #include "gtest/gtest.h" int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } ``` Test Main: Set up logging
```c++ #include "core/logging.hpp" #include <iostream> #include <gtest/gtest.h> int main(int argc, char* argv[]) { core::logging_init(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } ```
e230db69-09d9-41fd-bf21-b0dee5c6a0f0
{ "language": "C++" }
```c++ #include <glog/logging.h> #include <atom/atom.h> #include <core.h> int main(int argc, char **argv) { atom_initialize(); { ATOM_GC; atom_attach_thread(); start_core(argc, argv); } atom_terminate(); return 0; } ``` Remove extra blank line and include
```c++ #include <atom/atom.h> #include <core.h> int main(int argc, char **argv) { atom_initialize(); { ATOM_GC; atom_attach_thread(); start_core(argc, argv); } atom_terminate(); return 0; } ```
0ea10441-ef88-4ceb-b5fc-465ad0b69609
{ "language": "C++" }
```c++ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "bucketfactory.h" using document::BucketId; using document::DocumentId; using storage::spi::Bucket; using storage::spi::PartitionId; namespace proton { BucketId BucketFactory::getBu...
```c++ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "bucketfactory.h" #include <vespa/persistence/spi/test.h> using document::BucketId; using document::DocumentId; using storage::spi::Bucket; using storage::spi::PartitionId; using stor...
e1e6f87b-069e-4ff3-a20c-9c77f1cd0438
{ "language": "C++" }
```c++ #include <cstdint> #include <memory> #include <iostream> class Box { public: Box(int x) : x_(x) {} virtual ~Box() = default; void Print() { std::cout << x_ << "\n"; } private: int x_ {0}; }; std::unique_ptr<Box> Create(int x) { return std::make_unique<Box>(x); }...
```c++ #include <cstdint> #include <memory> #include <iostream> class Box { public: Box(int x) : x_(x) {} virtual ~Box() = default; void Print() { std::cout << x_ << "\n"; } private: int x_ {0}; }; std::unique_ptr<Box> Create(int x) { return std::make_unique<Box>(x); }...
8f526a4d-38b0-4455-b51d-8591327dcc95
{ "language": "C++" }
```c++ #define CATCH_CONFIG_RUNNER #include <catch.hpp> int main(int argc, char * const argv[]) { int result = Catch::Session().run(argc, argv); #ifdef WIN32 system("PAUSE"); #endif return result; } ``` Use ionCore alternative to system("PAUSE")
```c++ #define CATCH_CONFIG_RUNNER #include <catch.hpp> #include <ionCore.h> int main(int argc, char * const argv[]) { int result = Catch::Session().run(argc, argv); #ifdef WIN32 ion::WaitForUser(); #endif return result; } ```
5c9fee9d-37cb-4c55-a40e-0afcadd6f899
{ "language": "C++" }
```c++ #include <SFML/Graphics.hpp> //#include "libs/GUI-SFML/include/GUI-SFML.hpp" #include <iostream> #include "Game.hpp" int main() { sf::RenderWindow window(sf::VideoMode(800, 600), "My window"); //gsf::GUIEnvironment environment( window ); Game game(false, true, false); game.run(); return 0;...
```c++ #include <SFML/Graphics.hpp> //#include "libs/GUI-SFML/include/GUI-SFML.hpp" #include <iostream> #include "Game.hpp" int main() { sf::RenderWindow window(sf::VideoMode(800, 600), "My window"); //gsf::GUIEnvironment environment( window ); bool soundEnabled{ false }; Game game(false, true, soundEnab...
081996c4-d13a-4175-a029-c5beace379ad
{ "language": "C++" }
```c++ #include <iostream> #include <opencv2/opencv.hpp> #include "clicker.hpp" using namespace cv; using namespace std; const char* window_title = "Join-Robockets Clientside Software"; int main() { //Initialize camera. VideoCapture cap(CV_CAP_ANY); if(!cap.isOpened()) { cerr << "Could not open ...
```c++ #include <iostream> #include <opencv2/opencv.hpp> #include "clicker.hpp" using namespace cv; using namespace std; string window_title = "Join-Robockets Clientside Software"; int main() { //Initialize camera. VideoCapture cap(CV_CAP_ANY); if(!cap.isOpened()) { cerr << "Could not open image...
5eefdc6e-78e7-4fa3-bee2-a12e9ed7aa69
{ "language": "C++" }
```c++ // Copyright 2015 PDFium 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 "testing/embedder_test.h" #include "testing/gtest/include/gtest/gtest.h" class FPDFRenderPatternEmbeddertest : public EmbedderTest {}; TEST_F(...
```c++ // Copyright 2015 PDFium 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 "testing/embedder_test.h" #include "testing/gtest/include/gtest/gtest.h" class FPDFRenderPatternEmbeddertest : public EmbedderTest {}; TEST_F(...
0278bba7-f2d5-49b3-aa1f-3229c374107e
{ "language": "C++" }
```c++ /******************************************************************************* * Copyright 2013-2014 Aerospike, Inc. * * 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 * * ht...
```c++ /******************************************************************************* * Copyright 2013-2014 Aerospike, Inc. * * 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 * * ht...
c1650455-0980-432a-9d2b-4b3b0a7e6998
{ "language": "C++" }
```c++ #include "Controller.h" #include "JobHandler.h" #include "JobQueue.h" #include "Sensor.h" #include <list> std::list<Sensor> sensors; std::list<Controller> controllers; std::list<JobHandler> jobHandlers; JobQueue jobQueue; /** Initializes a Sensor object for each sensor */ void initializeSensors() { // "TODO: ...
```c++ #include "Controller.h" #include "JobHandler.h" #include "JobQueue.h" #include "Sensor.h" #include <vector> std::vector<Sensor> sensors; std::vector<Controller> controllers; std::vector<JobHandler> jobHandlers; JobQueue jobQueue; /** Initializes a Sensor object for each sensor */ void initializeSensors() { //...
d81fd0d5-5e4e-4bcc-bf49-b0c98ed3a7ac
{ "language": "C++" }
```c++ /****************************************************************************** * This file is part of dirtsand. * * * * dirtsand is free software: you can redistribute it and/or modify ...
```c++ /****************************************************************************** * This file is part of dirtsand. * * * * dirtsand is free software: you can redistribute it and/or modify ...
548fac1c-4031-4768-a443-853eeffde1eb
{ "language": "C++" }
```c++ #include <QtGui/QApplication> #include <QtCore/QProcess> #include <QtWebKit/QWebView> #if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) #include <eikenv.h> #include <eikappui.h> #include <aknenv.h> #include <aknappui.h> #endif // Q_OS_SYMBIAN && ORIENTATIONLOCK int main(int argc, char *argv[]) { QAppli...
```c++ #include <QtGui> #include <QtWebKit> #if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) #include <eikenv.h> #include <eikappui.h> #include <aknenv.h> #include <aknappui.h> #endif // Q_OS_SYMBIAN && ORIENTATIONLOCK int main(int argc, char *argv[]) { QApplication app(argc, argv); #if defined(Q_OS_SYMBIAN...
8e82a543-369e-4f15-9307-133ce87917af
{ "language": "C++" }
```c++ #include "perf_precomp.hpp" using namespace std; using namespace cv; using namespace perf; using std::tr1::make_tuple; using std::tr1::get; typedef std::tr1::tuple<String, bool> VideoCapture_Reading_t; typedef perf::TestBaseWithParam<VideoCapture_Reading_t> VideoCapture_Reading; PERF_TEST_P(VideoCapture_Readi...
```c++ #include "perf_precomp.hpp" using namespace std; using namespace cv; using namespace perf; using std::tr1::make_tuple; using std::tr1::get; typedef perf::TestBaseWithParam<String> VideoCapture_Reading; PERF_TEST_P(VideoCapture_Reading, ReadFile, testing::Values( "highgui/video/big_buck_bunny.avi", ...
35312fce-0b47-4953-9235-02334096b86d
{ "language": "C++" }
```c++ #include <stdio.h> #include "Halide.h" #define CHECK(f, s32, s64) \ static_assert(offsetof(buffer_t, f) == (sizeof(void*) == 8 ? (s64) : (s32)), #f " is wrong") int main(int argc, char **argv) { CHECK(dev, 0, 0); CHECK(host, 8, 8); CHECK(extent, 12, 16); CHECK(stride, 28, 32); CHECK(m...
```c++ #include <stdio.h> #include "Halide.h" #define CHECK(f, s32, s64) \ static_assert(offsetof(buffer_t, f) == (sizeof(void*) == 8 ? (s64) : (s32)), #f " is wrong") int main(int argc, char **argv) { CHECK(dev, 0, 0); CHECK(host, 8, 8); CHECK(extent, 12, 16); CHECK(stride, 28, 32); CHECK(m...
e0a7a9c4-6596-4de9-b64b-45c071e7c447
{ "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. // //===---------------------------------------------------------...
67fd0e33-c513-4488-8f40-f4ad777fa99a
{ "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() ...
f256b5db-a038-4fd7-ac15-4df0bf90fa8d
{ "language": "C++" }
```c++ //---------------------------------------------------------------- // $Id$ // Version: $Name$ // // Copyright (C) 2001, 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 file deal....
```c++ //---------------------------------------------------------------- // $Id$ // Version: $Name$ // // Copyright (C) 2001, 2002, 2003, 2004 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 file...
798d4b11-d76f-483b-81c3-d7ccd86801e7
{ "language": "C++" }
```c++ /* * Timer compilation example. * TODO */ #include <fastarduino/FastIO.hh> #include <fastarduino/Timer.hh> constexpr const Board::Timer TIMER = Board::Timer::TIMER1; // Define vectors we need in the example USE_TIMERS(1); using TIMER_TYPE = Timer<TIMER>; constexpr const uint32_t PERIOD_US = 1000000; const...
```c++ /* * Timer compilation example. * Shows how to use a CTC Timer (not RTT) to blink a LED. * * Wiring: * - on ATmega328P based boards (including Arduino UNO): * - D13 (PB5) LED connected to ground through a resistor * - on Arduino MEGA: * - D13 (PB7) LED connected to ground through a resistor * - on ...
1e8348aa-e6ef-4973-be4c-7202c1a36392
{ "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 "chrome/browser/ui/webui/print_preview_ui.h" #include "base/values.h" #include "chrome/browser/profiles/profile.h" #include "chrome/b...
```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 "chrome/browser/ui/webui/print_preview_ui.h" #include "base/values.h" #include "chrome/browser/profiles/profile.h" #include "chrome/b...
2ecb8787-39ad-4c32-a485-554bcd993f2a
{ "language": "C++" }
```c++ #include "TilePartitionerBase.h" void TilePartitionerBase::applyWeights(const std::vector<float>& weights, std::vector<sf::Uint8>& alphas) { int err = 255; float total_weight = 0.f; for (auto weight : weights) total_weight += weight; if (total_weight == 0.f) { // This shouldn...
```c++ #include "TilePartitionerBase.h" void TilePartitionerBase::applyWeights(const std::vector<float>& weights, std::vector<sf::Uint8>& alphas) { int err = 255; float total_weight = 0.f; for (auto weight : weights) total_weight += weight; for (auto& alpha : alphas) { alpha = 0; ...
a7c4ceba-4e57-43e8-9201-ae72d5f6d705
{ "language": "C++" }
```c++ #include "capu/util/ConsoleLogAppender.h" #include "capu/util/LogMessage.h" #include "capu/os/Console.h" #include "capu/os/Time.h" #include <stdio.h> namespace capu { Mutex ConsoleLogAppender::m_logMutex; ConsoleLogAppender::~ConsoleLogAppender() { } void ConsoleLogAppender::logMessage(con...
```c++ #include "capu/util/ConsoleLogAppender.h" #include "capu/util/LogMessage.h" #include "capu/util/ScopedLock.h" #include "capu/os/Console.h" #include "capu/os/Time.h" #include <stdio.h> namespace capu { Mutex ConsoleLogAppender::m_logMutex; ConsoleLogAppender::~ConsoleLogAppender() { } void ...
02b6406b-741f-41c7-bec3-7d0cf0a5559e
{ "language": "C++" }
```c++ #include<cmath> #include<iostream> using namespace std; 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; } ...
```c++ #include<cmath> #include<iostream> using namespace std; bool isPrimeBruteForce(double x) { if (x < 2) return false; double 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; ...
45e14a09-cb24-4427-9626-7e91e3c4cf50
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -Wno-unreachable-code -Werror -emit-llvm -o - %s | FileCheck %s // expected-no-diagnostics int val = 42; int& test1() { return throw val, val; } int test2() { return val ? throw val : val; } // rdar://problem/8608801 void test3() { throw false; } // PR10...
```c++ // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -Wno-unreachable-code -Werror -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s int val = 42; int& test1() { return throw val, val; } int test2() { return val ? throw val : val; } // rdar://problem/8608801 void test3() { throw false; } // PR1058...
5b16469a-5d28-47cf-bdd5-7d83b0b45e41
{ "language": "C++" }
```c++ #include "CIndexBuffer.h" #include <glad/glad.h> namespace ion { namespace Graphics { namespace GL { void CIndexBuffer::UploadData(void const * Data, size_t const Elements, EValueType const ValueType) { CheckedGLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, Handle)); Checked...
```c++ #include "CIndexBuffer.h" #include <glad/glad.h> namespace ion { namespace Graphics { namespace GL { void CIndexBuffer::UploadData(void const * Data, size_t const Elements, EValueType const ValueType) { CheckedGLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, Handle)); Checked...
e2c5c668-720c-4db9-afd7-b2a4695d6883
{ "language": "C++" }
```c++ #include "MainWindow.h" #include "ui_MainWindow.h" #include "CuteNode.h" #include "NodeScene.h" MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) , _scene{std::make_unique<NodeScene>(QRectF(0.0, 0.0, 3000.0, 3000.0))} , _ui{std::make_unique<Ui::MainWindow>()} { _ui->setupUi(this); ...
```c++ #include "MainWindow.h" #include "ui_MainWindow.h" #include "CuteNode.h" #include "NodeScene.h" MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) , _scene{std::make_unique<NodeScene>(QRectF(0.0, 0.0, 3000.0, 3000.0))} , _ui{std::make_unique<Ui::MainWindow>()} { _ui->setupUi(this); ...
833f9f0e-e01f-447a-bc94-4c512a9f55ca
{ "language": "C++" }
```c++ #include "command.h" #include "../CommandHandler.h" #include "../option.h" /* full name of the command */ _CMDNAME("manual"); /* description of the command */ _CMDDESCR("view the lynxbot manual"); /* command usage synopsis */ _CMDUSAGE("$manual"); /* manual: view the lynxbot manual */ std::string CommandHandle...
```c++ #include "command.h" #include "../CommandHandler.h" #include "../option.h" /* full name of the command */ _CMDNAME("manual"); /* description of the command */ _CMDDESCR("view the lynxbot manual"); /* command usage synopsis */ _CMDUSAGE("$manual"); /* manual: view the lynxbot manual */ std::string CommandHandle...
538fd97a-2172-468c-9abf-a15ee8bfb55b
{ "language": "C++" }
```c++ #include "tag-database-factory.h" #include "tag-database-in-memory.h" #include "tag-database-sqlite.h" #include <QFile> TagDatabase *TagDatabaseFactory::Create(QString directory) { if (!directory.endsWith("/") && !directory.endsWith("\\")) directory += "/"; QString typesFile = directory + "tag-types.txt";...
```c++ #include "tag-database-factory.h" #include "tag-database-in-memory.h" #include "tag-database-sqlite.h" #include <QFile> TagDatabase *TagDatabaseFactory::Create(QString directory) { if (!directory.endsWith("/") && !directory.endsWith("\\")) directory += "/"; QString typesFile = directory + "tag-types.txt";...
8f985424-fdd2-4fee-93cc-c1d222d09b81
{ "language": "C++" }
```c++ // // Copyright (c) 2010 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // #include <math.h> #include <stdlib.h> #include "util.h" #ifdef _MSC_VER #include <locale.h> #else #include <sstream> #endi...
```c++ // // Copyright (c) 2010 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // #include <math.h> #include <stdlib.h> #include "util.h" #ifdef _MSC_VER #include <locale.h> #else #include <sstream> #endi...
ece7fe77-0527-43d2-b1e0-71e79567fa98
{ "language": "C++" }
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/sync/glue/chrome_encryptor.h" #include "chrome/browser/password_manager/encryptor.h" namespace browser_sync { Chrom...
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/sync/glue/chrome_encryptor.h" #include "chrome/browser/password_manager/encryptor.h" namespace browser_sync { Chrom...
1710ba63-ec8f-438e-9654-b26746f68c40
{ "language": "C++" }
```c++ /* * Copyright 2020 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include <emscripten.h> #include <emscripten/bind.h> #include "tools/viewer/SampleSlide.h" #include <string> using namespace emscripten; EMSCRIPTEN_BINDINGS(Viewer) { ...
```c++ /* * Copyright 2020 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include <emscripten.h> #include <emscripten/bind.h> #include "include/core/SkCanvas.h" #include "tools/viewer/SampleSlide.h" #include <string> using namespace emscript...
b0253733-6e50-4d14-ae41-80e126511abd
{ "language": "C++" }
```c++ #include "ofMain.h" #include "ofApp.h" #include "ofAppGLFWWindow.h" int main() { ofGLFWWindowSettings settings; settings.width = 1280; settings.height = 720; settings.setPosition(ofVec2f(300,0)); settings.resizable = true; shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings...
```c++ #include "ofMain.h" #include "ofApp.h" #include "ofAppGLFWWindow.h" int main() { ofGLFWWindowSettings settings; settings.width = 1280; settings.height = 720; settings.setPosition(ofVec2f(300,0)); settings.resizable = true; shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings...
d5b434f9-a597-47c3-95fe-892d1fb7599b
{ "language": "C++" }
```c++ #include "../kontsevich_graph_series.hpp" #include <ginac/ginac.h> #include <iostream> using namespace std; using namespace GiNaC; size_t order = 2; int main() { // Compute relevant primes map< size_t, set<KontsevichGraph> > primes; for (size_t n = 0; n <= order; ++n) { primes[n] = Kont...
```c++ #include "../kontsevich_graph_series.hpp" #include <ginac/ginac.h> #include <iostream> using namespace std; using namespace GiNaC; size_t order = 2; int main() { // Compute relevant primes map< size_t, set<KontsevichGraph> > primes; for (size_t n = 0; n <= order; ++n) { primes[n] = Kont...
9256fbfa-a33f-419c-a4c4-b746253813ae
{ "language": "C++" }
```c++ /* * This file is part of meego-im-framework * * * Copyright (C) 2012 Mattia Barbon <mattia@develer.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1 as published by the Free Software Foundation * and a...
```c++ /* This file is part of Maliit framework * * Copyright (C) 2012 Mattia Barbon <mattia@develer.com> * * Contact: maliit-discuss@lists.maliit.org * * 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...
04cfa88c-d9d4-4f0c-ad67-023b3172c9b4
{ "language": "C++" }
```c++ #define FPL_AUTO_NAMESPACE #include <final_platform_layer.hpp> int main(int argc, char **args) { Settings settings = DefaultSettings(); CopyAnsiString("Software Rendering Example", settings.window.windowTitle, FPL_ARRAYCOUNT(settings.window.windowTitle) - 1); settings.video.driverType = VideoDriverType::Soft...
```c++ #define FPL_AUTO_NAMESPACE #include <final_platform_layer.hpp> struct RandomSeries { uint16_t index; }; static uint16_t RandomU16(RandomSeries &series) { series.index ^= (series.index << 13); series.index ^= (series.index >> 9); series.index ^= (series.index << 7); return (series.index); } static uint...
4c21f784-e162-4926-8378-83e73c1b9715
{ "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 "SkFontHost.h" #include "SkTypeface.h" #include "SkTypeface_win.h" //static void SkFontHost::EnsureTypefaceAccessible(const SkTypeface& typeface) { //No s...
```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 "SkFontHost.h" #include "SkTypeface.h" //static void SkFontHost::EnsureTypefaceAccessible(const SkTypeface& typeface) { //No sandbox, nothing to do. } ```
c8ddcdc8-b572-4ed0-888c-1bfbaa2bf11a
{ "language": "C++" }
```c++ #include "side_pane.hpp" #include <cppurses/painter/color.hpp> #include <cppurses/painter/glyph.hpp> #include <cppurses/widget/widgets/text_display.hpp> using namespace cppurses; namespace demos { namespace glyph_paint { Side_pane::Side_pane() { this->width_policy.fixed(16); space1.wallpaper = L'─';...
```c++ #include "side_pane.hpp" #include <cppurses/painter/color.hpp> #include <cppurses/painter/glyph.hpp> #include <cppurses/widget/widgets/text_display.hpp> using namespace cppurses; namespace demos { namespace glyph_paint { Side_pane::Side_pane() { this->width_policy.fixed(16); space1.wallpaper = L'─';...
d308e08f-aea2-488d-a9c2-fb2a9c5e75a7
{ "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 "SkFontHost.h" #include "SkTypeface.h" #include "SkTypeface_win.h" //static void SkFontHost::EnsureTypefaceAccessible(const SkTypeface& typeface) { //No s...
```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 "SkFontHost.h" #include "SkTypeface.h" //static void SkFontHost::EnsureTypefaceAccessible(const SkTypeface& typeface) { //No sandbox, nothing to do. } ```
41779e4c-f3ec-429a-a4fb-3a6915b80277
{ "language": "C++" }
```c++ // Copyright (c) 2017 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 "quic/test_tools/failing_proof_source.h" #include "absl/strings/string_view.h" namespace quic { namespace test { void FailingProofS...
```c++ // Copyright (c) 2017 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 "quic/test_tools/failing_proof_source.h" #include "absl/strings/string_view.h" namespace quic { namespace test { void FailingProofS...
1e7350cc-6caa-4875-9cd8-b6e99f942d77
{ "language": "C++" }
```c++ #include <test/unit/math/test_ad.hpp> TEST(MathMixMatFun, reverse) { auto f = [](const auto& x) { return stan::math::reverse(x); }; // 0 x 0 Eigen::VectorXd x0(0); stan::test::expect_ad(f, x0); // 1 x 1 Eigen::VectorXd x1(1); x1 << 1; stan::test::expect_ad(f, x1); // 4 x 4 Eigen::VectorXd...
```c++ #include <test/unit/math/test_ad.hpp> #include <vector> TEST(MathMixMatFun, reverse_vector) { auto f = [](const auto& x) { return stan::math::reverse(x); }; // 0 x 0 Eigen::VectorXd x0(0); stan::test::expect_ad(f, x0); // 1 x 1 Eigen::VectorXd x1(1); x1 << 1; stan::test::expect_ad(f, x1); /...
40cb4db3-dd85-47a1-b54f-87fa3fa22fe4
{ "language": "C++" }
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "../DNAnalyzerServer/Dictionnaire.h" #include "../DNAnalyzerServer/Mots.h" #include <exception> #include <unordered_set> #include <cstring> #include <string> using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace DNAnalyzerServerTest { TE...
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "../DNAnalyzerServer/Dictionnaire.h" #include <exception> #include <cstring> using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace DNAnalyzerServerTest { TEST_CLASS(DictionnaireTest) { public: //ObtenirInstance TEST_METHOD(ObtenirI...
6faee5e8-34a3-4074-944b-26d1fc8193cf
{ "language": "C++" }
```c++ /*========================================================================= Library: CTK Copyright (c) 2010 Kitware Inc. 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 ...
```c++ /*========================================================================= Library: CTK Copyright (c) 2010 Kitware Inc. 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 ...
823b59b1-66a8-41ff-9395-8450244a64c7
{ "language": "C++" }
```c++ #include <iostream> #include "Crown.h" #include "lua.hpp" #include <unistd.h> using namespace crown; static void report_errors(lua_State* state, const int status) { if (status != 0) { std::cerr << "-- " << lua_tostring(state, -1) << std::endl; lua_pop(state, 1); } } int main(int argc, char** ar...
```c++ #include <iostream> #include "Crown.h" #include "lua.hpp" #include <unistd.h> using namespace crown; static void report_errors(lua_State* state, const int status) { if (status != 0) { std::cerr << "-- " << lua_tostring(state, -1) << std::endl; lua_pop(state, 1); } } int main(int argc, char** ar...
28c9d755-83ab-4019-bd5c-10fc149fcc32
{ "language": "C++" }
```c++ #include <Magick++/Functions.h> #include <Magick++/ResourceLimits.h> #include <Magick++/SecurityPolicy.h> #ifndef FUZZ_MAX_SIZE #define FUZZ_MAX_SIZE 2048 #endif class FuzzingInitializer { public: FuzzingInitializer() { Magick::InitializeMagick((const char *) NULL); Magick::SecurityPolicy::maxMemoryR...
```c++ #include <Magick++/Functions.h> #include <Magick++/ResourceLimits.h> #include <Magick++/SecurityPolicy.h> #ifndef FUZZ_MAX_SIZE #define FUZZ_MAX_SIZE 2048 #endif class FuzzingInitializer { public: FuzzingInitializer() { // Disable SIMD in jpeg turbo. (void) putenv(const_cast<char *>("JSIMD_FORCENONE...
f889777a-07ba-4470-803b-739922fdda6a
{ "language": "C++" }
```c++ #include "main_window.hpp" #include <QVBoxLayout> #include <QMessageBox> #include "executable_viewer.hpp" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setWindowTitle(QString("Interactive Executable Mangler")); mdiArea = new QMdiArea(); QVBoxLayout *layout = new QVBoxLayout(); ...
```c++ #include "main_window.hpp" #include <QMessageBox> #include "executable_viewer.hpp" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setWindowTitle(QString("Interactive Executable Mangler")); mdiArea = new QMdiArea(); QMenu *file = menuBar()->addMenu(QString("File")); setCentralW...
e105a94f-9a4f-4809-97cd-c4d0fae74b9a
{ "language": "C++" }
```c++ #include "common.th" // c <- multiplicand // d <- multiplier // b -> product .global imul imul: pushall(h,i) i <- d == 0 jnzrel(i, L_done) L_top: h <- d & 1 i <- h <> 0 i <- c & i b <- b + i c <- c << 1 d <- d >> 1 i <- d <> 0 jnzrel(i, L_top) L_done: popall(h,...
```c++ #include "common.th" // c <- multiplicand // d <- multiplier // b -> product .global imul imul: pushall(h,i,j,k) i <- d == 0 jnzrel(i, L_done) h <- 1 b <- 0 j <- c >> 31 // save sign bit in j j <- -j // convert sign to flag c <- c ^ j // adjust multiplicand ...
116c4ed5-9978-4c62-bfe5-bd1232bd5622
{ "language": "C++" }
```c++ #include "UnitTest++/UnitTest++.h" #include <fstream> #include <cereal/archives/binary.hpp> SUITE( CerealTest ) { TEST( basicSaveAndLoad ) { const std::string saveFileName = "CerealTest"; const int expectedData = 42; int actualData = 666; { std::ofstream fil...
```c++ #include "UnitTest++/UnitTest++.h" #include <fstream> #include <cereal/archives/binary.hpp> class Base { public: Base() : someConstant(1) { } private: const int someConstant; friend cereal::access; template < class Archive > void serialize( Arch...
8265c0a9-7517-4cd8-84b2-28382d47fec4
{ "language": "C++" }
```c++ #include "variables.hpp" #ifdef _VARS std::ostream& var_defs_stream = cerr; #endif ``` Print variable debug output to stdout
```c++ #include "variables.hpp" #ifdef _VARS std::ostream& var_defs_stream = cout; #endif ```
725351c1-2ecf-4606-be77-1a6148e0cec8
{ "language": "C++" }
```c++ #include "editinterfaceext.h" #include "document.h" using namespace KTextEditor; uint EditInterfaceExt::globalEditInterfaceExtNumber = 0; EditInterfaceExt::EditInterfaceExt() : d(0L) { globalEditInterfaceExtNumber++; myEditInterfaceExtNumber = globalEditInterfaceExtNumber; } EditInterfaceExt::~EditInter...
```c++ /* This file is part of the KDE libraries Copyright (C) 2003 Hamish Rodda <rodda@kde.org> Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as publish...
8ffbbb98-1432-4f64-8168-d40628ef4aca
{ "language": "C++" }
```c++ #include "NMakefile.hpp" #include <configure/Build.hpp> #include <configure/Filesystem.hpp> #include <configure/quote.hpp> namespace configure { namespace generators { std::string NMakefile::name() const { return "NMakefile"; } bool NMakefile::is_available(Build& build) const { return build.fs().which(...
```c++ #include "NMakefile.hpp" #include <configure/Build.hpp> #include <configure/Filesystem.hpp> #include <configure/quote.hpp> namespace configure { namespace generators { std::string NMakefile::name() const { return "NMakefile"; } bool NMakefile::is_available(Build& build) const { return build.fs().which(...
7d413f0c-0209-438e-97cc-f5178372bebf
{ "language": "C++" }
```c++ #include "analyzer.h" #include "dal.h" #include "glog.h" #include <iostream> namespace holmes { kj::Promise<bool> Analyzer::run(DAL *dal) { std::vector<Holmes::Fact::Reader> searchedFacts; auto ctxs = dal->getFacts(premises); kj::Array<kj::Promise<bool>> analResults = KJ_MAP(ctx, ctxs) { if (...
```c++ #include "analyzer.h" #include "dal.h" #include "glog.h" #include <iostream> namespace holmes { kj::Promise<bool> Analyzer::run(DAL *dal) { std::vector<Holmes::Fact::Reader> searchedFacts; DLOG(INFO) << "Starting analysis " << name; DLOG(INFO) << "Getting facts for " << name; auto ctxs = dal->getFact...
a6d99ca7-d1d5-4723-b426-4e85a440b817
{ "language": "C++" }
```c++ #include <PIDController.h> #include <iostream> using namespace std; int main(int argc, char *argv[]) { PIDController* pid = new PIDController(1,0,0,-100,100); pid->on(); pid->targetSetpoint(100); pid->off(); cout << "Hello World!" << endl; return 0; } ``` Update example to be actually so...
```c++ #include <PIDController.h> #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { PIDController* pid = new PIDController(5,0.5,0.25,-100,100); pid->on(); // Turn PID controller on pid->targetSetpoint(10); // Change desired setpoint to 10 double t = 0; ...
a2e04c22-8675-41ac-8ff5-59c1ec63defd
{ "language": "C++" }
```c++ #include "gtest/gtest.h" int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } ``` Initialize libsodium in the gtest suite.
```c++ #include "gtest/gtest.h" #include "sodium.h" int main(int argc, char **argv) { assert(sodium_init() != -1); testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } ```
ab0e0130-5fe7-4398-a115-cd4cf8413e7b
{ "language": "C++" }
```c++ #include "../../include/core/StateCell.hpp" #include "../../include/core/Cell.hpp" bool StateCell::isState(StateCell* state) const { return state == this; //All state are singletons, so if state has the same class as this, it is the same instance } EmptyCell::EmptyCell() {} EmptyCell* EmptyCell::instance = ...
```c++ #include "../../include/core/StateCell.hpp" #include "../../include/core/Cell.hpp" bool StateCell::isState(StateCell* state) const { return state == this; //All state are singletons, so if state has the same class as this, it is the same instance } EmptyCell::EmptyCell() {} EmptyCell* EmptyCell::instance = ...
0a20bc0c-9e0b-4831-8244-d21067addff6
{ "language": "C++" }
```c++ #include <QtCore/QList> struct SmallType { char a[8]; }; struct BigType { char a[9]; }; void foo() { QList<BigType> bigT; // Warning QList<SmallType> smallT; // OK } class A { public: void foo() { m_big.clear(); } QList<BigType> m_big; // Warning }; void f...
```c++ #include <QtCore/QList> struct SmallType { char a[8]; }; struct BigType { char a[9]; }; void foo() { QList<BigType> bigT; // Warning QList<SmallType> smallT; // OK } class A { public: void foo() { m_big.clear(); } QList<BigType> m_big; // Warning }; void f...
3734512a-191b-4df1-ac11-c2c73069487d
{ "language": "C++" }
```c++ // dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" #include "commctrl.h" #include "accctrl.h" BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case...
```c++ // dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" #include "commctrl.h" #include "accctrl.h" #include "shellapi.h" #include "shlobj.h" BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { ...
8ec23673-2255-4940-a6f9-339fcf8bee04
{ "language": "C++" }
```c++ #include "test.h" // When defining a facility, it has to occur before including the logger. #define VAST_LOG_FACILITY "test" #include "vast/logger.h" #if VAST_LOG_LEVEL >= 5 using namespace vast; int foo() { VAST_ENTER(); VAST_RETURN(-1); return -1; }; void bar(int i, std::string s, char c) { VAST_E...
```c++ #include "test.h" // When defining a facility, it has to occur before including the logger. #define VAST_LOG_FACILITY "test" #include "vast/logger.h" #if VAST_LOG_LEVEL > 5 using namespace vast; int foo() { VAST_ENTER(); VAST_RETURN(-1); return -1; }; void bar(int i, std::string s, char c) { VAST_EN...
9efe9f0f-0e87-4902-921c-b729ae6bc5ea
{ "language": "C++" }
```c++ // RUN: %clangxx_asan -fno-rtti -DBUILD_SO1 -fPIC -shared %s -o %t1.so // RUN: %clangxx_asan -fno-rtti -DBUILD_SO2 -fPIC -shared %s -o %t2.so // RUN: %clangxx_asan -fno-rtti %t1.so %t2.so %s -Wl,-R. -o %t // RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t 2>&1 | FileCheck %s struc...
```c++ // FIXME: Same as test/asan/TestCases/Linux/odr-violation.cc ? // XFAIL: android // RUN: %clangxx_asan -fno-rtti -DBUILD_SO1 -fPIC -shared %s -o %t1.so // RUN: %clangxx_asan -fno-rtti -DBUILD_SO2 -fPIC -shared %s -o %t2.so // RUN: %clangxx_asan -fno-rtti %t1.so %t2.so %s -Wl,-R. -o %t // RUN: %env_asan_opts=fas...
8a1a066c-5a00-4286-b634-47ad19be59b7
{ "language": "C++" }
```c++ #include "PolarisBlock.h" #include "Poco/Net/ServerSocket.h" #include "Poco/Net/SocketReactor.h" #include "Poco/Net/SocketAcceptor.h" #include "PolarisConnection.h" using Poco::Net::ServerSocket; using Poco::Net::SocketReactor; using Poco::Net::SocketAcceptor; using Poco::Thread; int main(int argc, char** arg...
```c++ #include "PolarisBlock.h" #include "Poco/Net/ServerSocket.h" #include "Poco/Net/SocketReactor.h" #include "Poco/Net/SocketAcceptor.h" #include "Poco/Thread.h" #include "PolarisConnection.h" using Poco::Net::ServerSocket; using Poco::Net::SocketReactor; using Poco::Net::SocketAcceptor; using Poco::Thread; int ...
63421f97-4f88-43b2-b642-c3a9b5a63736
{ "language": "C++" }
```c++ #include "quasigame.h" #include "gamescene.h" QuasiGame::QuasiGame(QQuickItem *parent) : QQuickItem(parent) , m_currentScene(0) , m_fps(DEFAULT_FPS) { connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(onUpdate())); m_gameTime.start(); m_updateTimer.start(1000 / m_fps); } GameScene *...
```c++ #include "quasigame.h" #include "gamescene.h" QuasiGame::QuasiGame(QQuickItem *parent) : QQuickItem(parent) , m_currentScene(0) , m_fps(DEFAULT_FPS) { connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(onUpdate())); m_gameTime.start(); m_updateTimer.start(1000 / m_fps); } GameScene *...
1d3898ae-6900-4d34-8afb-07aab666da6e
{ "language": "C++" }
```c++ #include "JNIRhodes.h" #include "gapikey.h" #include <common/rhoparams.h> #undef DEFAULT_LOGCATEGORY #define DEFAULT_LOGCATEGORY "MapView" RHO_GLOBAL void mapview_create(rho_param *p) { #ifdef GOOGLE_API_KEY jclass clsMapView = getJNIClass(RHODES_JAVA_CLASS_MAPVIEW); if (!clsMapView) return; jmet...
```c++ #include "JNIRhodes.h" #include "gapikey.h" #include <common/rhoparams.h> #undef DEFAULT_LOGCATEGORY #define DEFAULT_LOGCATEGORY "MapView" extern "C" void alert_show_popup(char *); RHO_GLOBAL void mapview_create(rho_param *p) { #ifdef GOOGLE_API_KEY jclass clsMapView = getJNIClass(RHODES_JAVA_CLASS_MAPV...
9904797e-9edb-4e6f-8e12-920219cf48a0
{ "language": "C++" }
```c++ /* Copyright 2015 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 2015 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...
30eb698e-3537-4ecf-8576-0320c55f1a6c
{ "language": "C++" }
```c++ /* Include the SDL main definition header */ #include "SDL_main.h" /******************************************************************************* Functions called by JNI *******************************************************************************/ #include <jni.h> // Called before SDL_ma...
```c++ /* Include the SDL main definition header */ #include "SDL_main.h" /******************************************************************************* Functions called by JNI *******************************************************************************/ #include <jni.h> // Called before SDL_ma...
d8b50823-dcb9-41b0-9c9d-aa882e142bdf
{ "language": "C++" }
```c++ /* $Id$ */ #include <grid/geometry_info.h> // enable these lines for gcc2.95 // //const unsigned int GeometryInfo<deal_II_dimension>::vertices_per_cell; //const unsigned int GeometryInfo<deal_II_dimension>::lines_per_cell; //const unsigned int GeometryInfo<deal_II_dimension>::quads_per_cell; //const unsigned ...
```c++ /* $Id$ */ #include <grid/geometry_info.h> const unsigned int GeometryInfo<deal_II_dimension>::vertices_per_cell; const unsigned int GeometryInfo<deal_II_dimension>::lines_per_cell; const unsigned int GeometryInfo<deal_II_dimension>::quads_per_cell; const unsigned int GeometryInfo<deal_II_dimension>::hexes_pe...
9d1707d1-4b8d-4e62-8b26-0bb11e2234e5
{ "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 "SkFontHost.h" #include "SkTypeface.h" #include "SkTypeface_win.h" //static void SkFontHost::EnsureTypefaceAccessible(const SkTypeface& typeface) { //No s...
```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 "SkFontHost.h" #include "SkTypeface.h" //static void SkFontHost::EnsureTypefaceAccessible(const SkTypeface& typeface) { //No sandbox, nothing to do. } ```
f4c1e372-6bcb-4eb4-a869-1967a782fd44
{ "language": "C++" }
```c++ #include "Example1.h" #include <string.h> #include <GLES3/gl3.h> #include <jni.h> #include <iostream> #include <glm/gtc/matrix_transform.hpp> #include <shader_program.h> using namespace std; bool Example1::Init() { } void Example1::onDraw() { } void Example1::onShutdown() { } std::shared_ptr<Example1> appl...
```c++ #include "Example1.h" #include <string.h> #include <GLES3/gl3.h> #include <jni.h> #include <iostream> #include <glm/gtc/matrix_transform.hpp> #include <shader_program.h> #include <Context.h> #include <AndroidPlatform.h> #include <ContextAndroid.h> using namespace std; bool Example1::Init() { } void Example1:...
a594d4a6-76ed-4b0b-a2e9-f1ea1f3cc1c1
{ "language": "C++" }
```c++ #include<ros/ros.h> #include<ics3/ics> #include<servo_msgs/IdBased.h> ics::ICS3* driver {nullptr}; ros::Publisher pub; void move(const servo_msgs::IdBased::ConstPtr& msg) { auto degree = ics::Angle::newDegree(msg->angle); auto nowpos = driver->move(msg->id, degree); servo_msgs::IdBased result; result.i...
```c++ #include<ros/ros.h> #include<ics3/ics> #include<servo_msgs/IdBased.h> ics::ICS3* driver {nullptr}; ros::Publisher pub; void move(const servo_msgs::IdBased::ConstPtr& msg) { auto degree = ics::Angle::newDegree(msg->angle); try { auto nowpos = driver->move(msg->id, degree); servo_msgs::IdBased result...
409e17c9-605b-453d-8e43-b2346fecf70f
{ "language": "C++" }
```c++ // // Created by dar on 1/25/16. // #include "GuiButton.h" GuiButton::GuiButton(int x, int y, int width, int height) { this->x = x; this->y = y; this->width = width; this->height = height; } bool virtual GuiButton::onClick(int action, float x, float y) { if (onClickListener == NULL) return...
```c++ // // Created by dar on 1/25/16. // #include "GuiButton.h" GuiButton::GuiButton(int x, int y, int width, int height) { this->x = x; this->y = y; this->width = width; this->height = height; } bool GuiButton::onClick(int action, float x, float y) { if (onClickListener == NULL) return false; ...
2491a9d9-134a-4fe1-8bfc-e9983239f0ed
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s namespace [[deprecated]] {} // expected-warning {{'deprecated' attribute on anonymous namespace ignored}} namespace [[deprecated]] N { // expected-note 4{{'N' has been explicitly marked deprecated here}} int X; int Y = X; // Ok int f(); } int N::f(...
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s namespace [[deprecated]] {} // expected-warning {{'deprecated' attribute on anonymous namespace ignored}} namespace [[deprecated]] N { // expected-note 4{{'N' has been explicitly marked deprecated here}} int X; int Y = X; // Ok int f(); } int N::f(...
07432c51-4b25-490c-92fe-dfb2c71e54bc
{ "language": "C++" }
```c++ #include "object/object.h" #include "object/jsobject.h" #include "object/function.h" #include "parser/functionstatement.h" #include "vm/instruction-builder.h" #include "vm/instruction.h" #include "vm/context.h" #include "vm/vm.h" namespace grok { namespace parser { using namespace grok::vm; using namespace gro...
```c++ #include "object/object.h" #include "object/jsobject.h" #include "object/function.h" #include "parser/functionstatement.h" #include "vm/instruction-builder.h" #include "vm/instruction.h" #include "vm/context.h" #include "vm/vm.h" namespace grok { namespace parser { using namespace grok::vm; using namespace gro...
7db68d9d-7dfc-4a4f-931c-8fb6809107fd
{ "language": "C++" }
```c++ //@author A0097630B #include "stdafx.h" #include "query_executor.h" namespace You { namespace Controller { namespace Internal { QueryExecutor::QueryExecutor(std::unique_ptr<You::QueryEngine::Query>&& query) { } Result QueryExecutor::execute() { QueryEngine::Response response = QueryEngine::executeQuery( st...
```c++ //@author A0097630B #include "stdafx.h" #include "query_executor.h" namespace You { namespace Controller { namespace Internal { QueryExecutor::QueryExecutor(std::unique_ptr<You::QueryEngine::Query>&& query) : query(std::move(query)) { } Result QueryExecutor::execute() { QueryEngine::Response response = Query...
ab275acc-89c8-422d-84e9-21f86e7ace43
{ "language": "C++" }
```c++ // Copyright eeGeo Ltd (2012-2015), All Rights Reserved #include "WindowsInitialExperienceModule.h" #include "WindowsInitialExperiencePreLoadModel.h" #include "InitialExperienceIntroStep.h" //#include "InitialExperienceSearchResultAttractModeModel.h" namespace ExampleApp { namespace InitialExperience {...
```c++ // Copyright eeGeo Ltd (2012-2015), All Rights Reserved #include "WindowsInitialExperienceModule.h" #include "WindowsInitialExperiencePreLoadModel.h" #include "InitialExperienceIntroStep.h" //#include "InitialExperienceSearchResultAttractModeModel.h" #include "WorldPinVisibility.h" namespace ExampleApp { n...