doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
76975de1-1686-4018-86ad-91f4e963aedd
{ "language": "C++" }
```c++ // Standard headers #include "InputArgs.hpp" InputArgs::InputArgs(int argc, char const *const *argv) : argstream(argv, argv + argc) { read_input(); process_input(); } void InputArgs::process_input() { if (n_threads == 0) n_threads = std::thread::hardware_concurrency(); } void InputArgs::read_inp...
```c++ // Standard headers #include "InputArgs.hpp" InputArgs::InputArgs(int argc, char const *const *argv) : argstream(argv, argv + argc) { read_input(); process_input(); } void InputArgs::process_input() { if (n_threads == 0) n_threads = std::thread::hardware_concurrency(); } void InputArgs::read_inp...
918a3ebc-3ca2-48a9-ba0e-06c45e0e0869
{ "language": "C++" }
```c++ #include "misc_util.h" namespace dlib { void string_fmt_time(std::string& ret) { time_t now = time(NULL); struct tm *t = localtime(&now); while(!strftime((char *)ret.data(), ret.capacity(), "%Y:%m:%d %H:%M", t)) ret.reserve(ret.size() << 1); } } ``` Fix mistake of ...
```c++ #include "misc_util.h" namespace dlib { void string_fmt_time(std::string& ret) { time_t now = time(NULL); struct tm *t = localtime(&now); while(!strftime((char *)ret.data(), ret.capacity(), "%Y:%m:%d %H:%M", t)) ret.reserve(ret.capacity() ? ret.capacity() << 1: 16); ...
98e99497-d6de-448b-949e-999b6581d4a0
{ "language": "C++" }
```c++ #include <iostream> #include <fstream> #include "huffman.hpp" using namespace algorithm; static enum { E_SUCCESS = 0, E_ARGUMENT_NOT_PROVIDED, E_FILE_NOT_FOUND, } StatusType; int main(const int argc, const char * argv[]) { if(argc < 2) { fprintf(stderr, "Usage: %s [file name]\n", a...
```c++ #include <iostream> #include <fstream> #include "include/huffman.hpp" using namespace algorithm; static enum { E_SUCCESS = 0, E_ARGUMENT_NOT_PROVIDED, E_FILE_NOT_FOUND, } StatusType; int main(const int argc, const char * argv[]) { if(argc < 2) { fprintf(stderr, "Usage: %s [file nam...
174de2f0-8739-4365-8d4b-fbc7527b0e3c
{ "language": "C++" }
```c++ int main(int argc, char **argv) { return 0; } ``` Add execution of simple programs
```c++ #include <sys/types.h> #include <sys/wait.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sysexits.h> #include <unistd.h> char* getinput(char *buffer, size_t buflen) { printf("$$ "); return fgets(buffer, buflen, stdin); } int main(int argc, char **argv) { char b...
ec4811c1-cda5-4902-9d7b-1e7dafd9e6fb
{ "language": "C++" }
```c++ // https://github.com/KubaO/stackoverflown/tree/master/questions/lambda-list-37615204 #include <QtWidgets> class Widget : public QWidget { struct Buyable { void buy(int) const {} }; QList<Buyable> m_list; QList<QList<QWidget*>> m_widgets; int m_amountMultiplier = 2; public: Widget() { ...
```c++ // https://github.com/KubaO/stackoverflown/tree/master/questions/lambda-list-37615204 #include <QtWidgets> struct Building { void buy() {} }; class Class : public QObject { QList<Building> m_buildings; QList<QList<QWidget*>> m_widgets; public: Class() { for (int i = 0; i<m_buildings.size(); +...
5e8634d9-064f-429d-849a-f4d54cbd29b4
{ "language": "C++" }
```c++ #include "scene.h" #include "mesh.h" #include "material.h" #include <glm/gtc/matrix_transform.hpp> #include <assimp/Importer.hpp> #include <assimp/scene.h> #include <assimp/postprocess.h> Scene::Scene() { } Scene::~Scene() { for(auto it = m_meshes.begin(); it != m_meshes.end(); ++it) { delete ...
```c++ #include "scene.h" #include "mesh.h" #include "material.h" #include <glm/gtc/matrix_transform.hpp> #include <assimp/Importer.hpp> #include <assimp/scene.h> #include <assimp/postprocess.h> Scene::Scene() { } Scene::~Scene() { for(auto it = m_meshes.begin(); it != m_meshes.end(); ++it) { delete ...
baed3d75-da70-4b69-83ec-fb33b4fbf3e6
{ "language": "C++" }
```c++ // This file extends the QWebView class to add additional functionality. #include "stdafx.h" using namespace std; void QWebViewWithHooks::watch(string selector, Getter getter, Callback callback){ int uuid = watchUuid++; watches.push_back(make_tuple(QString::fromStdString(selector), getter, callback, uuid) ); ...
```c++ // This file extends the QWebView class to add additional functionality. #include "stdafx.h" using namespace std; void QWebViewWithHooks::watch(string selector, Getter getter, Callback callback){ int uuid = watchUuid++; watches.push_back(make_tuple(QString::fromStdString(selector), getter, callback, uuid) ); ...
d5f38d77-9801-401e-8ab2-7c0d65ec58bb
{ "language": "C++" }
```c++ /* * Chemharp, an efficient IO library for chemistry file formats * Copyright (C) 2015 Guillaume Fraux * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/ */ ...
```c++ /* * Chemharp, an efficient IO library for chemistry file formats * Copyright (C) 2015 Guillaume Fraux * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/ */ ...
7bb84de1-0817-4e04-9ac2-f2b1decb386b
{ "language": "C++" }
```c++ /* * URELogger.cc * * Copyright (C) 2016 OpenCog Foundation * * Author: Nil Geisweiller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License v3 as * published by the Free Software Foundation and including the exceptions *...
```c++ /* * URELogger.cc * * Copyright (C) 2016 OpenCog Foundation * * Author: Nil Geisweiller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License v3 as * published by the Free Software Foundation and including the exceptions *...
c670df62-a5f8-4675-a528-c4cfbe855c57
{ "language": "C++" }
```c++ #include <iostream> using namespace std; class BankAccount { char clientName[23]; char id[15]; double account; public: BankAccount(const char _clientName[], const char _id[], double _account) { strcpy(clientName, _clientName); strcpy(id, _id); account = _account; } void print() { ...
```c++ #include <iostream> using namespace std; class BankAccount { char clientName[23]; char id[15]; double account; public: BankAccount(const char _clientName[], const char _id[], double _account) { strcpy(clientName, _clientName); strcpy(id, _id); account = _account; } void print() { ...
8fbc4fb5-d555-40ec-9d21-959a74d6313a
{ "language": "C++" }
```c++ /** * \file tiles_costs.cpp * * * * \author eaburns * \date 05-01-2010 */ #include <string> #include <iostream> using namespace std; #include <stdlib.h> #include <string.h> #include "tiles_costs.h" struct cost_tab_ent { string name; TilesCostFunction &fun; }; static TilesUnitCost unit_cost = Tiles...
```c++ /** * \file tiles_costs.cpp * * * * \author eaburns * \date 05-01-2010 */ #include <string> #include <iostream> using namespace std; #include <stdlib.h> #include <string.h> #include "tiles_costs.h" struct cost_tab_ent { string name; TilesCostFunction &fun; }; static TilesUnitCost unit_cost = Tiles...
49bd586d-ce84-48ed-9b49-fbab61687782
{ "language": "C++" }
```c++ #include "google/gtest/gtest.h" int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } ``` Test cases print stack trace on sigsegv
```c++ #include "google/gtest/gtest.h" #include <messmer/cpp-utils/assert/backtrace.h> int main(int argc, char **argv) { cpputils::showBacktraceOnSigSegv(); testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } ```
56fb846a-2363-4330-baf4-f640ef71d4f4
{ "language": "C++" }
```c++ /* * This file is part of Maliit framework * * * Copyright (C) 2014 Dinesh Manajipet <saidinesh5@gmail.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 * an...
```c++ /* * This file is part of Maliit framework * * * Copyright (C) 2014 Dinesh Manajipet <saidinesh5@gmail.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 * an...
8d8af285-794f-4aa2-8d62-c0d5176a0e5e
{ "language": "C++" }
```c++ #include "MMU.hpp" #include <iterator> #include <limits> namespace Core8 { Chip8::BYTE MMU::readByte(const std::size_t address) const { const auto byte = memory.at(address); return byte; } Chip8::WORD MMU::readWord(const std::size_t address) const { const auto msb = memory.at(address) << std::numeric_...
```c++ #include "MMU.hpp" #include <algorithm> #include <iterator> #include <limits> #include <vector> namespace Core8 { Chip8::BYTE MMU::readByte(const std::size_t address) const { const auto byte = memory.at(address); return byte; } Chip8::WORD MMU::readWord(const std::size_t address) const { const auto ms...
8836ebde-9422-482b-b305-04eb53b62359
{ "language": "C++" }
```c++ // Copyright (C) 2017 Elviss Strazdins // This file is part of the Ouzel engine. #ifdef _WIN32 #define NOMINMAX #include <winsock2.h> #else #include <sys/socket.h> #include <netinet/in.h> #include <poll.h> #endif #include "Network.hpp" #include "utils/Log.hpp" namespace ouzel { namespace network { ...
```c++ // Copyright (C) 2017 Elviss Strazdins // This file is part of the Ouzel engine. #ifdef _WIN32 #define NOMINMAX #include <winsock2.h> #else #include <sys/socket.h> #include <netinet/in.h> #include <poll.h> #endif #include "Network.hpp" #include "utils/Log.hpp" namespace ouzel { namespace network { ...
3d7d036d-9b33-4f37-8743-f308ed2833bd
{ "language": "C++" }
```c++ #include <SFML/Graphics.hpp> #include <SFML/System/Clock.hpp> #include <iostream> int main() { sf::RenderWindow window(sf::VideoMode(800,600), "Psychic Dangerzone"); window.setVerticalSyncEnabled(true); sf::Clock world_clock; float last_frame_time; while(window.isOpen()) { last_fr...
```c++ #include <SFML/Graphics.hpp> #include <SFML/System/Clock.hpp> #include <iostream> int main() { sf::RenderWindow window(sf::VideoMode(800,600), "Psychic Dangerzone"); window.setVerticalSyncEnabled(true); sf::Clock world_clock; sf::CircleShape player(50); float last_frame_time; while(w...
176ca1d5-050c-4b85-bd74-7e6a5d68b9ac
{ "language": "C++" }
```c++ #include "gtest/gtest.h" #include "lms/endian.h" TEST(Endian, uint16) { using lms::Endian; ASSERT_EQ(uint16_t(0xCAFEu), Endian::betoh(Endian::htobe(uint16_t(0xCAFEu)))); ASSERT_EQ(uint16_t(0xCAFEu), Endian::letoh(Endian::htole(uint16_t(0xCAFEu)))); } TEST(Endian, uint32) { using lms::Endian; ...
```c++ #include "gtest/gtest.h" #include "lms/endian.h" TEST(Endian, uint16) { using lms::Endian; ASSERT_EQ(0xFECAu, Endian::letoh(Endian::htobe(uint16_t(0xCAFEu)))); ASSERT_EQ(0xFECAu, Endian::betoh(Endian::htole(uint16_t(0xCAFEu)))); } TEST(Endian, uint32) { using lms::Endian; ASSERT_EQ(0xEFBEAD...
693eb0d4-5938-4fe6-9abb-f6421bed8337
{ "language": "C++" }
```c++ #include "linalg/ray.h" #include "geometry/differential_geometry.h" #include "geometry/geometry.h" #include "scene.h" #include "integrator/surface_integrator.h" #include "renderer/renderer.h" Renderer::Renderer(std::unique_ptr<SurfaceIntegrator> surface_integrator) : surface_integrator(std::move(surface_integr...
```c++ #include "linalg/ray.h" #include "geometry/differential_geometry.h" #include "geometry/geometry.h" #include "scene.h" #include "integrator/surface_integrator.h" #include "renderer/renderer.h" Renderer::Renderer(std::unique_ptr<SurfaceIntegrator> surface_integrator) : surface_integrator(std::move(surface_integr...
ee8f8762-052a-467b-936b-b4bf544b8ba9
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s // Verify that we can't initialize non-aggregates with an initializer // list. struct NonAggr1 { NonAggr1(int) { } int m; }; struct Base { }; struct NonAggr2 : public Base { int m; }; class NonAggr3 { int m; }; struct NonAggr4 { int m; virt...
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s // Verify that we can't initialize non-aggregates with an initializer // list. struct NonAggr1 { NonAggr1(int) { } int m; }; struct Base { }; struct NonAggr2 : public Base { int m; }; class NonAggr3 { int m; }; struct NonAggr4 { int m; virt...
3a84ccd2-8636-44ac-9f5c-7c0ad3657282
{ "language": "C++" }
```c++ #include "generator.h" #include <iostream> #include <fstream> using namespace Mugen; CharacterGenerator::CharacterGenerator(const std::string & filename): filename(filename){ } CharacterGenerator::~CharacterGenerator(){ } void CharacterGenerator::output(const std::string & file){ Mugen::PythonStream out...
```c++ #include "generator.h" #include <iostream> #include <fstream> using namespace Mugen; CharacterGenerator::CharacterGenerator(const std::string & filename): filename(filename){ } CharacterGenerator::~CharacterGenerator(){ } void CharacterGenerator::output(const std::string & file){ Mugen::PythonStream out...
0ff09d15-8e1d-43b1-8a69-ab7dbf0d816f
{ "language": "C++" }
```c++ #include <istream> #include <fstream> #include <set> #include <vector> #include <array> #include <algorithm> #include <iterator> using namespace std; int main() { ifstream cin("combo.in"); ofstream cout("combo.out"); int size; cin >> size; set<int> options; for (int i = 0; i < 2; i++) { int a, b, c; ...
```c++ #include <fstream> #include <set> using namespace std; int main() { ifstream cin("combo.in"); ofstream cout("combo.out"); int size; cin >> size; set<int> options; for (int i = 0; i < 2; i++) { int a, b, c; cin >> a >> b >> c; // creates permutations of allowable combinations and turns them into ...
1898f7ab-ed6d-4817-bf6a-cf80a8d2db53
{ "language": "C++" }
```c++ /* * ModSecurity, http://www.modsecurity.org/ * Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the fil...
```c++ /* * ModSecurity, http://www.modsecurity.org/ * Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the fil...
5be3ab7d-8ec4-4925-b52f-ad1f37d463d4
{ "language": "C++" }
```c++ // RUN: clang-diff -ast-dump %s -- \ // RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ // RUN: | FileCheck %s // CHECK: "begin": 294, // CHECK: "type": "CXXRecordDecl", // CHECK: "type": "FieldDecl", // CHECK: "end": 314, class A { int x; ...
```c++ // RUN: clang-diff -ast-dump %s -- \ // RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ // RUN: | FileCheck %s // CHECK: "begin": 294, // CHECK: "type": "CXXRecordDecl", // CHECK: "type": "FieldDecl", // CHECK: "end": 314, class A { int x; ...
93914461-26c2-43b9-a2dd-410eed00d388
{ "language": "C++" }
```c++ /* // This file is part of SnakePredictor // // (c) Daniel McAssey <hello@glokon.me> // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. */ // stdafx.cpp : source file that includes just the standard includes // CallWinsock.pch will b...
```c++ /* // This file is part of SnakePredictor // // (c) Daniel McAssey <hello@glokon.me> // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. */ // stdafx.cpp : source file that includes just the standard includes // SnakePredictor.pch wil...
1763d2ac-d5e3-4233-8f6b-05ec7268b5bc
{ "language": "C++" }
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "datastore.h" using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert; namespace YouDataStoreTests { TEST_CLASS(DataStoreApiTest) { public: TEST_METHOD(DataStoreDummyTest) { // You::DataStore::DataStore sut; // sut.post(std::unordered_map...
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "datastore.h" using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert; using DataStore = You::DataStore::DataStore; namespace YouDataStoreTests { TEST_CLASS(DataStoreApiTest) { public: TEST_METHOD(DataStore_Post_Basic_Test) { You::DataStore...
5c0dba3c-2e3c-4800-9e49-ae20e6e74a9e
{ "language": "C++" }
```c++ #include <ionWindow.h> #include <ionGraphicsGL.h> using namespace ion; int main() { Log::AddDefaultOutputs(); SingletonPointer<CWindowManager> WindowManager; SingletonPointer<CGraphicsAPI> GraphicsAPI; GraphicsAPI->Init(new Graphics::COpenGLImplementation()); WindowManager->Init(Graphic...
```c++ #include <ionWindow.h> #include <ionGraphicsGL.h> using namespace ion; int main() { Log::AddDefaultOutputs(); Log::Info("Info"); Log::Warn("Warning"); Log::Error("Error"); SingletonPointer<CWindowManager> WindowManager; SingletonPointer<CGraphicsAPI> GraphicsAPI; GraphicsAPI->Init...
dab3bc01-70c0-4f88-a3f5-9fe1d440bc29
{ "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...
9bdcd700-b465-4559-9a92-5e932ec0b7ec
{ "language": "C++" }
```c++ #include <boost/config.hpp> struct Foo { char x; #include <leathers/push> #include <leathers/padded> long y; #include <leathers/pop> }; int main() { // struct Foo must be used, otherwise there will be no warning (clang) return static_cast<int>(Foo().y); } ``` Check SHOW_WARNINGS macro in...
```c++ #include <boost/config.hpp> struct Foo { char x; #include <leathers/push> #if !defined(SHOW_WARNINGS) # include <leathers/padded> #endif long y; #include <leathers/pop> }; int main() { // struct Foo must be used, otherwise there will be no warning (clang) return static_cast<int>(Foo().y);...
e7eff9ab-6845-499c-af07-b08da0d41489
{ "language": "C++" }
```c++ // Copyright (c) 2018 Chris Ohk, Youngjoong Kim, SeungHyun Jeon // We are making my contributions/submissions to this project solely in our // personal capacity and are not conveying any rights to any intellectual // property of any third parties. #include <Utils/TestUtils.hpp> #include "gtest/gtest.h" #inclu...
```c++ // Copyright (c) 2018 Chris Ohk, Youngjoong Kim, SeungHyun Jeon // We are making my contributions/submissions to this project solely in our // personal capacity and are not conveying any rights to any intellectual // property of any third parties. #include <Utils/TestUtils.hpp> #include "gtest/gtest.h" #inclu...
33b1a351-219e-407d-a45e-8e0537495a7c
{ "language": "C++" }
```c++ #include <avr/io.h> #include "lcd.h" LCD5110 myGLCD; void LCD_init(void) { /* Set MOSI and SCK output */ DDRB |= (1<<PB3)|(1<<PB5); /* Enable SPI, Master, CPOL=1, CPHA=1 */ /* Also: MSB first, clock=fosc/4 */ SPCR = (1<<SPE)|(1<<MSTR)|(1<<CPOL)|(1<<CPHA) | 3; /* Set the pins for DC, RST and CS t...
```c++ #include <avr/io.h> #include "lcd.h" LCD5110 myGLCD; void LCD_init(void) { /* Set MOSI and SCK output */ DDRB |= (1<<PB3)|(1<<PB5); /* Enable SPI, Master, CPOL=1, CPHA=1 */ /* Also: MSB first, clock=fosc/4 */ SPCR = (1<<SPE)|(1<<MSTR)|(1<<CPOL)|(1<<CPHA) | (1<<SPR0); /* Set the pins for DC, RST ...
267e6eef-dc9f-40ed-a79b-e1b53928cee1
{ "language": "C++" }
```c++ #include "chunk.hpp" #include "chunk_master.hpp" #include "code/ylikuutio/hierarchy/hierarchy_templates.hpp" namespace yli { namespace ontology { void Chunk::bind_to_parent() { // requirements: // `this->parent` must not be `nullptr`. yli::ontology::Ch...
```c++ #include "chunk.hpp" #include "chunk_master.hpp" #include "code/ylikuutio/hierarchy/hierarchy_templates.hpp" namespace yli { namespace ontology { void Chunk::bind_to_parent() { // requirements: // `this->parent` must not be `nullptr`. yli::ontology::Ch...
42860207-ff49-401e-9f96-09e63ec683b2
{ "language": "C++" }
```c++ // Native C++ Libraries #include <iostream> #include <string> // C++ Interpreter Libraries #include <Console.h> using namespace std; int main() { } ``` Add a way of Input and program loop.
```c++ // Native C++ Libraries #include <iostream> #include <string> // C++ Interpreter Libraries #include <Console.h> using namespace std; int main() { RESTART: string input = ""; getline(cin, input); cin.ignore(); goto RESTART; } ```
17bd12d0-ca98-4043-b922-b7ec8f7fbb7a
{ "language": "C++" }
```c++ // // Copyright (c) 2002-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. // // debug.cpp: Debugging utilities. #include "compiler/translator/compilerdebug.h" #include <stdarg.h> #include <stdio.h> #in...
```c++ // // Copyright (c) 2002-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. // // debug.cpp: Debugging utilities. #include "compiler/translator/compilerdebug.h" #include <stdarg.h> #include <stdio.h> #in...
dd39202d-fffa-417e-897b-674ac5d366fb
{ "language": "C++" }
```c++ #include <miniMAT/util/NumDigits.hpp> #include <cmath> namespace miniMAT { namespace util { int NumDigits(double num) { return log10(num) + 1; } } }``` Fix bug involving printing 'zeroed' matrices
```c++ #include <miniMAT/util/NumDigits.hpp> #include <cmath> namespace miniMAT { namespace util { int NumDigits(double num) { return num == 0 ? 1 : fabs(log10(num)) + 1; } } }```
6d0a9317-5648-4473-8708-0994f0d10700
{ "language": "C++" }
```c++ #include "RestServer.h" #include <qhttpserver.hpp> #include <qhttpserverrequest.hpp> #include <qhttpserverresponse.hpp> #include <QLoggingCategory> Q_LOGGING_CATEGORY(REST, "ledify.restserver", QtWarningMsg) using namespace qhttp::server; RestServer::RestServer(QObject *parent) : QObject(parent) { m_serv...
```c++ #include "RestServer.h" #include <qhttpserver.hpp> #include <qhttpserverrequest.hpp> #include <qhttpserverresponse.hpp> #include <QLoggingCategory> Q_LOGGING_CATEGORY(REST, "ledify.restserver", QtWarningMsg) using namespace qhttp::server; RestServer::RestServer(QObject *parent) : QObject(parent) { m_serv...
e5a3c2e3-a9a8-4d57-abba-5f4448735af8
{ "language": "C++" }
```c++ //===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
fffcb9af-6848-4ff5-a630-367043bf9eae
{ "language": "C++" }
```c++ // vim:sw=2:ai /* * Copyright (C) 2010 DeNA Co.,Ltd.. All rights reserved. * See COPYRIGHT.txt for details. */ #include <stdlib.h> #include <stdio.h> #include <syslog.h> #include "fatal.hpp" namespace dena { const int opt_syslog = LOG_ERR | LOG_PID | LOG_CONS; void fatal_exit(const std::string& message...
```c++ // vim:sw=2:ai /* * Copyright (C) 2010 DeNA Co.,Ltd.. All rights reserved. * See COPYRIGHT.txt for details. */ #include <stdlib.h> #include <stdio.h> #include <syslog.h> #include <unistd.h> #include "fatal.hpp" namespace dena { const int opt_syslog = LOG_ERR | LOG_PID | LOG_CONS; void fatal_exit(const ...
6efd415f-85af-49a8-a795-8e5908fbdd2f
{ "language": "C++" }
```c++ /* * Podrios.cpp * * Created on: 2014年10月23日 * Author: nemo */ #include "GameTable/GamblingTable.h" #include <iostream> using namespace std; int main() { cout << "Start Podrios." << endl; GamblingTable *gamblingTable_Ptr = new GamblingTable(); return 0; }``` Modify the way of GambilingT...
```c++ /* * Podrios.cpp * * Created on: 2014年10月23日 * Author: nemo */ #include "GameTable/GamblingTable.h" #include <iostream> using namespace std; int main() { cout << "Start Podrios." << endl; GamblingTable gamblingTable; return 0; }```
c6af5735-0422-4bd1-b994-6d2b07b52947
{ "language": "C++" }
```c++ // Copyright (c) 2011, Christian Rorvik // Distributed under the Simplified BSD License (See accompanying file LICENSE.txt) #include "crunch/concurrency/yield.hpp" #include <windows.h> namespace Crunch { namespace Concurrency { void ThreadYield() { SwitchToThread(); } void ThreadSleep(Duration duration)...
```c++ // Copyright (c) 2011, Christian Rorvik // Distributed under the Simplified BSD License (See accompanying file LICENSE.txt) #include "crunch/concurrency/yield.hpp" #include <windows.h> namespace Crunch { namespace Concurrency { void ThreadYield() { ::SwitchToThread(); } void ThreadSleep(Duration duratio...
0af7023e-2586-4539-8679-08cc1065b042
{ "language": "C++" }
```c++ //===-- SystemInitializerLLGS.cpp -------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===-- SystemInitializerLLGS.cpp -------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
e59e56d3-d43a-4902-bd44-3f3a07c93e32
{ "language": "C++" }
```c++ // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "sky/engine/tonic/dart_invoke.h" #include "base/logging.h" #include "base/trace_event/trace_event.h" #include "sky/engine/tonic/dart_erro...
```c++ // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "sky/engine/tonic/dart_invoke.h" #include "base/logging.h" #include "base/trace_event/trace_event.h" #include "sky/engine/tonic/dart_erro...
800fbc40-a26e-463e-91dc-f83b14c93510
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple \ // RUN: -fdebug-prefix-map=%S=/SOURCE_ROOT %s -emit-llvm -o - | FileCheck %s template <typename T> void b(T) {} void c() { // CHECK: !DISubprogram(name: "b<(lambda at // CHECK-SAME: SOURCE_ROOT // CHECK-SAME: [[@...
```c++ // RUN: %clang_cc1 -std=c++14 -debug-info-kind=limited \ // RUN: -triple %itanium_abi_triple \ // RUN: -fdebug-prefix-map=%S=/SOURCE_ROOT %s -emit-llvm -o - | FileCheck %s template <typename T> void b(T) {} void c() { // CHECK: !DISubprogram(name: "b<(lambda at // CHECK-SAME: SOURCE_ROOT // C...
12dfc457-fa10-45f6-8644-b5a8a501bdf3
{ "language": "C++" }
```c++ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fno-implicit-modules -emit-module -fmodule-name=a %S/Inputs/explicit-build-prefer-self/map -o a.pcm // RUN: %clang_cc1 -fmodules -fno-implicit-modules -emit-module -fmodule-name=b %S/Inputs/explicit-build-prefer-self/map -o b.pcm ``` Write output file to temp dire...
```c++ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fno-implicit-modules -emit-module -fmodule-name=a %S/Inputs/explicit-build-prefer-self/map -o %t/a.pcm // RUN: %clang_cc1 -fmodules -fno-implicit-modules -emit-module -fmodule-name=b %S/Inputs/explicit-build-prefer-self/map -o %t/b.pcm ```
584ea846-9fde-4a14-87d0-2942438c76dd
{ "language": "C++" }
```c++ #include "AnimationProgram.h" #include "esp_log.h" static const char* TAG = "PROGRAM"; AnimationProgram::AnimationProgram(Timer &animator) : programs(), animator(animator) { } void AnimationProgram::putAnimation(uint8_t index, Animation *animation) { programs[index] = animation; } void AnimationProgram...
```c++ #include "AnimationProgram.h" #include "esp_log.h" static const char* TAG = "AnimationProgram"; AnimationProgram::AnimationProgram(Timer &animator) : programs(), animator(animator) { } void AnimationProgram::putAnimation(uint8_t index, Animation *animation) { programs[index] = animation; } void Animati...
a61d8690-1d98-4136-8f34-540713534669
{ "language": "C++" }
```c++ #include "catch.hpp" #include <lua.hpp> #include <luwra.hpp> int test_function_1(int a, int b) { return a - b; } int test_function_2(int a, int b, int c) { return a + b * c; } void test_function_3(int) { } TEST_CASE("stack_interaction") { lua_State* state = luaL_newstate(); luwra::push(state, 1); luw...
```c++ #include "catch.hpp" #include <lua.hpp> #include <luwra.hpp> static int test_function_1(int a, int b) { return a - b; } static int test_function_2(int a, int b, int c) { return a + b * c; } static void test_function_3(int) { } TEST_CASE("stack_interaction") { lua_State* state = luaL_newstate(); luwra:...
96124a2b-2364-4b42-936d-04527ba3a096
{ "language": "C++" }
```c++ #include "utils/distance.hpp" // Returns the minimum distance (straight line) between two points double distance(cv::Point one, cv::Point two) { return std::sqrt(std::pow(one.x - two.x, 2) + std::pow(one.y - two.y, 2)); } // Returns the two dimensional distance between the components of two points double d...
```c++ #include "utils/distance.hpp" // Returns the minimum distance (straight line) between two points double distance(cv::Point one, cv::Point two) { return std::sqrt(std::pow(one.x - two.x, 2) + std::pow(one.y - two.y, 2)); } double getShortestDistance (cv::Point2f rectPoints[4], double focalLen, int dist, int...
99843187-ce16-4c10-96e8-f69ce81f87fd
{ "language": "C++" }
```c++ // // Created by Adam Getchell on 2017-12-02. // #define CATCH_CONFIG_RUNNER #include <catch2/catch.hpp> int main( int argc, char* argv[] ) { Catch::Session session; // There must be exactly one instance // writing to session.configData() here sets defaults // this is the preferred way to set them ...
```c++ // // Created by Adam Getchell on 2017-12-02. // #define CATCH_CONFIG_RUNNER #include "catch.hpp" int main( int argc, char* argv[] ) { Catch::Session session; // There must be exactly one instance // writing to session.configData() here sets defaults // this is the preferred way to set them in...
977c055e-113a-49c0-82fa-f0458636780c
{ "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/automation/ui_controls.h" #include "base/logging.h" #include "views/view.h" namespace ui_controls { bool SendKeyPre...
```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/automation/ui_controls.h" #include "base/logging.h" #include "views/view.h" namespace ui_controls { bool SendKeyPre...
30739b5a-7a4e-41ed-b84c-4f792f10d83b
{ "language": "C++" }
```c++ #include "Game.hpp" namespace arduino_pong { void Game::run() { while(true) { gameField_.update(); gameField_.render(); } } } // namespace arduino_pong ``` Add implementation of a basic game loop.
```c++ #include "Game.hpp" #include <Arduino.h> namespace { constexpr uint32_t MsPerUpdate = 16; } // namespace namespace arduino_pong { void Game::run() { uint32_t previous = millis(); uint32_t lag = 0; while(true) { uint32_t current = millis(); uint32_t elapsed = current - pre...
b72eb1ae-a1a3-432e-93cc-46376edd4a61
{ "language": "C++" }
```c++ // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/history/history_publisher.h" #include "base/utf_string_conversions.h" namespace history { const char* const Hi...
```c++ // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/history/history_publisher.h" #include "base/utf_string_conversions.h" namespace history { const char* const Hi...
65c6fb19-70db-4e54-abf4-f0835db6bf09
{ "language": "C++" }
```c++ #include "client.h" #include "tests/test.h" #include <QGuiApplication> #include <QQuickView> #include <QQmlContext> #include <QtQml> #include <QUrl> int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); qmlRegisterUncreatableType<AbstractTest>("mplane", 1, 0, "AbstractTest", "abstract cl...
```c++ #include "client.h" #include "tests/test.h" #include <QGuiApplication> #include <QQuickView> #include <QQmlContext> #include <QQmlEngine> #include <QtQml> #include <QUrl> int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); qmlRegisterUncreatableType<AbstractTest>("mplane", 1, 0, "Abstr...
a29c88f4-d9a2-4cc6-b9c7-b46f7e2bea2b
{ "language": "C++" }
```c++ //======================================================================= // Copyright Baptiste Wicht 2011-2012. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //=========================================...
```c++ //======================================================================= // Copyright Baptiste Wicht 2011-2012. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //=========================================...
38b003bc-8825-459d-8e69-6d776d9b0a64
{ "language": "C++" }
```c++ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/child/file_info_util.h" #include "base/logging.h" #include "third_party/WebKit/public/platform/WebFileInfo.h" namespace content...
```c++ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/child/file_info_util.h" #include "base/logging.h" #include "third_party/WebKit/public/platform/WebFileInfo.h" namespace content...
9fc919e2-5932-4add-a26c-83aee91c613d
{ "language": "C++" }
```c++ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <util/validation.h> #include <consensus/validation.h> #include <...
```c++ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <util/validation.h> #include <consensus/validation.h> #include <...
6751eda2-ce33-4ee6-87c9-60d0c2cf9ebe
{ "language": "C++" }
```c++ #include <glbinding/GetProcAddress.h> #include <cassert> #ifdef WIN32 #include <string> #include <windows.h> #elif __APPLE__ #include <string> #include <dlfcn.h> #else #include <GL/glx.h> #endif namespace gl { ProcAddress GetProcAddress(const char * name) { #ifdef WIN32 typedef void (...
```c++ #include <glbinding/GetProcAddress.h> #ifdef WIN32 #include <string> #include <windows.h> #elif __APPLE__ #include <cassert> #include <string> #include <dlfcn.h> #else #include <GL/glx.h> #endif namespace gl { ProcAddress GetProcAddress(const char * name) { #ifdef WIN32 typedef vo...
2e41c71b-7a7e-47b8-9f79-a8713f0d001b
{ "language": "C++" }
```c++ #include<ros/ros.h> #include<ics3/ics> #include<servo_msgs/IdBased.h> ics::ICS3* driver {nullptr}; void move(const servo_msgs::IdBased::ConstPtr& msg) { auto degree = ics::Angle::newDegree(msg->angle); auto nowpos = driver->move(msg->id, degree); // TODO: publish now pos } int main(int argc, char** a...
```c++ #include<ros/ros.h> #include<ics3/ics> #include<servo_msgs/IdBased.h> ics::ICS3* driver {nullptr}; void move(const servo_msgs::IdBased::ConstPtr& msg) { auto degree = ics::Angle::newDegree(msg->angle); auto nowpos = driver->move(msg->id, degree); // TODO: publish now pos } int main(int argc, char** a...
d2a2c038-9950-48bb-98c2-c4b8cb63b54b
{ "language": "C++" }
```c++ #include<ros/ros.h> #include<ics3/ics> #include<servo_msgs/IdBased.h> std::string path; void move(const servo_msgs::IdBased::ConstPtr& msg) { static ics::ICS3 ics {path.c_str(), ics::Baudrate::RATE115200()}; auto degree = ics::Angle::newDegree(msg->angle); auto nowpos = ics.move(msg->id, degree); // TO...
```c++ #include<ros/ros.h> #include<ics3/ics> #include<servo_msgs/IdBased.h> ics::ICS3* driver; void move(const servo_msgs::IdBased::ConstPtr& msg) { auto degree = ics::Angle::newDegree(msg->angle); auto nowpos = driver->move(msg->id, degree); // TODO: publish now pos } int main(int argc, char** argv) { r...
65b29ef5-1ceb-4f7c-98f6-419d7db8f15b
{ "language": "C++" }
```c++ #include <google/protobuf/compiler/command_line_interface.h> #include <google/protobuf/compiler/cpp/cpp_generator.h> #include <google/protobuf/compiler/perlxs/perlxs_generator.h> #include <iostream> #include <string> using namespace std; int main(int argc, char* argv[]) { google::protobuf::compiler::Command...
```c++ #include <google/protobuf/compiler/command_line_interface.h> #include <google/protobuf/compiler/cpp/cpp_generator.h> #include <google/protobuf/compiler/perlxs/perlxs_generator.h> #include <iostream> #include <string> int main(int argc, char* argv[]) { google::protobuf::compiler::CommandLineInterface cli; ...
4bbb1f9a-dcbc-4cf7-847c-b845a54d5b75
{ "language": "C++" }
```c++ #ifndef MAIN_CPP #define MAIN_CPP #include <iostream> #include <bitset> #include <string> #include <fstream> int main() { std::ifstream myfile; std::string message,value,translate; enum States{W,Z,O,I}; States state = W; myfile.open("input1.txt"); while(!myfile.eof()) { std::getline(myfile,v...
```c++ #ifndef MAIN_CPP #define MAIN_CPP #include <iostream> #include <bitset> #include <string> int main() { std::string message,value,translate; enum States{W,Z,O,I}; States state = W; while(std::getline(std::cin,value,' ')) { value = value.substr(2,1); switch(state) { case W: { i...
80e65fed-0091-4a64-b32d-ddf93de1223a
{ "language": "C++" }
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_switches.h" // Flaky, h...
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_switches.h" // Times ou...
74c10d30-a493-41f8-a39a-e348f0e25520
{ "language": "C++" }
```c++ #include "particle.h" Particle::Particle(const Vector4D &p, const Vector4D &v) : position(p), velocity(v), lifetime(0) { } ``` Set default lifetime to lt 0
```c++ #include "particle.h" Particle::Particle(const Vector4D &p, const Vector4D &v) : position(p), velocity(v), lifetime(-1) { } ```
9269ed6d-74b5-43f5-9801-63cf224f666c
{ "language": "C++" }
```c++ #include "gamelib/core/res/SpriteResource.hpp" #include "gamelib/core/res/ResourceManager.hpp" #include "gamelib/utils/json.hpp" namespace gamelib { void registerSpriteLoader(ResourceManager& resmgr) { resmgr.registerFileType("spr", spriteLoader); } BaseResourceHandle spriteLoader(const...
```c++ #include "gamelib/core/res/SpriteResource.hpp" #include "gamelib/core/res/ResourceManager.hpp" #include "gamelib/utils/json.hpp" #include "gamelib/utils/conversions.hpp" namespace gamelib { void registerSpriteLoader(ResourceManager& resmgr) { resmgr.registerFileType("spr", spriteLoader); } ...
ec5f02c1-efe1-492c-bd4d-ac0dd7c89a00
{ "language": "C++" }
```c++ #include "h264manager.h" H264Manager::H264Manager() { encodingParameters = "-c:v libx264 -preset ultrafast -f matroska"; } void H264Manager::start(QProcess &process, QString file) { QString command = "ffmpeg -re -i \"" + file + "\" -c:v libx264 -preset ultrafast -an -f matroska udp://localhost:" + ENCO...
```c++ #include "h264manager.h" H264Manager::H264Manager() { encodingParameters = "-c:v libx264 -preset ultrafast -f matroska"; } ```
9def39a9-6ab8-4fea-983e-669b233aac89
{ "language": "C++" }
```c++ #include <ncurses.h> #include "../../../src/contents.hh" #include "../../../src/key_aliases.hh" #include "../../vick-move/src/move.hh" void enter_insert_mode(contents& contents, boost::optional<int>) { char ch; while(ch = getch() != _escape) { contents.cont[contents.y].insert(contents.x, 1, ch)...
```c++ #include <ncurses.h> #include "../../../src/contents.hh" #include "../../../src/key_aliases.hh" #include "../../vick-move/src/move.hh" void enter_insert_mode(contents& contents, boost::optional<int>) { char ch; while((ch = getch()) != _escape) { contents.cont[contents.y].insert(contents.x, 1, c...
28ba707d-9ecc-4c50-a22a-5bc3f6e1b50e
{ "language": "C++" }
```c++ #include "gtest/gtest.h" #include "hemi/launch.h" HEMI_MEM_DEVICE int result; HEMI_MEM_DEVICE int rGDim; HEMI_MEM_DEVICE int rBDim; template <typename... Arguments> struct k { HEMI_DEV_CALLABLE_MEMBER void operator()(Arguments... args) { result = sizeof...(args); rGDim = 1;//gridDim.x; rBDim = 1;//bloc...
```c++ #include "gtest/gtest.h" #include "hemi/launch.h" HEMI_MEM_DEVICE int result; HEMI_MEM_DEVICE int rGDim; HEMI_MEM_DEVICE int rBDim; template <typename T, typename... Arguments> HEMI_DEV_CALLABLE T first(T f, Arguments...) { return f; } template <typename... Arguments> struct k { HEMI_DEV_CALLABLE_MEMBER voi...
dd627564-8f07-45a6-a7f8-01b86c51a389
{ "language": "C++" }
```c++ class Solution { public: // Backtracking vector<vector<int>> subsets(vector<int>& nums) { vector<vector<int>> res; vector<int> sub; subsets(nums, sub, res, 0); return res; } void subsets(vector<int>& nums, vector<int>& sub, vector<vector<int>>& subs, int start...
```c++ class Solution { public: // Backtracking vector<vector<int>> subsets(vector<int>& nums) { vector<vector<int>> res; vector<int> sub; subsets(nums, sub, res, 0); return res; } void subsets(vector<int>& nums, vector<int>& sub, vector<vector<int>>& subs, int start...
6e69facc-990b-47cd-9b22-00d9dd38adf8
{ "language": "C++" }
```c++ #include "ElevatorSubsystem.h" #include "../RobotMap.h" ElevatorSubsystem::ElevatorSubsystem() : Subsystem("ElevatorSubsystem"), pullMotorRight(PULL_MOTOR_RIGHT),pullMotorLeft(PULL_MOTOR_LEFT), underSwitch(UNDER_LIMIT),upSwitch(UP_LIMIT) { } void ElevatorSubsystem::InitDefaultCommand() { // Set the def...
```c++ #include "ElevatorSubsystem.h" #include "../RobotMap.h" ElevatorSubsystem::ElevatorSubsystem() : Subsystem("ElevatorSubsystem"), pullMotorRight(PULL_MOTOR_RIGHT),pullMotorLeft(PULL_MOTOR_LEFT), underSwitch(UNDER_LIMIT),upSwitch(UP_LIMIT) { } void ElevatorSubsystem::InitDefaultCommand() { // Set the def...
985bb1bc-b9b6-45bd-aff7-287efc172c3f
{ "language": "C++" }
```c++ /* * Copyright (c) 2011 by Michael Berlin, Zuse Institute Berlin * * Licensed under the BSD License, see LICENSE file for details. * */ #include "libxtreemfs/callback/execute_sync_request.h" using namespace xtreemfs::rpc; using namespace xtreemfs::util; namespace xtreemfs { boost::thread_specific_ptr<in...
```c++ /* * Copyright (c) 2011 by Michael Berlin, Zuse Institute Berlin * * Licensed under the BSD License, see LICENSE file for details. * */ #include "libxtreemfs/callback/execute_sync_request.h" using namespace xtreemfs::rpc; using namespace xtreemfs::util; namespace xtreemfs { /** The TLS pointer is set to...
d8a1332b-6f86-4cb2-a4a8-fdfbaa8d7c04
{ "language": "C++" }
```c++ // RUN: %clang -fsyntax-only -verify %s // RUN: %clang -fsyntax-only -verify -fshort-wchar %s #include <limits.h> const bool swchar = (wchar_t)-1 > (wchar_t)0; #ifdef __WCHAR_UNSIGNED__ int signed_test[!swchar]; #else int signed_test[swchar]; #endif int max_test[WCHAR_MAX == (swchar ? -(WCHAR_MIN+1) : (wchar...
```c++ // RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify %s // RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify -fshort-wchar %s #include <limits.h> const bool swchar = (wchar_t)-1 > (wchar_t)0; #ifdef __WCHAR_UNSIGNED__ int signed_test[!swchar]; #else int signed_test[swchar]; #endif int max_test[WCHAR_MA...
b4734d56-8b40-4f71-b6cd-7a15bd5e9f62
{ "language": "C++" }
```c++ #include "DeclarativeUserInfo.hpp" #include "Client.hpp" #include "DataStorage.hpp" namespace Telegram { namespace Client { DeclarativeUserInfo::DeclarativeUserInfo(QObject *parent) : DeclarativeClientOperator(parent) { } void DeclarativeUserInfo::setContactId(quint32 contactId) { if (m_contactId ==...
```c++ #include "DeclarativeUserInfo.hpp" #include "Client.hpp" #include "DataStorage.hpp" #include <QLoggingCategory> Q_DECLARE_LOGGING_CATEGORY(c_qmlLoggingCategory) namespace Telegram { namespace Client { DeclarativeUserInfo::DeclarativeUserInfo(QObject *parent) : DeclarativeClientOperator(parent) { } voi...
0358446f-5c2a-4f72-a0b1-8d8044ce3f80
{ "language": "C++" }
```c++ // Test that LargeAllocator unpoisons memory before releasing it to the OS. // RUN: %clangxx_asan %s -o %t // The memory is released only when the deallocated chunk leaves the quarantine, // otherwise the mmap(p, ...) call overwrites the malloc header. // RUN: ASAN_OPTIONS=quarantine_size=1 %t #include <assert....
```c++ // Test that LargeAllocator unpoisons memory before releasing it to the OS. // RUN: %clangxx_asan %s -o %t // The memory is released only when the deallocated chunk leaves the quarantine, // otherwise the mmap(p, ...) call overwrites the malloc header. // RUN: ASAN_OPTIONS=quarantine_size=1 %t #include <assert....
c3ba85fa-76f6-4a07-bc5e-6da82e418ade
{ "language": "C++" }
```c++ /********************************************************************************* * * Inviwo - Interactive Visualization Workshop * * Copyright (c) 2013-2017 Inviwo Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted prov...
```c++ /********************************************************************************* * * Inviwo - Interactive Visualization Workshop * * Copyright (c) 2013-2017 Inviwo Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted prov...
434741b6-5cc6-4dd6-ad32-53e62012d4af
{ "language": "C++" }
```c++ /* Copyright (C) 2002 by Eric Sunshine <sunshine@sunshineco.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option...
```c++ /* Copyright (C) 2002 by Eric Sunshine <sunshine@sunshineco.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option...
04a3ff4a-80be-4caf-bce0-9d66d1c6c100
{ "language": "C++" }
```c++ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/child/file_info_util.h" #include "base/logging.h" #include "third_party/WebKit/public/platform/WebFileInfo.h" namespace content...
```c++ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/child/file_info_util.h" #include "base/logging.h" #include "third_party/WebKit/public/platform/WebFileInfo.h" namespace content...
a0e58f3b-b1da-4f55-9cd7-7b8c1d846735
{ "language": "C++" }
```c++ #include "Halide.h" namespace { class EdgeDetect : public Halide::Generator<EdgeDetect> { public: ImageParam input{ UInt(8), 2, "input" }; Func build() { Var x, y; Func clamped = Halide::BoundaryConditions::repeat_edge(input); // Gradients in x and y. Func gx("gx"); ...
```c++ #include "Halide.h" namespace { class EdgeDetect : public Halide::Generator<EdgeDetect> { public: ImageParam input{ UInt(8), 2, "input" }; Func build() { Var x, y; Func clamped = Halide::BoundaryConditions::repeat_edge(input); // Gradients in x and y. Func gx("gx"); ...
0cfaccd9-360d-41c3-889d-7a045235e160
{ "language": "C++" }
```c++ #include "SubDocPropValueRenderer.h" #include <rapidjson/document.h> #include <glog/logging.h> namespace sf1r { void SubDocPropValueRenderer::renderSubDocPropValue( const std::string& propName, const std::string& origText, izenelib::driver::Value& resourceValue) { if (origText.empty()) r...
```c++ #include "SubDocPropValueRenderer.h" #include <rapidjson/document.h> #include <glog/logging.h> namespace sf1r { void SubDocPropValueRenderer::renderSubDocPropValue( const std::string& propName, const std::string& origText, izenelib::driver::Value& resourceValue) { if (origText.empty()) r...
c4b3ba41-a688-46fc-9958-2f70f4202dac
{ "language": "C++" }
```c++ #include <fstream> #include <iostream> #include "person.pb.h" //#include "../pb2json.h" #include <pb2json.h> using namespace std; int main(int argc,char *argv[]) { ifstream fin("dump",ios::binary); fin.seekg(0,ios_base::end); size_t len = fin.tellg(); fin.seekg(0,ios_base::beg); char *buf = new char [len]...
```c++ #include <fstream> #include <iostream> #include "person.pb.h" //#include "../pb2json.h" #include <pb2json.h> using namespace std; int main(int argc,char *argv[]) { // Test 1: read binary PB from a file and convert it to JSON ifstream fin("dump",ios::binary); fin.seekg(0,ios_base::end); size_t len = fin.te...
377c274e-5aa0-4bec-8619-6a1c50b9574e
{ "language": "C++" }
```c++ #include <QtTest/QtTest> #include <gui/input.h> class TestInput: public QObject { Q_OBJECT private slots: void specialKeys(); private: NeovimQt::InputConv input; }; void TestInput::specialKeys() { foreach(int k, input.specialKeys.keys()) { QCOMPARE(input.convertKey("", k, Qt::NoModifier), QString("<%...
```c++ #include <QtTest/QtTest> #include <gui/input.h> class TestInput: public QObject { Q_OBJECT private slots: void specialKeys(); private: NeovimQt::InputConv input; }; void TestInput::specialKeys() { foreach(int k, input.specialKeys.keys()) { QCOMPARE(input.convertKey("", k, Qt::NoModifier), QString("<%...
975277ec-c183-4905-bc75-e9bdefad2aab
{ "language": "C++" }
```c++ // RUN: clang-cc -fsyntax-only -verify %s // XFAIL: * class C { public: C(int a, int b); }; C::C(int a, // expected-note {{previous definition}} int b) // expected-note {{previous definition}} try { int c; } catch (int a) { // expected-error {{redefinition of 'a'}} int b; // expected-error {{redefi...
```c++ // RUN: clang-cc -fsyntax-only -verify %s // XFAIL: * class C { public: C(int a, int b); }; C::C(int a, // expected-note {{previous definition}} int b) // expected-note {{previous definition}} try { int c; } catch (int a) { // expected-error {{redefinition of 'a'}} int b; // expected-error {{redefi...
94fe5e62-d9a0-48be-835d-45131a2cf660
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - // FIXME: Don't assert for non-Win32 triples (PR18251). // RUN: %clang_cc1 -triple i686-pc-win32 -fno-rtti -emit-llvm %s -o - struct A { virtual void Method() = 0; }; struct B : public A { virtual void Method() { } }; typedef void (A::*fn_...
```c++ // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - // RUN: %clang_cc1 -triple %ms_abi_triple -fno-rtti -emit-llvm %s -o - struct A { virtual void Method() = 0; }; struct B : public A { virtual void Method() { } }; typedef void (A::*fn_type_a)(void); typedef void (B::*fn_type_b)(void); int ...
1694cc53-6715-467c-a50c-97c16ac1d863
{ "language": "C++" }
```c++ #include <fabric/dataCore.hpp> fabric::DataCore::DataCore() { camPos.x = 0; camPos.y = 1; camPos.z = 0; }``` Set cam pos to (0, 0, 0)
```c++ #include <fabric/dataCore.hpp> fabric::DataCore::DataCore() { camPos.x = 0; camPos.y = 0; camPos.z = 0; }```
60274f79-9685-415a-9b56-fde1f99ce25a
{ "language": "C++" }
```c++ #include <monsoon/history/collect_history.h> namespace monsoon { collect_history::~collect_history() noexcept {} std::size_t collect_history::metrics_hash::operator()( const std::tuple<group_name, metric_name>& t) const noexcept { return std::hash<group_name>()(std::get<0>(t)); } std::size_t collect_...
```c++ #include <monsoon/history/collect_history.h> namespace monsoon { collect_history::~collect_history() noexcept {} std::size_t collect_history::metrics_hash::operator()( const std::tuple<group_name, metric_name>& t) const noexcept { return std::hash<group_name>()(std::get<0>(t)) ^ std::hash<metric...
0d270ac8-9894-4f9a-8125-0d0dd23f4cbf
{ "language": "C++" }
```c++ // Compile with -O3 -march=native to see autovectorization typedef double * __attribute__((aligned(64))) aligned_double; void maxArray(aligned_double __restrict x, aligned_double __restrict y) { for (int i = 0; i < 65536; i++) { x[i] = ((y[i] > x[i]) ? y[i] : x[i]); } } ``` Fix max array opt ve...
```c++ // Compile with -O3 -march=native to see autovectorization typedef double *__attribute__((aligned(64))) aligned_double; void maxArray(aligned_double __restrict x, aligned_double __restrict y) { for (int i = 0; i < 65536; i++) { x[i] = ((y[i] > x[i]) ? y[i] : x[i]); } } ```
2d72896c-f54a-4fb1-a58f-ee26fa6bdbe9
{ "language": "C++" }
```c++ #include <QFile> #include "ArchiveModel.hh" #include "ArchiveListItemWidget.hh" #include "ui_ArchiveListItemWidget.h" #include "HumanReadableSize.hh" ArchiveListItemWidget::ArchiveListItemWidget(QWidget *parent) : QWidget(parent), d_ui(QSharedPointer<Ui::ArchiveListItemWidget>(new Ui::ArchiveListItemW...
```c++ #include <QFile> #include "ArchiveModel.hh" #include "ArchiveListItemWidget.hh" #include "ui_ArchiveListItemWidget.h" #include "HumanReadableSize.hh" ArchiveListItemWidget::ArchiveListItemWidget(QWidget *parent) : QWidget(parent), d_ui(QSharedPointer<Ui::ArchiveListItemWidget>(new Ui::ArchiveListItemW...
8f53885a-76f5-4a9d-ae1d-b887e28e77c2
{ "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 "base/command_line.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_switches.h" #if defined...
```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 "base/command_line.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_switches.h" #if defined...
f5e2aeea-e38c-4c81-8b43-d0ca2e106132
{ "language": "C++" }
```c++ #include <sdf/sdf.hh> #include "gazebo/gazebo.hh" #include "gazebo/common/Plugin.hh" #include "gazebo/msgs/msgs.hh" #include "gazebo/physics/physics.hh" #include "gazebo/transport/transport.hh" #include <iostream> using namespace std; namespace gazebo { class SetupWorld : public WorldPlugin { public: v...
```c++ #include <sdf/sdf.hh> #include "gazebo/gazebo.hh" #include "gazebo/common/Plugin.hh" #include "gazebo/msgs/msgs.hh" #include "gazebo/physics/physics.hh" #include "gazebo/transport/transport.hh" #include <iostream> using namespace std; namespace gazebo { class SetupWorld : public WorldPlugin { public: v...
fdce6354-7449-48a9-81a9-7cb0059379ae
{ "language": "C++" }
```c++ /* * Copyright 2016 - 2018 gtalent2@gmail.com * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <ox/fs/filesystem.hpp> #include <ox/std/std.hpp...
```c++ /* * Copyright 2016 - 2018 gtalent2@gmail.com * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <ox/fs/fs.hpp> #include <ox/std/std.hpp> #incl...
3d679f0f-cc87-493e-a14e-8281aad6aa87
{ "language": "C++" }
```c++ // Petter Strandmark 2013. #include <map> #include <stdexcept> #include <vector> #include <spii/term_factory.h> using namespace std; namespace spii { class TermFactory::Implementation { public: map<string, TermCreator> creators; }; TermFactory::TermFactory() : impl(new TermFactory::Implementation) { } Te...
```c++ // Petter Strandmark 2013. #include <map> #include <stdexcept> #include <vector> #include <spii/term_factory.h> using namespace std; namespace spii { class TermFactory::Implementation { public: map<string, TermCreator> creators; }; TermFactory::TermFactory() : impl(new TermFactory::Implementation) { } Te...
db9e64d0-69e4-4d42-9bd2-011408ba8009
{ "language": "C++" }
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_switches.h" #if defined...
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_switches.h" #if defined...
b46b3b76-bb3c-4a3d-a75b-e8f2890de8d1
{ "language": "C++" }
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Storage) { ASSERT_TRUE(RunExtensionTest("s...
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" #if defined(OS_LINUX) // See http://crbug.com/42943. #define MAYBE_Storage FLAKY_Stor...
84e647cc-4c35-4821-97fc-af1f8068150b
{ "language": "C++" }
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // #include "config.h" #include "webkit/glue/resource_loader_bridge.h" #include "net/http/http_response_headers.h" namespace webkit_glu...
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // #include "config.h" #include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/webappcachecontext.h" #include "net/http/ht...
df39379a-0bf2-4262-906e-17e8e2dd55ec
{ "language": "C++" }
```c++ #include "cvd/utility.h" namespace CVD { void differences(const float* a, const float* b, float* diff, unsigned int size) { differences<float, float>(a, b, diff, size); } void add_multiple_of_sum(const float* a, const float* b, const float& c, float* out, unsigned int count) { add_multiple_of_sum<flo...
```c++ #include "cvd/utility.h" namespace CVD { void differences(const float* a, const float* b, float* diff, unsigned int size) { differences<float, float>(a, b, diff, size); } void add_multiple_of_sum(const float* a, const float* b, const float& c, float* out, size_t count) { add_multiple_of_sum<float, fl...
8922c71c-e0b2-4e30-b086-01c5dce5b97b
{ "language": "C++" }
```c++ // Copyright (c) 2016-2017 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #include <clocale> #include <cstdio> #include "test.hpp" namespace tao { namespace TAOCPP_PEGTL_NAMESPACE { struct file_content : seq< TAOCPP_PEGTL_STRING( "dummy...
```c++ // Copyright (c) 2016-2017 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #include <clocale> #include <cstdio> #include "test.hpp" namespace tao { namespace TAOCPP_PEGTL_NAMESPACE { struct file_content : seq< TAOCPP_PEGTL_STRING( "dummy...
c9baa9c5-4c7f-4ed7-87e6-1100844bb1d1
{ "language": "C++" }
```c++ // Copyright eeGeo Ltd (2012-2015), All Rights Reserved #include "SearchResultSectionOrder.h" #include "SearchResultModel.h" #include "SearchVendorNames.h" namespace ExampleApp { namespace SearchResultSection { namespace View { bool SearchResultSectionOrder::operator() (con...
```c++ // Copyright eeGeo Ltd (2012-2015), All Rights Reserved #include <limits> #include <map> #include "SearchResultSectionOrder.h" #include "SearchResultModel.h" #include "SearchVendorNames.h" namespace ExampleApp { namespace SearchResultSection { namespace View { namespace ...
360ba0f7-d6db-400c-a408-b25134b7a759
{ "language": "C++" }
```c++ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <util/validation.h> #include <consensus/validation.h> #include <...
```c++ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <util/validation.h> #include <consensus/validation.h> #include <...
ff95bef3-2829-4627-9524-74e4a89ce8b9
{ "language": "C++" }
```c++ #include <iostream> #include <qimessaging/signature.hpp> //sample foo function to take the signature from int foo(int a, int b) { return a + b + 42; } int main() { //wrapper arround signature, to create the signature of a function with it's name std::string signature; signature = qi::makeFunctionSign...
```c++ #include <iostream> #include <qimessaging/signature.hpp> //sample foo function to take the signature from int foo(int a, int b) { return a + b + 42; } int main() { //wrapper arround signature, to create the signature of a function with it's name std::string signature; signature = qi::makeFunctionSigna...
f22c6da5-92ee-440a-820f-11c04ac581ab
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -verify %s -DN=1 // RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -verify %s -DN=2 // RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -verify %s -DN=3 struct A { int a; }; #if N == 1 // ChooseExpr template<class T> void test(int (&)[sizeof(__builtin_choose_expr(true,...
```c++ // RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=1 // RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=2 // RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=3 struct A { int a; }; #if N == 1 ...
7ae17f90-fc24-497b-97dd-37d72ea0c8c4
{ "language": "C++" }
```c++ #include "stdafx.h" #include "AudioDeviceWrapper.h" #include "DefSoundException.h" using namespace System; bool AudioEndPointControllerWrapper::AudioDeviceWrapper::Equals(Object ^ o) { if (o == (Object^)nullptr) return false; if(o->GetType() != this->GetType()) { return false; ...
```c++ #include "stdafx.h" #include "AudioDeviceWrapper.h" #include "Audio.EndPoint.Controller.Wrapper.h" #include "DefSoundException.h" using namespace System; namespace AudioEndPointControllerWrapper { bool AudioDeviceWrapper::Equals(Object ^ o) { if (o == (Object^)nullptr) return false;...
535d78a0-380a-4a92-bf3c-e20f2b1a904a
{ "language": "C++" }
```c++ #include <string> #include <vector> #include <unistd.h> #include <gtest/gtest.h> #include <scxcorelib/scxstrencodingconv.h> #include "getusername.h" using std::string; using std::vector; using SCXCoreLib::Utf16leToUtf8; TEST(GetUserName,simple) { // allocate a WCHAR_T buffer to receive username DWORD lpnSize...
```c++ #include <string> #include <vector> #include <unistd.h> #include <gtest/gtest.h> #include <scxcorelib/scxstrencodingconv.h> #include "getusername.h" using std::string; using std::vector; using SCXCoreLib::Utf16leToUtf8; TEST(GetUserName,simple) { // allocate a WCHAR_T buffer to receive username DWORD lpnSize...
9d3a4950-580c-4eb5-8e26-525a38356d35
{ "language": "C++" }
```c++ #include <iostream> #include <string> #include "ace/INET_Addr.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Stream.h" #include "ace/SOCK_Acceptor.h" #include "ace/Acceptor.h" #include "ace/Reactor.h" #include "AndroidServiceHandler.h" using namespace std; int main(int argc, char **argv) { cout ...
```c++ #include <iostream> #include <string> #include "ace/Reactor.h" #include "GatewayConnector/GatewayConnector.h" using namespace std; int main(int argc, char **argv) { cout << "Creating gateway connector..." << endl << flush; GatewayConnector *gatewayConnector = new GatewayConnector(NULL); //Get t...