doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
3289b5a7-743d-4271-ab55-6ce3e1c3ff1b
{ "language": "C++" }
```c++ #include "stdafx.h" #include "SettingsUI.h" #include "SettingsSheet.h" IMPLEMENT_DYNAMIC(SettingsSheet, CPropertySheet) SettingsSheet::SettingsSheet( UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage) : CPropertySheet(nIDCaption, pParentWnd, iSelectPage) { } SettingsSheet::SettingsSheet(LPCTSTR pszCapt...
```c++ #include "stdafx.h" #include "SettingsUI.h" #include "SettingsSheet.h" IMPLEMENT_DYNAMIC(SettingsSheet, CPropertySheet) SettingsSheet::SettingsSheet( UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage) : CPropertySheet(nIDCaption, pParentWnd, iSelectPage) { } SettingsSheet::SettingsSheet(LPCTSTR pszCapt...
13a05b2a-8e02-4f2b-888e-de2ed7298575
{ "language": "C++" }
```c++ #include "Server.h" #include "WebPage.h" #include "Connection.h" #include <QTcpServer> Server::Server(QObject *parent, bool ignoreSslErrors) : QObject(parent) { m_tcp_server = new QTcpServer(this); m_page = new WebPage(this); m_page->setIgnoreSslErrors(ignoreSslErrors); } bool Server::start() { connec...
```c++ #include "Server.h" #include "WebPage.h" #include "Connection.h" #include <QTcpServer> Server::Server(QObject *parent, bool ignoreSslErrors) : QObject(parent) { m_tcp_server = new QTcpServer(this); m_page = new WebPage(this); m_page->setIgnoreSslErrors(ignoreSslErrors); } bool Server::start() { connec...
949d6b25-16c8-40fc-93e9-765f7948cb1e
{ "language": "C++" }
```c++ #include <cmath> #include <ros/ros.h> #include <geometry_msgs/TransformStamped.h> #include <rviz_visual_tools/rviz_visual_tools.h> #include <tf2_eigen/tf2_eigen.h> #include <tf2_ros/transform_listener.h> #include <Eigen/Geometry> int main(int argc, char** argv) { ros::init(argc, argv, "body_angle_visualizer...
```c++ #include <cmath> #include <ros/ros.h> #include <rviz_visual_tools/rviz_visual_tools.h> #include <tf2_eigen/tf2_eigen.h> #include <tf2_ros/transform_listener.h> #include <Eigen/Geometry> int main(int argc, char** argv) { ros::init(argc, argv, "body_angle_visualizer"); ros::NodeHandle n {}; ros::Rate r {5...
2dfe476b-7d9a-41a8-8278-e0ebc53365d5
{ "language": "C++" }
```c++ #include "ImageData.h" #include <OpenGL/gl3.h> #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wold-style-cast" #pragma clang diagnostic ignored "-Wunused-function" #pragma clang diagnostic ignored "-Wdisabled-macro-expansion" #define STB_IMAGE_IMPLEMENTATION #define STBI_ONLY_PNG #include "st...
```c++ #include "ImageData.h" #include <OpenGL/gl3.h> #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wold-style-cast" #pragma clang diagnostic ignored "-Wunused-function" #pragma clang diagnostic ignored "-Wdisabled-macro-expansion" #define STB_IMAGE_IMPLEMENTATION #define STBI_ONLY_PNG #include "st...
20964b8b-88d3-487d-ae5e-20a10eabbe0b
{ "language": "C++" }
```c++ #include "runtime_internal.h" #ifdef BITS_64 #define WIN32API #else #define WIN32API __stdcall #endif extern "C" { WIN32API void *LoadLibrary(const char *); WIN32API void *GetProcAddress(void *, const char *); WEAK void *halide_get_symbol(const char *name) { return GetProcAddress(NULL, name); } WEAK voi...
```c++ #include "runtime_internal.h" #ifdef BITS_64 #define WIN32API #else #define WIN32API __stdcall #endif extern "C" { WIN32API void *LoadLibraryA(const char *); WIN32API void *GetProcAddress(void *, const char *); WEAK void *halide_get_symbol(const char *name) { return GetProcAddress(NULL, name); } WEAK vo...
e3c258e6-43bf-42ad-a63e-47b2096820c3
{ "language": "C++" }
```c++ // Qt includes #include <QLabel> #include <QVBoxLayout> // Visomics includes #include "voView.h" // VTK includes #include <vtkDataObject.h> //---------------------------------------------------------------------------- class voViewPrivate { public: }; // -----------------------------------------------------...
```c++ // Qt includes #include <QLabel> #include <QVBoxLayout> // Visomics includes #include "voView.h" // VTK includes #include <vtkDataObject.h> //---------------------------------------------------------------------------- class voViewPrivate { public: }; // -----------------------------------------------------...
b9ba3ce4-10ee-47c5-b236-73c10de339af
{ "language": "C++" }
```c++ #include <string.h> #include <stdlib.h> #include <stdio.h> #include <jni.h> #include <android/log.h> #define LOG_TAG "codec_unittest" #define LOGI(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) int CodecUtMain(int argc, char** argv); extern "C" JNIEXPORT void JNICALL Java_com_cisco_codec_uni...
```c++ #include <string.h> #include <stdlib.h> #include <stdio.h> #include <jni.h> #include <android/log.h> #define LOG_TAG "codec_unittest" #define LOGI(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) int CodecUtMain(int argc, char** argv); extern "C" JNIEXPORT void JNICALL Java_com_cisco_codec_uni...
cc9daaa5-9636-4bbf-a1b1-c1e3ecf0cb47
{ "language": "C++" }
```c++ ///////////////////////////////////////////////////////////////////////////// // This file is part of EasyRPG. // // EasyRPG 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 3 of the Lic...
```c++ ///////////////////////////////////////////////////////////////////////////// // This file is part of EasyRPG. // // EasyRPG 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 3 of the Lic...
0008db09-2fd9-44a7-86d3-c2e9c1441a41
{ "language": "C++" }
```c++ #include <cmath> #include "clock_converter.h" #include "log.h" UInt64 convertCycleCount(UInt64 cycle_count, volatile float from_frequency, volatile float to_frequency) { UInt64 converted_cycle_count = (UInt64) ceil(((float) cycle_count) * (to_frequency / from_frequency)); LOG_PRINT("convertCycleCount(%l...
```c++ #include <cmath> #include "clock_converter.h" #include "log.h" UInt64 convertCycleCount(UInt64 cycle_count, volatile float from_frequency, volatile float to_frequency) { UInt64 converted_cycle_count = (UInt64) ceil(((double) cycle_count) * (to_frequency / from_frequency)); LOG_PRINT("convertCycleCount(%...
659a62d6-49fd-4fb8-9173-9d4a292e0ffe
{ "language": "C++" }
```c++ #include <boost/test/unit_test.hpp> #include "../uint256.h" extern void SHA256Transform(void* pstate, void* pinput, const void* pinit); BOOST_AUTO_TEST_SUITE(miner_tests) BOOST_AUTO_TEST_CASE(sha256transform_equality) { unsigned int pSHA256InitState[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0...
```c++ #include <boost/test/unit_test.hpp> #include "../uint256.h" extern void SHA256Transform(void* pstate, void* pinput, const void* pinit); BOOST_AUTO_TEST_SUITE(miner_tests) BOOST_AUTO_TEST_CASE(sha256transform_equality) { unsigned int pSHA256InitState[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0...
6c74631d-e3ed-4974-8357-f43182d1acda
{ "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. // //===------------------------------------------------...
a790045e-98b0-48b3-bee9-6c385d33c2d5
{ "language": "C++" }
```c++ #include <iostream> #include <stdexcept> #include <type_traits> #include "fsm.h" class state_machine: public fsmlite::fsm<state_machine> { friend class fsm; // base class needs access to transition_table public: enum states { Init, Exit }; private: void process(const int& event) { std::co...
```c++ #include <iostream> #include <stdexcept> #include <type_traits> #include "fsm.h" class state_machine: public fsmlite::fsm<state_machine> { friend class fsm; // base class needs access to transition_table public: enum states { Init, Exit }; private: void process(const int& event) { std::co...
2397d8ec-632f-439c-8c85-028188e15c0a
{ "language": "C++" }
```c++ #include "catch.hpp" #include "visual.hh" #include "configuration.hh" using namespace vick; TEST_CASE("to_visual") { std::string first("assert"), second("\tblah"); for (int i = 0; i < first.size(); i++) REQUIRE(i == to_visual(first, i)); for (int i = 0; i < second.size(); i++) REQU...
```c++ #include "catch.hpp" #include "visual.hh" #include "configuration.hh" using namespace vick; TEST_CASE("to_visual") { std::string first("assert"), second("\tblah"); for (size_t i = 0; i < first.size(); i++) REQUIRE(i == to_visual(first, i)); for (size_t i = 0; i < second.size(); i++) ...
db7a09ba-22de-4be6-9192-9641b7827e78
{ "language": "C++" }
```c++ #include "dlgfilters.h" #include "filterwidget.h" #include <QHBoxLayout> #include <QVBoxLayout> #include <QPushButton> DlgFilters::DlgFilters(const QList<QPair<bool,QString> >& filters, QWidget *parent) : QDialog(parent, Qt::Dialog) { setWindowTitle(tr("strigiclient - Edit filters"));...
```c++ #include "dlgfilters.h" #include "filterwidget.h" #include <QHBoxLayout> #include <QVBoxLayout> #include <QPushButton> #include <QLabel> DlgFilters::DlgFilters(const QList<QPair<bool,QString> >& filters, QWidget *parent) : QDialog(parent, Qt::Dialog) { setWindowTitle(tr("strigiclient ...
aeefa587-757d-493e-963d-f7e1c149a592
{ "language": "C++" }
```c++ #include "core.h" #include "main.h" #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_SUITE(main_tests) BOOST_AUTO_TEST_CASE(subsidy_limit_test) { uint64_t nSum = 0; for (int nHeight = 0; nHeight < 7000000; nHeight += 1000) { uint64_t nSubsidy = GetBlockValue(nHeight, 0); BOOST_CHECK...
```c++ #include "core.h" #include "main.h" #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_SUITE(main_tests) BOOST_AUTO_TEST_CASE(subsidy_limit_test) { uint64_t nSum = 0; for (int nHeight = 0; nHeight < 14000000; nHeight += 1000) { uint64_t nSubsidy = GetBlockValue(nHeight, 0); BOOST_CHEC...
db1ac90d-077d-41a1-b7ae-c286dda741c7
{ "language": "C++" }
```c++ // This is an open source non-commercial project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com /*********************************************************************************** ** ** DateTimeStamp.cpp ** ** Copyright (C) September 2017 Hotride *...
```c++ // This is an open source non-commercial project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com /*********************************************************************************** ** ** DateTimeStamp.cpp ** ** Copyright (C) September 2017 Hotride *...
ef78e840-997b-48ea-a745-4ec10c0bf830
{ "language": "C++" }
```c++ //Injector source file for the Tech Target Check hook module. #include "tech_target_check.h" #include <hook_tools.h> namespace { const u32 Func_GetTechUseErrorMessage = 0x00491E80; void __declspec(naked) getTechUseErrorMessageWrapper() { static CUnit *target; static u8 castingPlayer; static u...
```c++ //Injector source file for the Tech Target Check hook module. #include "tech_target_check.h" #include <hook_tools.h> namespace { const u32 Func_GetTechUseErrorMessage = 0x00491E80; void __declspec(naked) getTechUseErrorMessageWrapper() { static CUnit *target; static u8 castingPlayer; static u...
95ed6400-8463-46ec-97b4-92d5330b2c2a
{ "language": "C++" }
```c++ struct Foo { Foo(int); }; void foo() { struct { Foo name; } Int[] = { 1 }; } ``` Add a dtor to ensure that they are called the right number of times.
```c++ struct Foo { Foo(int); ~Foo(); }; void foo() { struct { Foo name; } Int[] = { 1 }; } ```
13c191ae-9e87-4fdc-9bed-2adbd5c7a2f5
{ "language": "C++" }
```c++ #include "settings.h" int N_POLY_POINTS = 4; int N_COLOR_VAR = 5; int N_POS_VAR = 5; int SHAPE_OPT_FREQ = 25; int GUI_REFRESH_RATE = 1; int AUTOFOCUS_RES = 2; int FOCUS_LEFT=0, FOCUS_RIGHT=100, FOCUS_TOP=0, FOCUS_BOTTOM=100; ``` Disable random shape optimizations by default
```c++ #include "settings.h" int N_POLY_POINTS = 4; int N_COLOR_VAR = 5; int N_POS_VAR = 5; int SHAPE_OPT_FREQ = 0; int GUI_REFRESH_RATE = 1; int AUTOFOCUS_RES = 2; int FOCUS_LEFT=0, FOCUS_RIGHT=100, FOCUS_TOP=0, FOCUS_BOTTOM=100; ```
d3f1c20c-4153-4660-8c8e-64d76b625840
{ "language": "C++" }
```c++ #include "gamelib/components/update/CameraTracker.hpp" #include "gamelib/core/rendering/CameraSystem.hpp" #include "gamelib/core/ecs/Entity.hpp" namespace gamelib { CameraTracker::CameraTracker() : UpdateComponent(1, UpdateHookType::PostPostFrame), camera(0), shakerad(5), _sh...
```c++ #include "gamelib/components/update/CameraTracker.hpp" #include "gamelib/core/rendering/CameraSystem.hpp" #include "gamelib/core/ecs/Entity.hpp" namespace gamelib { CameraTracker::CameraTracker() : UpdateComponent(1, UpdateHookType::PostPostFrame), camera(0), shakerad(5), _sh...
4d3cb81d-782f-4b2d-8ae7-b5aa7bb57ccb
{ "language": "C++" }
```c++ #include <franka/robot.h> #include <iostream> int main(int argc, char** argv) { if (argc != 2) { std::cerr << "Usage: ./echo_robot_state <robot-hostname>" << std::endl; return -1; } try { franka::Robot robot(argv[1]); size_t count = 0; robot.read([&count](const franka::RobotState& ro...
```c++ #include <franka/robot.h> #include <iostream> int main(int argc, char** argv) { if (argc != 2) { std::cerr << "Usage: ./echo_robot_state <robot-hostname>" << std::endl; return -1; } try { franka::Robot robot(argv[1]); size_t count = 0; robot.read([&count](const franka::RobotState& ro...
c7be453c-f82c-4555-ba67-b7349e592845
{ "language": "C++" }
```c++ // Standard headers #include <cmath> #include <iostream> // Libraries #include "Math.hpp" const double PI = 3.141592653589793238462643; unsigned long int factorial (unsigned long int n) { return (n == 1 || n == 0) ? 1 : factorial(n - 1) * n; } double fixRadians_impl(double radians) { if (radians > 2*PI) ...
```c++ // Standard headers #include <cmath> #include <iostream> // Libraries #include "Math.hpp" const double PI = 3.141592653589793238462643; // Alias using mpz = unsigned long int; using mpf = double; mpz factorial (mpz n) { return (n == 1 || n == 0) ? 1 : factorial(n - 1) * n; } mpf fixRadians_impl(mpf radian...
4018e5e3-bed7-414f-b0ac-199c1241f1b8
{ "language": "C++" }
```c++ #include "GlobalContext.hpp" #include "ast/SourceFile.hpp" #include "parser/SpiritParser.hpp" int main(int argc, char* args[]) { const std::vector<std::string> argv(args+1, args+argc); using namespace eddic; using namespace eddic::parser; for (int i=0; i<5; i++) for (auto& fname : argv...
```c++ #include "GlobalContext.hpp" #include "ast/SourceFile.hpp" #include "parser/SpiritParser.hpp" int main(int argc, char* args[]) { const std::vector<std::string> argv(args+1, args+argc); using namespace eddic; using namespace eddic::parser; for (int i=0; i<100; i++) for (auto& fname : ar...
6c69f876-733c-4773-9445-3cbdf7d72507
{ "language": "C++" }
```c++ /* * Justin's Awesome Game Engine * or * * Just Another Game Engine * * Copyright 2016 Justin White * * See included LICENSE file for distribution and reuse. */ #include <cstdio> #include <Engine.hpp> int main(const int argc, const char** argv) { std::cout << "Start" << std::endl;; Engine theGa...
```c++ /* * Justin's Awesome Game Engine * or * * Just Another Game Engine * * Copyright 2016 Justin White * * See included LICENSE file for distribution and reuse. */ #include <Engine.hpp> static std::unique_ptr<Engine> theGame; int success(const std::string& msg); int fail(const std::string& msg); int main...
a15a76c8-2967-45b6-aee8-427f4b21334a
{ "language": "C++" }
```c++ #include <iostream> #include "Board.h" #include "Renderer.h" int main(int argc, char** argv) { Board board(10, 10, 2); Renderer renderer; if(renderer.init() != 0) { renderer.quit(); return 1; } for(int i = 0; i < 5; ++i) { renderer.render(); SDL_Delay(1000); } renderer.quit(); return 0; }``...
```c++ #include <iostream> #include "Board.h" #include "Renderer.h" int main(int argc, char** argv) { Board board(10, 10, 2); Renderer renderer; if(renderer.init() != 0) { renderer.quit(); return 1; } bool running = true; SDL_Event event; while(running) { while(SDL_PollEvent(&event)) { // Close wi...
5af9ff2b-b249-4059-b469-c5845829b9b8
{ "language": "C++" }
```c++ #include "../src/vault.h" #include <fstream> #include <iostream> namespace { // Copy example/credentials.txt.example to example/credentials.txt and // put your username and then password on the next line. std::pair<std::string, std::string> read_credentials() { std::ifstream f("example/credentials.txt");...
```c++ #include "../src/vault.h" #include <fstream> #include <iostream> namespace { // Copy example/credentials.txt.example to example/credentials.txt and // put your username and then password on the next line. std::pair<std::string, std::string> read_credentials() { std::string username; std::string passw...
486896d2-5bed-4a79-bd33-1244248f7c08
{ "language": "C++" }
```c++ #include "InternalCommands.h" #include "Environment.h" #include "Feeder.h" #include <iostream> using namespace std; int InternalCommands::exec(int argc, char const** argv,Environment *e,Feeder *f) { if(strncmp(argv[0],"echo",4) == 0){ exit( echo(argc,argv) ); }else if(strncmp(argv[0],"pid",3) == 0){ exit(...
```c++ #include "InternalCommands.h" #include "Environment.h" #include "Feeder.h" #include <iostream> #include <string.h> using namespace std; int InternalCommands::exec(int argc, char const** argv,Environment *e,Feeder *f) { if(strncmp(argv[0],"echo",4) == 0){ exit( echo(argc,argv) ); }else if(strncmp(argv[0],"pi...
80d8508b-02d7-4ea8-809e-1957b628978d
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s // PR39118 // Make sure that attributes are properly applied to explicit template // instantiations. #define HIDDEN __attribute__((__visibility__("hidden"))) #define VISIBLE __attribute__((__visibility__("default"))) namespace ns HIDDEN { struct A { }; ...
```c++ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s // PR39118 // Make sure that attributes are properly applied to explicit template // instantiations. #define HIDDEN __attribute__((__visibility__("hidden"))) #define VISIBLE __attribute__((__visibility__("default"))) namespa...
fec7bd4f-7f3e-4574-83be-5c2242e4b67c
{ "language": "C++" }
```c++ #include "PythonParserBase.h" using namespace antlr4; PythonParserBase::PythonParserBase(antlr4::TokenStream *input) : Parser(input) { } bool PythonParserBase::CheckVersion(int version) { return Version == PythonVersion::Autodetect || version == (int) Version; } void PythonParserBase::SetVersion(int require...
```c++ #include "PythonParserBase.h" using namespace antlr4; PythonParserBase::PythonParserBase(antlr4::TokenStream *input) : Parser(input) { Version = PythonVersion::Autodetect; } bool PythonParserBase::CheckVersion(int version) { return Version == PythonVersion::Autodetect || version == (int) Version; } void Py...
2fb92964-59a1-49a2-81f0-09739ed395af
{ "language": "C++" }
```c++ //===------------------------- typeinfo.cpp -------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
```c++ //===------------------------- typeinfo.cpp -------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
2d9e910c-4fe8-41ab-9f15-28b57840fc23
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -main-file-name abspath.cpp %S/Inputs/../abspath.cpp -o - | FileCheck -check-prefix=RMDOTS %s // RMDOTS: @__llvm_coverage_mapping = {{.*}}"\01 // RMDOTS-NOT: Inputs // RMDOTS: " // RUN: mkdir -p %t/test && cd %t/test // RUN: echo "void...
```c++ // RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -main-file-name abspath.cpp %S/Inputs/../abspath.cpp -o - | FileCheck -check-prefix=RMDOTS %s // RMDOTS: @__llvm_coverage_mapping = {{.*}}"\01 // RMDOTS-NOT: Inputs // RMDOTS: " // RUN: mkdir -p %t/test && cd %t/test // RUN: echo "void...
560e6a74-8bfa-4ec4-ae49-216a55e3e1c7
{ "language": "C++" }
```c++ #include <algorithm> #include <cassert> #include <iostream> #include <agency/execution_policy.hpp> int main() { using namespace agency; size_t n = 1 << 16; std::vector<float> x(n, 1), y(n, 2), z(n); float a = 13.; bulk_invoke(vec(n), [&](vector_agent &self) { int i = self.index(); z[i] = a...
```c++ #include <algorithm> #include <cassert> #include <iostream> #include <agency/execution_policy.hpp> int main() { using namespace agency; size_t n = 1 << 16; std::vector<float> x(n, 1), y(n, 2), z(n); float a = 13.; bulk_invoke(vec(n), [&](vector_agent &self) { auto i = self.index(); z[i] = ...
ac2fb208-98d5-48ce-902a-b12377d24e0c
{ "language": "C++" }
```c++ #include <avr/io.h> #include <util/delay.h> #include <OS.hpp> #include <avr/interrupt.h> #include "drivers/serial.hpp" Serial serial; mutex muteks_01; void Task1() { while (1) { static uint8_t i = 0; PORTB ^= (1 << PB2); _delay_ms(50); serial.printf("Test %d\r\n", i); ...
```c++ #include <avr/io.h> #include <util/delay.h> #include <OS.hpp> #include <avr/interrupt.h> #include "drivers/serial.hpp" Serial serial; mutex muteks_01; void Task1() { while (1) { static uint8_t i = 0; PORTB ^= (1 << PB2); _delay_ms(50); serial.printf("Test %d\r\n", i); ...
5f8755b8-db7d-4212-a24c-0770f618a99c
{ "language": "C++" }
```c++ #include <cstdio> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> #include <string.h> int main() { int fd = open("/tmp/bwtree.tmp", O_RDWR | O_TRUNC | O_CREAT); if(fd == -1) { printf("open() returned -1\n"); return -1; } int ret = ftruncate(fd, (0...
```c++ #include <cstdio> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/mman.h> int main() { /* int fd = open("/tmp/bwtree.tmp", O_RDWR | O_TRUNC | O_CREAT); if(fd == -1) { printf("open() returned -1\n"); return -1; } ...
19f4ef53-546b-4ad5-b3bb-0bf302597cdb
{ "language": "C++" }
```c++ // // Created by samueli on 2017-10-02. // #include "ins_service.hpp" #include <signal.h> volatile sig_atomic_t is_server_running = 1; void kill_server(int sig) { is_server_running = 0; } int main(int argc, char* argv[]) { spdlog::set_level(spdlog::level::debug); Pistache::Port port(9080); i...
```c++ // // Created by samueli on 2017-10-02. // #include "ins_service.hpp" #include <csignal> volatile sig_atomic_t is_server_running = 1; void kill_server(int sig) { is_server_running = 0; } int main(int argc, char* argv[]) { spdlog::set_level(spdlog::level::debug); Pistache::Port port(9080); in...
aa7b1687-ac51-469f-b733-8a8943926355
{ "language": "C++" }
```c++ #include "engine/hint.hpp" #include "engine/base64.hpp" #include "engine/datafacade/datafacade_base.hpp" #include <boost/assert.hpp> namespace osrm { namespace engine { bool Hint::IsValid(const util::Coordinate new_input_coordinates, const datafacade::BaseDataFacade &facade) const { aut...
```c++ #include "engine/hint.hpp" #include "engine/base64.hpp" #include "engine/datafacade/datafacade_base.hpp" #include <boost/assert.hpp> #include <iterator> #include <algorithm> namespace osrm { namespace engine { bool Hint::IsValid(const util::Coordinate new_input_coordinates, const datafacad...
56a691db-51b8-4859-a92f-94e288145fce
{ "language": "C++" }
```c++ // Copyright (C) 2015 Elviss Strazdins // This file is part of the Ouzel engine. #include "Camera.h" namespace ouzel { Camera::Camera() { } Camera::~Camera() { } void Camera::setZoom(float zoom) { _zoom = zoom; if (_zoom < 0.1f) ...
```c++ // Copyright (C) 2015 Elviss Strazdins // This file is part of the Ouzel engine. #include "Camera.h" namespace ouzel { Camera::Camera() { } Camera::~Camera() { } void Camera::setZoom(float zoom) { _zoom = zoom; if (_zoom < 0.1f) ...
e8d6681c-e092-4560-bafa-a4fc3431a268
{ "language": "C++" }
```c++ #include "px500.h" Px500::Px500(QObject *parent) : ServerBase(parent) { } const QString Px500::serverBaseUrl() const { return QStringLiteral("https://api.500px.com/v1"); } const Parameters Px500::requestHeaders() const { const QHash<QString, QString> headers = QHash<QString, QString> { //...
```c++ #include "px500.h" Px500::Px500(QObject *parent) : ServerBase(parent) { } const QString Px500::serverBaseUrl() const { return QStringLiteral("https://api.500px.com/v1"); } const Parameters Px500::requestHeaders() const { const QHash<QString, QString> headers = QHash<QString, QString> { //...
6de7b9b9-e6fa-40c2-9e34-574b99005eb7
{ "language": "C++" }
```c++ #include <mbed.h> extern void setup(); extern void loop(); void setIrqPriorities() { NVIC_SetPriority(UART5_IRQn, 1); NVIC_SetPriority(TIM5_IRQn, 2); NVIC_SetPriority(TIM4_IRQn, 3); } int main() { setIrqPriorities(); setup(); for (;;) { loop(); } } ``` Remove unnecessary I...
```c++ #include <mbed.h> extern void setup(); extern void loop(); void setIrqPriorities() { } int main() { setIrqPriorities(); setup(); for (;;) { loop(); } } ```
739b1ef0-53df-473d-95e4-2782aa573977
{ "language": "C++" }
```c++ #include "SocketHandler.hpp" namespace et { void SocketHandler::readAll(int fd, void* buf, size_t count) { size_t pos = 0; while (pos < count) { ssize_t bytesRead = read(fd, ((char*)buf) + pos, count - pos); if (bytesRead < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK) { ...
```c++ #include "SocketHandler.hpp" namespace et { void SocketHandler::readAll(int fd, void* buf, size_t count) { size_t pos = 0; while (pos < count) { ssize_t bytesRead = read(fd, ((char*)buf) + pos, count - pos); if (bytesRead < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK) { ...
aa6392a7-9149-4502-ac5a-a30372171d4f
{ "language": "C++" }
```c++ /* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "GrTypes.h" #include "SkThread.h" // for sk_atomic_inc // This used to be a global scope, but we got a warning about unused variable // so we moved it i...
```c++ /* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "GrTypes.h" #include "SkThread.h" // for sk_atomic_inc // Well, the dummy_ "fix" caused a warning on windows, so hiding all of it // until we can find a...
a1fc0aff-ca82-48b4-83db-1a7a0d329ee2
{ "language": "C++" }
```c++ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2015 Gábor Péterffy <peterffy95@gmail.com> // #include <QApplication> #incl...
```c++ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2015 Gábor Péterffy <peterffy95@gmail.com> // #include <QApplication> #incl...
8f5ebc0b-d9c5-4655-9ec1-a879ac19b540
{ "language": "C++" }
```c++ #include "hiredis/hiredis.h" #include <cstdlib> #include <iostream> #include <fstream> #include <string> using namespace std; int main (int argc, const char** argv) { auto context = redisConnect("127.0.0.1", 6379); // auto context = redisConnectUnix("/tmp/redis.sock"); if (context != NULL && context->err)...
```c++ #include "hiredis/hiredis.h" #include <cstdlib> #include <iostream> #include <fstream> #include <string> using namespace std; int main (int argc, const char** argv) { auto context = redisConnect("127.0.0.1", 6379); // auto context = redisConnectUnix("/tmp/redis.sock"); if (context != NULL && context->err)...
61532cfe-a6b9-4ecf-b020-6a3435c40830
{ "language": "C++" }
```c++ #include <functional> #include <stack> #include <string> #include <ccspec/core/example_group.h> namespace ccspec { namespace core { using std::function; using std::stack; using std::string; stack<ExampleGroup*> groups_being_defined; // Public methods. ExampleGroup::~ExampleGroup() { for (auto it = child...
```c++ #include <functional> #include <stack> #include <string> #include <ccspec/core/example_group.h> namespace ccspec { namespace core { using std::function; using std::stack; using std::string; stack<ExampleGroup*> groups_being_defined; // Public methods. ExampleGroup::~ExampleGroup() { for (auto& child : c...
869cb9f2-f24c-4db5-8ae8-3f109df959d2
{ "language": "C++" }
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ppapi/tests/test_case.h" #include <sstream> std::string TestCase::MakeFailureMessage(const char* file, ...
```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 "ppapi/tests/test_case.h" #include <sstream> std::string TestCase::MakeFailureMessage(const char* file, ...
73455e28-cd8d-4584-9c39-25ec7b798f73
{ "language": "C++" }
```c++ #include "ics3/eeprom.hpp" #include "ics3/eepparam.hpp" #include "ics3/ics3.hpp" #include <stdexcept> ics::EepParam ics::Eeprom::get(EepParam param) const { try { param.read(data); } catch (...) { throw std::runtime_error {"Fail data: non initialize EEPROM by ICS"}; } return param; } void ics...
```c++ #include "ics3/eeprom.hpp" #include "ics3/eepparam.hpp" #include <stdexcept> ics::EepParam ics::Eeprom::get(EepParam param) const { param.read(data); return param; } void ics::Eeprom::set(const EepParam& param) noexcept { param.write(data); } void ics::Eeprom::copyTo(std::vector<unsigned char>& dest) ...
041be51b-601b-4406-a449-1cf34298debe
{ "language": "C++" }
```c++ #ifndef NULL #ifdef __cplusplus #define NULL 0 #else #define NULL ((void *)0) #endif #endif extern "C" void KMain() { __asm { mov ah, 0h int 010h } } ``` Implement util functions to read stage2
```c++ #ifndef NULL #ifdef __cplusplus #define NULL 0 #else #define NULL ((void *)0) #endif #endif static struct { char size; char res; short transferSize; int dest; long source; } LBAPacket = {0x10, 0, 0, 0, 0}; inline void PrintChar(char c) { __asm { mov AH, 0x0A; mov AL, c; mov CX, 1; int 0x10; } }...
23d5629b-c841-44d6-bb47-5f8b8bd246b2
{ "language": "C++" }
```c++ // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib0.so // RUN: %clangxx_tsan -O1 %s -L%T -lignore_lib0 -o %t // RUN: echo running w/o suppressions: // RUN: LD_LIBRARY_PATH=%T not %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOSUPP // RUN: echo running with suppressions: // R...
```c++ // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib0.so // RUN: %clangxx_tsan -O1 %s -L%T -lignore_lib0 -o %t // RUN: echo running w/o suppressions: // RUN: LD_LIBRARY_PATH=%T${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} not %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOSUPP // RUN:...
95f3e5df-0825-41b8-b8f3-b53ceb25473d
{ "language": "C++" }
```c++ #include "extract.hpp" #include "../huffman/decompress.hpp" #include<fstream> #include<vector> #include<experimental/filesystem> void extract(const char* in_file, const char* out_dir) { std::ifstream in(in_file); extract(in, out_dir); } void extract(std::istream& in_stream, const char* out_dir) { std::istr...
```c++ #include "extract.hpp" #include "../huffman/decompress.hpp" #include<fstream> #include<vector> #include<experimental/filesystem> namespace fs = std::experimental::filesystem; void extract(const char* in_file, const char* out_dir) { std::ifstream in(in_file); extract(in, out_dir); } void extract(std::istrea...
5add3d7d-f964-459f-b2ad-b866895b7ae6
{ "language": "C++" }
```c++ #include <algorithm> #include <gtest/gtest.h> TEST(array, sorting) { int foo[3] = {1, 3, 2}; std::sort(foo, foo + 3); EXPECT_EQ(1, foo[0]); EXPECT_EQ(2, foo[1]); EXPECT_EQ(3, foo[2]); } TEST(swap, test1) { int a = 1; int b = 2; std::swap(a, b); EXPECT_EQ(2, a); EXPEC...
```c++ #include <algorithm> #include <gtest/gtest.h> TEST(array, sorting) { int foo[3] = {1, 3, 2}; std::sort(foo, foo + 3); EXPECT_EQ(1, foo[0]); EXPECT_EQ(2, foo[1]); EXPECT_EQ(3, foo[2]); } TEST(swap, test1) { int a = 1; int b = 2; std::swap(a, b); EXPECT_EQ(2, a); EXPEC...
dc3c8414-5a7b-4a30-9d48-89a0b308c7ac
{ "language": "C++" }
```c++ #include <catch.hpp> #include "WordDecoder.hpp" namespace { using namespace Core8; TEST_CASE("Decode X from pattern vXvv", "[decoder]") { REQUIRE(WordDecoder::readX(0x0F00) == 0XF); REQUIRE(WordDecoder::readX(0xF0FF) == 0X0); } TEST_CASE("Decode Y from pattern vvYv", "[decoder]") { REQUIRE(WordDecoder...
```c++ #include <catch.hpp> #include "WordDecoder.hpp" namespace { TEST_CASE("Decode X from pattern vXvv", "[decoder]") { REQUIRE(Core8::WordDecoder::readX(0x0F00) == 0XF); REQUIRE(Core8::WordDecoder::readX(0xF0FF) == 0X0); } TEST_CASE("Decode Y from pattern vvYv", "[decoder]") { REQUIRE(Core8::WordDecoder::r...
969d33f0-25b4-4895-9ef4-af9d5a220abd
{ "language": "C++" }
```c++ #include <QTabBar> #include "qclosabletabwidget.h" QClosableTabWidget::QClosableTabWidget(QWidget *parent) : QTabWidget(parent) { tabBar()->installEventFilter(this); } bool QClosableTabWidget::eventFilter(QObject *o, QEvent *e) { if (o == tabBar() && e->type() == QEvent::MouseButtonPress) { QMouseEvent ...
```c++ #include <QTabBar> #include "qclosabletabwidget.h" QClosableTabWidget::QClosableTabWidget(QWidget *parent) : QTabWidget(parent) { tabBar()->installEventFilter(this); } bool QClosableTabWidget::eventFilter(QObject *o, QEvent *e) { if (o == tabBar() && e->type() == QEvent::MouseButtonPress) { QMouseEvent ...
beaa98b2-4a59-4a2b-87d0-4f46b37c34e2
{ "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 "GrGLConfig.h" #include "GrGLInterface.h" void GrGLClearErr(const GrGLInterface* gl) { while (GR_GL_NO_ERROR != gl->fGetError()) {} } void GrGLCheckErr...
```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 "GrGLConfig.h" #include "GrGLInterface.h" void GrGLClearErr(const GrGLInterface* gl) { while (GR_GL_NO_ERROR != gl->fGetError()) {} } void GrGLCheckErr...
38ad6a0c-560e-4bce-8c37-ff6498d640b8
{ "language": "C++" }
```c++ # include <algorithm> # include <iostream> # include <iterator> # include <vector> # include <string> # include <queue> # include <stack> # include <cmath> # include <set> using namespace std; int main() { return 0; } ``` Remove some headers which are not frequently used
```c++ # include <cmath> # include <iostream> # include <queue> # include <set> # include <stack> # include <string> # include <vector> using namespace std; int main() { return 0; } ```
cbbb5d71-22a0-469d-b09a-3f89d84ca43d
{ "language": "C++" }
```c++ #include<iostream> #include"InputHandler.h" #include"Game.h" InputHandler *InputHandler::instance = 0; void InputHandler::initialiseJoysticks() { if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0) { SDL_InitSubSystem(SDL_INIT_JOYSTICK); } if (SDL_NumJoysticks() > 0) { joysticksInitialised = ...
```c++ #include<iostream> #include"InputHandler.h" #include"Game.h" InputHandler *InputHandler::instance = 0; void InputHandler::initialiseJoysticks() { if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0) { SDL_InitSubSystem(SDL_INIT_JOYSTICK); } if (SDL_NumJoysticks() <= 0) { joysticksInitialised =...
e42a6759-668c-4cde-8aed-f66e440ef150
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -std=c++2a -verify %s // expected-no-diagnostics template<typename ...T, typename ...Lambda> void check_sizes(Lambda ...L) { static_assert(((sizeof(T) == sizeof(Lambda)) && ...)); } template<typename ...T> void f(T ...v) { // Pack expansion of lambdas: each lambda captures only one pack ...
```c++ // RUN: %clang_cc1 -std=c++2a -verify %s template<typename ...T, typename ...Lambda> void check_sizes(Lambda ...L) { static_assert(((sizeof(T) == sizeof(Lambda)) && ...)); } template<typename ...T> void f(T ...v) { // Pack expansion of lambdas: each lambda captures only one pack element. check_sizes<T......
e5cb4ff2-9642-44bf-bbb4-0bdaa6fa6e26
{ "language": "C++" }
```c++ #include "edge_common.h" v8::Local<Value> throwV8Exception(v8::Local<Value> exception) { Nan::EscapableHandleScope scope; Nan::ThrowError(exception); return scope.Escape(exception); } v8::Local<Value> throwV8Exception(const char* format, ...) { va_list args; va_start(args, format); size_t size ...
```c++ #include "edge_common.h" v8::Local<Value> throwV8Exception(v8::Local<Value> exception) { Nan::EscapableHandleScope scope; Nan::ThrowError(exception); return scope.Escape(exception); } v8::Local<Value> throwV8Exception(const char* format, ...) { va_list args; va_start(args, format); size_t size ...
255349a3-1d38-42d1-82cc-3b52bab7745f
{ "language": "C++" }
```c++ #include "forgetthread.h" void ForgetThread::launch(){ //Aliases transactionHistory = transactionHistoryPtr[thread]; tupleContent = tupleContentPtr[thread]; mutexForget.lock(); while(true){ //Waits for the signal from main thread processingForgetThreadsNb++; conditio...
```c++ #include "forgetthread.h" void ForgetThread::launch(){ //Aliases transactionHistory = transactionHistoryPtr[thread]; tupleContent = tupleContentPtr[thread]; mutexForget.lock(); while(true){ //Waits for the signal from main thread processingForgetThreadsNb++; conditio...
d1ee14a8-4eea-4176-83d8-e47ed2f3e0da
{ "language": "C++" }
```c++ #include "test.h" #include "floaxie/ftoa.h" void dtoa_floaxie(double v, char* buffer) { floaxie::ftoa(v, buffer); } REGISTER_TEST(floaxie); ``` Fix building for pre-C++14 standards
```c++ #if __cplusplus >= 201402L #include "test.h" #include "floaxie/ftoa.h" void dtoa_floaxie(double v, char* buffer) { floaxie::ftoa(v, buffer); } REGISTER_TEST(floaxie); #endif ```
9343b802-7f93-4d6e-9d2d-4814c9f29d1e
{ "language": "C++" }
```c++ // Copyright (c) 2012 Cloudera, Inc. All rights reserved. // // This file contains the main() function for the state store process, // which exports the Thrift service StateStoreService. #include <glog/logging.h> #include <gflags/gflags.h> #include "sparrow/state-store-service.h" #include "util/cpu-info.h" DE...
```c++ // Copyright (c) 2012 Cloudera, Inc. All rights reserved. // // This file contains the main() function for the state store process, // which exports the Thrift service StateStoreService. #include <glog/logging.h> #include <gflags/gflags.h> #include <iostream> #include "common/status.h" #include "sparrow/state-...
efb123df-cb5a-41ba-b9a2-79af8c608e43
{ "language": "C++" }
```c++ #include "ReQL-ast-test.hpp" class BlankTest : public ASTTest { public: BlankTest() : ASTTest() { } void setup() { setName("BlankTest"); } void run() { } void cleanup() { } }; void ASTTest::setup() { setName("ASTTest"); addTest(BlankTest()); } ``` Add test to retrieve a table from d...
```c++ #include "ReQL-ast-test.hpp" using namespace ReQL; class BlankTest : public ASTTest { public: BlankTest() : ASTTest() { } void setup(); void cleanup() { conn.close(); } Connection conn; }; class TableTermTest : public BlankTest { public: TableTermTest() : BlankTest() {}; void run() { ...
d34e3468-835f-4271-aadb-d184fbdc5073
{ "language": "C++" }
```c++ #include<iostream> using namespace std; class node{ public: int data; node *left, *right; node(){} node(int d) { data=d; left=NULL; right=NULL; } node *insertNode(node *root, int d) { if(!root) return new node(d); else if(d <= root->data) root->left=insertNode(root->left,...
```c++ #include<iostream> using namespace std; class node{ public: int data; node *left, *right; node(){} node(int d) { data=d; left=NULL; right=NULL; } node *insertNode(node *root, int d) { if(!root) return new node(d); if(d <= root->data) root->left=insertNode(root->left,d); ...
9d722b62-d0c7-4cd3-a69c-7172e95d3d41
{ "language": "C++" }
```c++ #include "gtest/gtest.h" #include "IMediaLibrary.h" TEST( MediaLibary, Init ) { IMediaLibrary* ml = MediaLibraryFactory::create(); ASSERT_TRUE( ml->initialize( "test.db" ) ); } ``` Clear database between each test & add a test for file insertion
```c++ #include "gtest/gtest.h" #include "IMediaLibrary.h" class MLTest : public testing::Test { public: static IMediaLibrary* ml; protected: virtual void SetUp() { ml = MediaLibraryFactory::create(); bool res = ml->initialize( "test.db" ); ASSERT_T...
fed8bda8-112f-4feb-90ea-be920035eee3
{ "language": "C++" }
```c++ #include "WebcamDataProvider.h" namespace yarrar { WebcamDataProvider::WebcamDataProvider(const json11::Json& config) : DataProvider(config) , m_videoCapture(0) , m_dp({}) { if(!m_videoCapture.isOpened()) { throw std::runtime_error("cant open video"); } } const LockableData<Da...
```c++ #include "WebcamDataProvider.h" namespace yarrar { WebcamDataProvider::WebcamDataProvider(const json11::Json& config) : DataProvider(config) , m_videoCapture(0) , m_dp({}) { if(!m_videoCapture.isOpened()) { throw std::runtime_error("cant open video"); } } const LockableData<Da...
bd6feac4-a7eb-4477-ae60-357caf6038bf
{ "language": "C++" }
```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...
```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: }; }```
215413eb-9d0c-49e9-8aea-cea797af9a86
{ "language": "C++" }
```c++ #include <iostream> using std::cout; using std::endl; #include "problems/Factory.h" #include "util/Timer.h" using util::Timer; int main(int argc, char **argv) { auto problem = problems::Factory::create(1); Timer t; t.start(); problem->solve(); t.stop(); cout << problem->answer() << endl; cout...
```c++ #include <iostream> using std::cerr; using std::cout; using std::endl; #include <stdexcept> using std::exception; using std::out_of_range; #include <string> using std::stoul; #include "problems/Factory.h" #include "util/Timer.h" using util::Timer; void all_problems(); void one_problem(const unsigned long probl...
506023d2-a3d6-4d4b-bedc-f02c899a5470
{ "language": "C++" }
```c++ #include "notebooktree.h" #include "treenotebookitem.h" #include "treenotebookpageitem.h" #include "notebookexception.h" NotebookTree::NotebookTree(QWidget* parent) : QTreeWidget(parent) { this->setColumnCount(1); } void NotebookTree::addNotebook(Notebook& notebook) { TreeNotebookItem* treeItem = n...
```c++ #include "notebooktree.h" #include "treenotebookitem.h" #include "treenotebookpageitem.h" #include "notebookexception.h" #include <QHeaderView> NotebookTree::NotebookTree(QWidget* parent) : QTreeWidget(parent) { this->setColumnCount(1); this->header()->hide(); } void NotebookTree::addNotebook(Note...
704a81ca-21d1-4a57-a8da-8a8da921ac33
{ "language": "C++" }
```c++ // Copyright (c) 2015 Andrew Sutton // All rights reserved #include "lingo/utility.hpp" #include <cstdlib> #include <cxxabi.h> namespace lingo { String type_str(std::type_info const& t) { std::size_t n = 0; char* buf = abi::__cxa_demangle(t.name(), nullptr, &n, 0); String result(buf, n); std::free(bu...
```c++ // Copyright (c) 2015 Andrew Sutton // All rights reserved #include "lingo/utility.hpp" #include <cstdlib> #include <cxxabi.h> #include <iostream> namespace lingo { String type_str(std::type_info const& t) { std::size_t n = 0; char* buf = abi::__cxa_demangle(t.name(), nullptr, &n, 0); String result(buf...
7d5fe391-cb46-45f0-b1a7-7ab5da5316f4
{ "language": "C++" }
```c++ #include <QTest> #include <QObject> #include "uritests.h" // This is all you need to run all the tests int main(int argc, char *argv[]) { URITests test1; QTest::qExec(&test1); } ``` Return !0 when qt tests fail.
```c++ #include <QTest> #include <QObject> #include "uritests.h" // This is all you need to run all the tests int main(int argc, char *argv[]) { bool fInvalid = false; URITests test1; if (QTest::qExec(&test1) != 0) fInvalid = true; return fInvalid; } ```
5680e9c1-bc78-42da-9235-1256e03c2b8a
{ "language": "C++" }
```c++ #include "EjectOSD.h" #include <Dbt.h> #include "..\Monitor.h" #include "..\Skin.h" EjectOSD::EjectOSD() : OSD(L"3RVX-EjectDispatcher") { _mWnd = new MeterWnd(L"3RVX-EjectOSD", L"3RVX-EjectOSD"); Skin *skin = _settings.CurrentSkin(); Gdiplus::Bitmap *bg = skin->OSDBgImg("eject"); _mWnd->Backg...
```c++ #include "EjectOSD.h" #include <Dbt.h> #include "..\Monitor.h" #include "..\Skin.h" EjectOSD::EjectOSD() : OSD(L"3RVX-EjectDispatcher") { _mWnd = new MeterWnd(L"3RVX-EjectOSD", L"3RVX-EjectOSD"); Skin *skin = _settings.CurrentSkin(); if (skin->HasOSD("eject") == false) { return; } ...
2cb84e92-1310-46d0-8631-e74baf27e5bd
{ "language": "C++" }
```c++ #include <QtCore/QCoreApplication> #include <QtCore/QDebug> #include <QtCore/QTimer> #include <QtDBus/QtDBus> #include <QtTest/QtTest> #include <tests/lib/test.h> class TestDoNothing : public Test { Q_OBJECT public: TestDoNothing(QObject *parent = 0) : Test(parent) { } private slots: ...
```c++ #include <QtCore/QCoreApplication> #include <QtCore/QDebug> #include <QtCore/QTimer> #include <QtDBus/QtDBus> #include <QtTest/QtTest> #include <tests/lib/test.h> class TestDoNothing : public Test { Q_OBJECT public: TestDoNothing(QObject *parent = 0) : Test(parent) { } private Q_SLOTS: ...
acc47db5-6227-4350-900d-92d1673f653d
{ "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. // Calculate Crc by calling CRC method in LZMA SDK #include "courgette/crc.h" extern "C" { #include "third_party/lzma_sdk/7zCrc.h" } namespa...
```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 "courgette/crc.h" #ifdef COURGETTE_USE_CRC_LIB # include "zlib.h" #else extern "C" { # include "third_party/lzma_sdk/7zCrc.h" } #en...
8f725d53-7925-4f1c-a344-33f462a258ef
{ "language": "C++" }
```c++ // RUN: rm -rf %t // RUN: %clang_cc1 -fsyntax-only -verify %s -fmodules -fmodules-cache-path=%t -I%S/Inputs/PR28438 -fimplicit-module-maps #include "a.h" #include "b2.h" #pragma clang __debug macro FOO FOO // xpected-no-diagnostics ``` Remove debugging aids from this test and fix its expectations.
```c++ // RUN: rm -rf %t // RUN: %clang_cc1 -fsyntax-only -verify %s -fmodules -fmodules-cache-path=%t -I%S/Inputs/PR28438 -fimplicit-module-maps #include "a.h" #include "b2.h" FOO // expected-no-diagnostics ```
ed6ef5b2-756c-490e-b706-010c98d9dba9
{ "language": "C++" }
```c++ /** * @copyright Copyright 2017 The J-PET Framework 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 find a copy of the License in the LICENCE file. * * Unless required by applica...
```c++ /** * @copyright Copyright 2017 The J-PET Framework 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 find a copy of the License in the LICENCE file. * * Unless required by applica...
6eabd2cb-cf25-483b-a91f-05c1509c39ef
{ "language": "C++" }
```c++ #include <string.h> #include "tree_sitter/runtime.h" void test_log(void *payload, TSLogType type, const char *string) { } TSLogger logger = { .log = test_log, }; extern "C" const TSLanguage *TS_LANG(); extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { const char *str = reinterpret...
```c++ #include <string.h> #include "tree_sitter/runtime.h" void test_log(void *payload, TSLogType type, const char *string) { } TSLogger logger = { .log = test_log, }; extern "C" const TSLanguage *TS_LANG(); extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { const char *str = reinterpret...
635fab2e-38bf-49da-a4a4-01cec2cda0e6
{ "language": "C++" }
```c++ /* * Podrios.cpp * * Created on: 2014年10月23日 * Author: nemo */ #include <iostream> using namespace std; int main() { cout << "Show Message." << endl; return 0; } ``` Add system command for holding command console
```c++ /* * Podrios.cpp * * Created on: 2014年10月23日 * Author: nemo */ #include <iostream> #include <stdlib.h> using namespace std; int main() { cout << "Show Message." << endl; system("pause"); return 0; }```
ee7a5cb7-aa08-4780-81e9-9d2227d53384
{ "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...
92fa4fdd-3b1f-489f-b8e4-8db12c69896d
{ "language": "C++" }
```c++ #include <stdio.h> #include <Halide.h> using namespace Halide; int main(int argc, char **argv) { Var x, y; Var xo, xi, yo, yi; Func f, g; printf("Defining function...\n"); f(x, y) = cast<float>(x); g(x, y) = f(x+1, y) + f(x-1, y); Target target = get_jit_target_from_environment(...
```c++ #include <stdio.h> #include <Halide.h> using namespace Halide; int main(int argc, char **argv) { Var x, y; Var xo, xi, yo, yi; Func f, g; printf("Defining function...\n"); f(x, y) = cast<float>(x); g(x, y) = f(x+1, y) + f(x-1, y); Target target = get_jit_target_from_environment(...
4909a00c-cca8-4cd5-a894-5f416ad49168
{ "language": "C++" }
```c++ #include "Precompiled.hpp" #include "Error.hpp" #include "SmartPtr.hpp" #include "String.hpp" std::string errno_string(int err) { char buffer[1024]; if (!strerror_s(buffer, sizeof(buffer), err)) throw std::runtime_error("strerror_s failed"); return buffer; } #ifdef _WIN32 std::string win_error_str...
```c++ #include "Precompiled.hpp" #include "Error.hpp" #include "SmartPtr.hpp" #include "String.hpp" std::string errno_string(int err) { char buffer[1024]; #ifdef _WIN32 if (!strerror_s(buffer, sizeof(buffer), err)) throw std::runtime_error("strerror_s failed"); return buffer; #else return strerror_r(e...
9da67be5-50df-4cf2-b6fc-c865d2f9f358
{ "language": "C++" }
```c++ #include "properties.h" #include <QHeaderView> Properties::Properties(QWidget* parent) : QTreeWidget(parent) { setRootIsDecorated(false); headerItem()->setText(0, "item"); headerItem()->setText(1, "value"); headerItem()->setFirstColumnSpanned(false); header()->setStretchLastSection(true); } void Propert...
```c++ #include "properties.h" #include <QHeaderView> Properties::Properties(QWidget* parent) : QTreeWidget(parent) { setRootIsDecorated(false); headerItem()->setText(0, "item"); headerItem()->setText(1, "value"); headerItem()->setFirstColumnSpanned(false); header()->setStretchLastSection(true); } void Propert...
72c12a4a-94b8-45b3-aa60-aff6616a13df
{ "language": "C++" }
```c++ #include <openssl/eng_ossl.h> /** * Look for an OpenSSL-suported stream cipher (ARC4) */ StreamCipher* OpenSSL_Engine::find_stream_cipher(const std::string& algo_spec) const { SCAN_Name request(algo_spec); if(request.algo_name() == "ARC4") return new ARC4_OpenSSL(request.argument_as_u32bit(0, 0...
```c++ /** OpenSSL Engine (C) 2008 Jack Lloyd */ #include <botan/eng_ossl.h> namespace Botan { /** * Look for an OpenSSL-suported stream cipher (ARC4) */ StreamCipher* OpenSSL_Engine::find_stream_cipher(const std::string& algo_spec) const { SCAN_Name request(algo_spec); if(request.algo_name() == "ARC4") ...
52e4afef-145b-4aba-a525-75350a910fca
{ "language": "C++" }
```c++ // RUN: %clang -g -S -emit-llvm %s -o - | FileCheck %s namespace A { int i; } // CHECK: [[FILE:![0-9]*]] = {{.*}} ; [ DW_TAG_file_type ] [{{.*}}/test/CodeGenCXX/debug-info-namespace.cpp] // CHECK: [[VAR:![0-9]*]] = {{.*}}, metadata [[NS:![0-9]*]], metadata !"i", {{.*}} ; [ DW_TAG_variable ] [i] // CHECK: [[NS...
```c++ // RUN: %clang -g -S -emit-llvm %s -o - | FileCheck %s namespace A { #line 1 "foo.cpp" namespace B { int i; } } // CHECK: [[FILE:![0-9]*]] = {{.*}} ; [ DW_TAG_file_type ] [{{.*}}/test/CodeGenCXX/debug-info-namespace.cpp] // CHECK: [[VAR:![0-9]*]] = {{.*}}, metadata [[NS:![0-9]*]], metadata !"i", {{.*}} ; [ DW...
a53c3ca3-7af9-40ab-841c-704d9839d2ac
{ "language": "C++" }
```c++ #include <ctime> class util { public: int static GetTimestamp() { return std::time(0); } void static OpenUrl(String url) { system("open " + url); } }; ``` Fix the native part of Util.OpenUrl
```c++ #include <ctime> class util { public: int static GetTimestamp() { return std::time(0); } void static OpenUrl(const String url) { String cmd("open "); cmd += url; system(cmd.ToCString<char>()); } }; ```
3671c94a-0488-4f21-ae1c-92f7db1acb7c
{ "language": "C++" }
```c++ #include "main.h" #include "EventHandler.h" #include "PythonModule.h" extern "C" EXPORT unsigned int VcmpPluginInit(PluginFuncs* pluginFunctions, PluginCallbacks* pluginCallbacks, PluginInfo* pluginInfo) { pluginInfo->pluginVersion = 0x103; pluginInfo->apiMajorVersion = PLUGIN_API_MAJOR; pluginInfo->apiMinor...
```c++ #include "main.h" #include "EventHandler.h" #include "PythonModule.h" extern "C" EXPORT uint32_t VcmpPluginInit(PluginFuncs* pluginFunctions, PluginCallbacks* pluginCallbacks, PluginInfo* pluginInfo) { pluginInfo->pluginVersion = 0x103; pluginInfo->apiMajorVersion = PLUGIN_API_MAJOR; pluginInfo->apiMinorVers...
e27c4fe2-b5a2-4533-81af-cd64c614aaad
{ "language": "C++" }
```c++ #include "task_simple.h" #include "factory_simple.h" #include "on_tick_simple.h" #include <fstream> using namespace std; int main(int argc, char *argv[]) { const string task_fname = "task_list.txt"; const size_t concurrency = 2; ifstream task_stream{task_fname}; TaskListSimple task_list{task_...
```c++ #include "task_simple.h" #include "factory_simple.h" #include "on_tick_simple.h" #include <fstream> #include <iostream> using namespace std; int main(int argc, char *argv[]) { const string task_fname = "task_list.txt"; const size_t concurrency = 2; ifstream task_stream{task_fname}; if ( !task...
e6234dd5-1941-4cc2-bdd2-81daa2cca550
{ "language": "C++" }
```c++ // // main.cpp // // Created on: 17 Mar 2015 // Author: Guotai Wang // // Copyright (c) 2014-2016 University College London, United Kingdom. All rights reserved. // http://cmictig.cs.ucl.ac.uk // // Distributed under the BSD-3 licence. Please see the file licence.txt // #include <fstream> #include <iostre...
```c++ // // main.cpp // // Created on: 17 Mar 2015 // Author: Guotai Wang // // Copyright (c) 2014-2016 University College London, United Kingdom. All rights reserved. // http://cmictig.cs.ucl.ac.uk // // Distributed under the BSD-3 licence. Please see the file licence.txt // #include <fstream> #include <iostre...
3f441aa3-3ad3-4dcf-8f6d-a1e5ced4603f
{ "language": "C++" }
```c++ //---------------------------- job_identifier.cc --------------------------- // $Id$ // Version: $Name$ // // Copyright (C) 1998, 1999, 2000, 2001, 2002 by the deal authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer //...
```c++ //---------------------------- job_identifier.cc --------------------------- // $Id$ // Version: $Name$ // // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please re...
e4b8765f-47d0-4ff1-9eaa-5f20ed0cb2af
{ "language": "C++" }
```c++ /* Copyright: © 2018 SIL International. Description: Internal keyboard class and adaptor class for the API. Create Date: 2 Oct 2018 Authors: Tim Eves (TSE) History: 7 Oct 2018 - TSE - Refactored out of km_kbp_keyboard_api.cpp */ #include "keyboard.hpp" #include "json.hpp" using namespa...
```c++ /* Copyright: © 2018 SIL International. Description: Internal keyboard class and adaptor class for the API. Create Date: 2 Oct 2018 Authors: Tim Eves (TSE) History: 7 Oct 2018 - TSE - Refactored out of km_kbp_keyboard_api.cpp */ #include "keyboard.hpp" #include "json.hpp" using namespa...
87b3cb9a-e596-4e95-842e-97698a761cb9
{ "language": "C++" }
```c++ #include <iostream> #include <boost/log/common.hpp> #include <boost/log/expressions.hpp> #include <boost/log/utility/setup/file.hpp> #include <boost/log/trivial.hpp> #ifdef HAVE_CONFIG_H #include "config.h" #endif namespace expr = boost::log::expressions; namespace keywords = boost::log::keywords; int main(i...
```c++ #include <iostream> #include <boost/date_time/posix_time/posix_time_types.hpp> #include <boost/log/common.hpp> #include <boost/log/expressions.hpp> #include <boost/log/utility/setup/file.hpp> #include <boost/log/trivial.hpp> #include <boost/log/support/date_time.hpp> #include <boost/log/utility/setup/common_attr...
5afcb3c7-8cd5-4541-ba6e-2d2b8bfe814a
{ "language": "C++" }
```c++ /*----------------------------------------*/ // Test receiving messages from master // // This receives a message from master (command 0x01), // which tells it to turn an LED on or off. // /*----------------------------------------*/ #include <stdint.h> #include "MultidropSlave.h" #include "MultidropDataUart.h...
```c++ /*----------------------------------------*/ // Test receiving messages from master // // This receives a message from master (command 0x01), // which tells it to turn an LED on or off. // /*----------------------------------------*/ #include <stdint.h> #include "MultidropSlave.h" #include "MultidropDataUart.h...
ca82ce1a-68c0-45d4-b10d-be3f66e1019c
{ "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, ...
f3033b36-0a38-4e55-864a-2300cd026336
{ "language": "C++" }
```c++ #include <iostream> using std::cout; using std::endl; #include "problems/Factory.h" #include "util/Timer.h" using util::Timer; int main(int argc, char **argv) { auto problem = problems::Factory::create(1); Timer t; t.start(); for (int i = 0; i < 1000000; ++i) problem->solve(); t.stop(); cou...
```c++ #include <iostream> using std::cout; using std::endl; #include "problems/Factory.h" #include "util/Timer.h" using util::Timer; int main(int argc, char **argv) { auto problem = problems::Factory::create(1); Timer t; t.start(); problem->solve(); t.stop(); cout << problem->answer() << endl; cout...
2f532efa-4d9a-42f9-a076-0aa0849dc07d
{ "language": "C++" }
```c++ #include <iostream> #include "cons.h" #include "error.h" #include "eval.h" #include "init.h" #include "load.h" #include "reader.h" #include "utils.h" namespace { class Repl { std::istream& in_; std::ostream& out_; std::string prompt_ = "mclisp> "; mclisp::Reader reader_; public: explicit Repl(s...
```c++ #include <iostream> #include "cons.h" #include "error.h" #include "eval.h" #include "init.h" #include "load.h" #include "reader.h" #include "utils.h" namespace { class Repl { std::istream& in_; std::ostream& out_; std::string prompt_ = "mclisp> "; mclisp::Reader reader_; public: explicit Repl(s...
95d6811c-b71d-40ac-b45a-2912932493dd
{ "language": "C++" }
```c++ #include "RequestParser.h" #include <sstream> #include <vector> std::vector<std::string> ApiMock::RequestParser::projectToCollection(std::string const& request) { std::vector<std::string> fromRequest; std::string::size_type pos = 0; std::string::size_type prev = 0; while ((pos = request.find('\n', prev)) !...
```c++ #include "RequestParser.h" #include <sstream> #include <vector> std::vector<std::string> ApiMock::RequestParser::projectToCollection(std::string const& request) { const std::string CRLF = "\r\n"; std::vector<std::string> fromRequest; std::string::size_type pos = 0; std::string::size_type prev = 0; while (...
a99de2af-4d9d-4b7a-8f0f-81da166a0fd2
{ "language": "C++" }
```c++ #include <iostream> #include "rapidcheck/detail/NonRandomData.h" namespace rc { RandomData::RandomData(const uint8_t *Data, size_t Size) { std::cout << Data << std::endl; // TODO: really stupid way to fill the container const size_t size64 = Size / 8; auto Data64 = reinterpret_cast<const uint64_t *>(Da...
```c++ #include <iostream> #include "rapidcheck/detail/NonRandomData.h" namespace rc { RandomData::RandomData(const uint8_t *Data, size_t Size) { // TODO: really stupid way to fill the container const size_t size64 = Size / 8; auto Data64 = reinterpret_cast<const uint64_t *>(Data); for (size_t i = 0; i < size...
398b5165-0198-45b3-9fc7-55916fece6bb
{ "language": "C++" }
```c++ #include <iostream> using namespace std; int main() { cout << "Hello World!" << endl; return 0; } ``` Add basic thresholding of green markers
```c++ #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <iostream> using namespace cv; using namespace std; int main(int argc, char** argv) { VideoCapture cap(0); namedWindow("MyVideo", CV_WINDOW_AUTOSIZE); int w = cap.get(CV_CAP_PRO...
ecbfc697-e780-4f36-ac82-7d2d052d15e6
{ "language": "C++" }
```c++ #include "board.h" #include <aery32/gpio.h> #include <aery32/delay.h> #include <aery32/intc.h> using namespace aery; void isrhandler_group2(void) { gpio_toggle_pin(LED); delay_ms(100); /* Reduce glitch */ porta->ifrc = (1 << 0); /* Remember to clear the interrupt */ } int main(void) { init_board(); /* G...
```c++ #include "board.h" #include <aery32/gpio.h> #include <aery32/delay.h> #include <aery32/intc.h> using namespace aery; void isrhandler_group2(void) { gpio_toggle_pin(LED); delay_ms(100); /* Reduce glitches */ porta->ifrc = (1 << 0); /* Remember to clear the interrupt */ } int main(void) { init_board(); /*...
814f120f-d05e-4863-8e0d-35f8a2c151d3
{ "language": "C++" }
```c++ // This code is based on Sabberstone project. // Copyright (c) 2017-2019 SabberStone Team, darkfriend77 & rnilva // RosettaStone is hearthstone simulator using C++ with reinforcement learning. // Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon #include <Rosetta/Tasks/SimpleTasks/ControlTask.hpp> #i...
```c++ // This code is based on Sabberstone project. // Copyright (c) 2017-2019 SabberStone Team, darkfriend77 & rnilva // RosettaStone is hearthstone simulator using C++ with reinforcement learning. // Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon #include <Rosetta/Tasks/SimpleTasks/ControlTask.hpp> #i...
8452a0e4-3a80-47d7-8605-894fcefbf216
{ "language": "C++" }
```c++ #include "Boot.hpp" using namespace HomieInternals; Boot::Boot(const char* name) : _name(name) { } void Boot::setup() { if (Interface::get().led.enabled) { pinMode(Interface::get().led.pin, OUTPUT); digitalWrite(Interface::get().led.pin, !Interface::get().led.on); } WiFi.persistent(true); // ...
```c++ #include "Boot.hpp" using namespace HomieInternals; Boot::Boot(const char* name) : _name(name) { } void Boot::setup() { if (Interface::get().led.enabled) { pinMode(Interface::get().led.pin, OUTPUT); digitalWrite(Interface::get().led.pin, !Interface::get().led.on); } WiFi.persistent(true); // ...
d7389a0c-b892-4b6a-a11d-2754aef4a612
{ "language": "C++" }
```c++ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: TreeNode* sortedArrayToBST(vector<int>& nums) { if(nums.size()==0) return NULL; ...
```c++ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: TreeNode* sortedArrayToBST(vector<int>& nums) { if(nums.size()==0) return NULL;...