doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
be4c183c-3da0-4ccf-937f-5c5c3e6ca201
{ "language": "C++" }
```c++ #include "Output.h" #include "Parameters.h" #include "Parser.h" #include "PerformanceTracker.h" #include "Simulation.h" #include <iostream> #include <map> #include <string> using namespace pica; using namespace std; int realMain(int argc, char* argv[]); int main(int argc, char* argv[]) { ...
```c++ #include "Output.h" #include "Parameters.h" #include "Parser.h" #include "PerformanceTracker.h" #include "Simulation.h" #include <iostream> #include <map> #include <stdexcept> #include <string> using namespace pica; using namespace std; int realMain(int argc, char* argv[]); int main(int arg...
d9a8856b-2d9e-4659-b78b-223511fe8635
{ "language": "C++" }
```c++ // RUN: clang-cc -fsyntax-only -verify %s void f1() { struct X { struct Y; }; struct X::Y { void f() {} }; } void f2() { struct X { struct Y; struct Y { void f() {} }; }; } // A class nested within a local class is a local class. void f3(int a) { // expected-note...
```c++ // RUN: clang-cc -fsyntax-only -verify %s void f1() { struct X { struct Y; }; struct X::Y { void f() {} }; } void f2() { struct X { struct Y; struct Y { void f() {} }; }; } // A class nested within a local class is a local class. void f3(int a) { // expected-note...
4bfc2a7a-d52b-4107-9e4f-24befc30662e
{ "language": "C++" }
```c++ /* * SOPMQ - Scalable optionally persistent message queue * Copyright 2014 InWorldz, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/L...
```c++ /* * SOPMQ - Scalable optionally persistent message queue * Copyright 2014 InWorldz, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/L...
c44e4a9e-25c0-47b5-bf6e-f7fcb12cc686
{ "language": "C++" }
```c++ // Copyright 2016 Mitchell Kember. Subject to the MIT License. // Project Euler: Problem 31 // Coin sums namespace problem_31 { constexpr long n_denoms = 8; constexpr long denom_values[n_denoms] = { 1, 2, 5, 10, 20, 50, 100, 200 }; long n_coin_sums(const long sum, const long index) { if (sum < 0 || index < ...
```c++ // Copyright 2016 Mitchell Kember. Subject to the MIT License. // Project Euler: Problem 31 // Coin sums namespace problem_31 { constexpr long n_denoms = 8; constexpr long denom_values[n_denoms] = { 1, 2, 5, 10, 20, 50, 100, 200 }; long n_coin_sums(const long sum, const long index) { if (sum < 0 || index < ...
9a711326-5aa0-4bbf-9233-88533d538574
{ "language": "C++" }
```c++ #include "ReQL-test.hpp" #include "catch.h" #include <limits> using namespace ReQL; TEST_CASE("Connection", "[c++][connect]") { Connection conn = connect(); REQUIRE(conn.isOpen()); } TEST_CASE("Expr", "[c][expr]") { SECTION("number") { _ReQL_Op_t num; const double val = 42.0; _reql_numb...
```c++ #include "ReQL-test.hpp" #include "catch.h" #include <limits> using namespace ReQL; TEST_CASE("Connection", "[c++][connect]") { Connection conn = connect(); REQUIRE(conn.isOpen()); } TEST_CASE("Expr", "[c][expr]") { SECTION("null") { _ReQL_Op_t null; _reql_null_init(&null); CHECK(_reql_...
0b436b78-ee4e-42b3-9a5c-1dcb8f653b6d
{ "language": "C++" }
```c++ #include <QtGui/QApplication> #include "mainwindow.h" #include "fvupdater.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); // Prerequisite for the Fervor updater QApplication::setOrganizationName("pypt"); QApplication::setOrganizationDomain("pypt.lt"); // Set feed URL before doing anythi...
```c++ #include <QApplication> #include "mainwindow.h" #include "fvupdater.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); // Prerequisite for the Fervor updater QApplication::setOrganizationName("pypt"); QApplication::setOrganizationDomain("pypt.lt"); // Set feed URL before doing anything els...
f55e8a40-8920-4c0a-b74a-c39ca1eda6bf
{ "language": "C++" }
```c++ #include <ros/ros.h> #include <geometry_msgs/Twist.h> int main(int argc, char *argv[]){ ros::init(argc, argv, "quadrotor_obstacle_avoidance"); ros::NodeHandle node; ros::Publisher cmd_pub = node.advertise<geometry_msgs::Twist>("cmd_vel", 10); ros::Duration(1).sleep(); geometry...
```c++ #include <ros/ros.h> #include <geometry_msgs/Twist.h> int main(int argc, char *argv[]){ ros::init(argc, argv, "quadrotor_obstacle_avoidance"); ros::NodeHandle node; ros::Publisher cmd_pub = node.advertise<geometry_msgs::Twist>("cmd_vel", 10); ros::Duration(1).sleep(); geometry...
99e2aa75-3864-4ea8-a0f5-58ecb37c8df8
{ "language": "C++" }
```c++ #include<iostream> #include<stdlib.h> #include"filecopy.h" int main(int argc, char *argv[]) { if(argc != 3) { std::cout << "USAGE: " << argv[0] << " <filesource> <filedestination>" << std::endl; return 1; } else { filecopy target1(argv[2], argv[1]); ...
```c++ #include<iostream> #include<stdlib.h> #include"filecopy.h" int main(int argc, char *argv[]) { if(argc != 3) { std::cout << "USAGE: " << argv[0] << " <filesource> <filedestination>" << std::endl; return 1; } else { filecopy target1(argv[2], argv[1]); ...
b8eafb83-2c4e-4084-96a9-3749a947c43a
{ "language": "C++" }
```c++ #include <ccspec/matchers/be_something.h> namespace ccspec { namespace matchers { const BeSomething& be = BeSomething::instance(); const BeSomething& BeSomething::instance() { static BeSomething instance; return instance; } BeSomething::BeSomething() {} } // namespace matchers } // namespace ccspec ...
```c++ #include <ccspec/matchers/be_something.h> namespace ccspec { namespace matchers { const BeSomething& be = BeSomething::instance(); // Public methods. const BeSomething& BeSomething::instance() { static BeSomething instance; return instance; } // Private methods. BeSomething::BeSomething() {} } // ...
02e59c6b-c5d6-4e3f-9a58-097000003dd6
{ "language": "C++" }
```c++ #include "ofApp.h" void ofApp::setup() { ofBackground(0); // Add our CustomSource to list of fbo sources of the piMapper // FBO sources should be added before piMapper.setup() so the // piMapper is able to load the source if it is assigned to // a surface in XML settings. piMapper.addFboSource(cu...
```c++ #include "ofApp.h" void ofApp::setup() { ofBackground(0); // Add our CustomSource to list of fbo sources of the piMapper // FBO sources should be added before piMapper.setup() so the // piMapper is able to load the source if it is assigned to // a surface in XML settings. piMapper.addFboSource(cu...
cbed7228-72c1-4818-98c0-04a9cfa11aa8
{ "language": "C++" }
```c++ #include <iostream> #include <string> #include "hash_table.cpp" #include <time.h> void randstr(const int length, std::string &out); int main(void) { srand(time(NULL)); hash_set<std::string> hs_str(10, 0.8, [] (const std::string entry) -> unsigned int { unsigned int hash = 0...
```c++ #include <iostream> #include <string> #include "hash_table.hpp" #include <time.h> void randstr(const int length, std::string &out); int main(void) { srand(time(NULL)); hash_set<std::string> hs_str(10, 0.8, [] (const std::string entry) -> unsigned int { unsigned int hash = 0...
6011f1d8-d017-4405-8a7c-7bd1b178b6a7
{ "language": "C++" }
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. #include "common/content_client.h" #include "common/application_info.h" #include "base/strings/stringprintf.h" #include "base/string...
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. #include "common/content_client.h" #include "common/application_info.h" #include "base/strings/stringprintf.h" #include "base/string...
812fbc56-2da4-4768-a2fc-4c7ca9563c63
{ "language": "C++" }
```c++ #include <QInputDialog> #include "QGCTCPLinkConfiguration.h" #include "ui_QGCTCPLinkConfiguration.h" QGCTCPLinkConfiguration::QGCTCPLinkConfiguration(TCPLink* link, QWidget *parent) : QWidget(parent), link(link), ui(new Ui::QGCTCPLinkConfiguration) { ui->setupUi(this); uint16_t port = link-...
```c++ #include <QInputDialog> #include "QGCTCPLinkConfiguration.h" #include "ui_QGCTCPLinkConfiguration.h" #include <stdint.h> QGCTCPLinkConfiguration::QGCTCPLinkConfiguration(TCPLink* link, QWidget *parent) : QWidget(parent), link(link), ui(new Ui::QGCTCPLinkConfiguration) { ui->setupUi(this); u...
bc0ff479-594a-461d-9b11-94bd7b2fded9
{ "language": "C++" }
```c++ #include <mart-common/experimental/ranges.h> #include <catch2/catch.hpp> TEST_CASE( "experimental_frange_compiles", "[experimental][ranges]" ) { auto r = mart::experimental::frange( 0.1, 0.3 ).step( 0.1 ); (void)r; } TEST_CASE( "experimental_vrange_compiles", "[experimental][ranges]" ) { auto r = mart::exp...
```c++ #include <mart-common/experimental/ranges.h> #include <catch2/catch.hpp> TEST_CASE( "experimental_frange_compiles", "[experimental][ranges]" ) { auto r = mart::experimental::frange( 0.1, 0.3 ).step( 0.1 ); (void)r; } TEST_CASE( "experimental_vrange_compiles", "[experimental][ranges]" ) { auto r = mart::exp...
c0710f15-a0ec-4ce7-9afa-4ce6572042a2
{ "language": "C++" }
```c++ #include "fly/logger/log.h" #include "fly/logger/logger_config.h" namespace fly { //============================================================================== Log::Log() : m_level(NUM_LEVELS), m_time(-1.0), m_gameId(-1), m_line(-1), m_message() { ::memset(m_file, 0, sizeof(m_file))...
```c++ #include "fly/logger/log.h" #include <cstring> #include "fly/logger/logger_config.h" namespace fly { //============================================================================== Log::Log() : m_level(NUM_LEVELS), m_time(-1.0), m_gameId(-1), m_line(-1), m_message() { ::memset(m_file...
9c8b8d70-bc79-459c-83db-a5b42653c5d5
{ "language": "C++" }
```c++ #include <prelude/runtime/tags.h> using namespace copperhead; bool system_variant_less::operator()(const system_variant& x, const system_variant& y) const { return x.which() < y.which(); } std::string detail::system_variant_to_string::operator()(const omp_tag&) const { ...
```c++ #include <prelude/runtime/tags.h> using namespace copperhead; bool system_variant_less::operator()(const system_variant& x, const system_variant& y) const { return x.which() < y.which(); } std::string detail::system_variant_to_string::operator()(const omp_tag&) const { ...
9126c40f-c2ae-4b76-a3e0-453475261510
{ "language": "C++" }
```c++ #include "Shape.h" #include <vector> namespace CraneTranformation { using namespace System; using System::Drawing::Point; Shape::Shape(array<Point>^ shapePoint) { points = shapePoint; } array<Point>^ Shape::get_points() { return points; } }``` Implement translation and point printing
```c++ #include "Shape.h" namespace CraneTranformation { using namespace System; using System::Drawing::Point; Shape::Shape(array<Point>^ shapePoint) { points = shapePoint; } array<Point>^ Shape::get_points() { return points; } void Shape::translate(Point^ delta) { for (int i = 0; i < points...
24616182-df2a-4406-9120-9a83defe4fd8
{ "language": "C++" }
```c++ /* * Copyright (C) 2008 <Your Name> * See COPYING for license details. */ #include <QObject> #include <QtTest/QtTest> #include "qttestutil/qttestutil.h" class MyClassTest : public QObject { Q_OBJECT private slots: void initTestCase() { } void cleanupTestCase() { } void testMyMethod() {...
```c++ /* * Copyright (C) 2008 <Your Name> * See COPYING for license details. */ #include <QObject> #include <QtTest/QtTest> #include "qttestutil/qttestutil.h" class MyClassTest : public QObject { Q_OBJECT private slots: void initTestCase() { } void cleanupTestCase() { } void testMyMethod() {...
f01512cd-3606-4ae5-a1b4-979a360830c0
{ "language": "C++" }
```c++ // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); ...
```c++ // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); ...
c270abd1-332e-42ab-ac1e-c3477edf0f8b
{ "language": "C++" }
```c++ #include <thread> #include <chrono> #include <iostream> #include "file_listener.hpp" namespace fs = std::experimental::filesystem; namespace amer { void file_listener::run() { m_listener_thread = std::thread{[this] { this->do_run(); }}; } void file_listener::do_run() { while (true) { for (...
```c++ #include <thread> #include <chrono> #include <iostream> #include "file_listener.hpp" namespace fs = std::experimental::filesystem; static constexpr auto sleep_time = std::chrono::milliseconds(100) namespace amer { void file_listener::run() { m_listener_thread = std::thread{[this] { this->do_run(); }}; ...
597b61df-918f-4119-904a-231e44191c53
{ "language": "C++" }
```c++ #include <turbodbc_numpy/set_numpy_parameters.h> #include <turbodbc/errors.h> #include <iostream> namespace turbodbc_numpy { void set_numpy_parameters(turbodbc::bound_parameter_set & parameters, std::vector<pybind11::array> const & columns) { pybind11::dtype const np_int64("int64"); pybind11::dtype ...
```c++ #include <turbodbc_numpy/set_numpy_parameters.h> #include <turbodbc/errors.h> #include <turbodbc/make_description.h> #include <turbodbc/type_code.h> #include <iostream> #include <algorithm> #ifdef _WIN32 #include <windows.h> #endif #include <sql.h> namespace turbodbc_numpy { void set_numpy_parameters(turbo...
c7933ca4-e6ae-4dad-a809-595e7164c4c9
{ "language": "C++" }
```c++ #include "mini_stdint.h" #define WEAK __attribute__((weak)) extern "C" { extern int __android_log_vprint(int, const char *, const char *, __builtin_va_list); WEAK int halide_printf(void *user_context, const char * fmt, ...) { __builtin_va_list args; __builtin_va_start(args,fmt); int result = __an...
```c++ #include "mini_stdint.h" #define WEAK __attribute__((weak)) extern "C" { extern int __android_log_vprint(int, const char *, const char *, __builtin_va_list); #define ANDROID_LOG_INFO 4 WEAK int halide_printf(void *user_context, const char * fmt, ...) { __builtin_va_list args; __builtin_va_start(args...
76bbbbfa-dbdd-455a-8efe-7b3fc781d511
{ "language": "C++" }
```c++ #include <iostream> #include "img_vol.h" #include "operations.h" #include "img2d.h" int main(int argc, char **argv) { ImgVol img("/home/alex/Downloads/libmo815-3dvis/data/brain.scn"); std::cout << img << "\n"; std::cout << img(57, 9, 35) << "\n"; Img2D img2d = Cut(img, ImgVol::Axis::Z, 40); std::co...
```c++ #include <iostream> #include "img_vol.h" #include "operations.h" #include "img2d.h" int main(int argc, char **argv) { ImgVol img("/home/alex/Downloads/libmo815-3dvis/data/brain.scn"); std::cout << img << "\n"; std::cout << img(57, 9, 35) << "\n"; Img2D img2dz = Cut(img, ImgVol::Axis::Z, 40); std::c...
7ceeadfb-c184-401e-96a6-a134e1c88d34
{ "language": "C++" }
```c++ /* Copyright (C) 2008 The goocanvasmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later ver...
```c++ /* Copyright (C) 2008 The goocanvasmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later ver...
6379e87e-7f0f-4fec-be25-7b2bd082852b
{ "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 "views/events/event.h" #include "base/logging.h" #include "ui/aura/event.h" namespace views { /////////////////////////////////////...
```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 "views/events/event.h" #include "base/logging.h" #include "ui/aura/event.h" namespace views { /////////////////////////////////////...
efef6a50-2517-4b92-b2c1-3ace4ade6249
{ "language": "C++" }
```c++ //===-- sanitizer_test_main.cc --------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===-- sanitizer_test_main.cc --------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
1ae45f22-19c4-4374-b26c-80d311bc0963
{ "language": "C++" }
```c++ #include <string> #include "configuration.hh" namespace vick { int from_visual(const std::string& cont, int x) { if(cont.size() == 0) return 0; int count = 0, til = 0; int numTab = 0; for(unsigned int i = 0; i < cont.length(); i++) { unsigned int len; if(cont[i] == '\t'...
```c++ #include <string> #include "configuration.hh" namespace vick { int from_visual(const std::string& cont, int x) { if(cont.size() == 0) return 0; int count = 0, til = 0; int numTab = 0; for(size_t i = 0; i < cont.length(); i++) { size_t len; if(cont[i] == '\t') { ...
c2994317-7e06-4f14-84c2-d3334ccd9ed1
{ "language": "C++" }
```c++ // Copyright eeGeo Ltd (2012-2017), All Rights Reserved #include <jni.h> #include "AndroidAppThreadAssertionMacros.h" #include "SenionLabBroadCastReceiver.h" #include "SenionLabBroadCastReceiverJni.h" extern "C" { JNIEXPORT void JNICALL Java_com_eegeo_interiorsposition_senionlab_SenionLabBroadcastReceiverJniM...
```c++ // Copyright eeGeo Ltd (2012-2017), All Rights Reserved #include <jni.h> #include "AndroidAppThreadAssertionMacros.h" #include "SenionLabBroadcastReceiver.h" #include "SenionLabBroadcastReceiverJni.h" extern "C" { JNIEXPORT void JNICALL Java_com_eegeo_interiorsposition_senionlab_SenionLabBroadcastReceiverJniM...
843e2860-85bc-4975-a1e2-d348ca1f4821
{ "language": "C++" }
```c++ #include "user.h" // This is a hack. // Otherwise, we will need to create a target for each user application. #include "examples/user_audio_beat.cpp" //#include "examples/user_color_sensor.h" //#include "examples/user_accelerometer_gestures.h" //#include "examples/user_accelerometer_poses.h" //#include "example...
```c++ #include "user.h" // This is a hack. // Otherwise, we will need to create a target for each user application. #include "examples/user_audio_beat.cpp" //#include "examples/user_color_sensor.cpp" //#include "examples/user_accelerometer_gestures.cpp" //#include "examples/user_accelerometer_poses.cpp" //#include "e...
158fd956-94f5-4152-8ce1-eac3e9bbbefe
{ "language": "C++" }
```c++ // Copyright © 2012 Lénaïc Bagnères, hnc@singularity.fr // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by appl...
```c++ // Copyright © 2012 Lénaïc Bagnères, hnc@singularity.fr // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by appl...
4ee29070-d6cc-425e-9b4c-b4085a35128f
{ "language": "C++" }
```c++ #include "common/library_main.h" #include "common/main_delegate.h" #include "content/public/app/content_main.h" int BrightrayExampleMain(int argc, const char* argv[]) { brightray_example::MainDelegate delegate; return content::ContentMain(argc, argv, &delegate); } ``` Update for changes to content::Conten...
```c++ #include "common/library_main.h" #include "common/main_delegate.h" #include "content/public/app/content_main.h" int BrightrayExampleMain(int argc, const char* argv[]) { brightray_example::MainDelegate delegate; content::ContentMainParams params(&delegate); params.argc = argc; params.argv = argv; retu...
94c59114-a623-40b8-ae45-76a4d45894e1
{ "language": "C++" }
```c++ // // Copyright (C) 2016 University of Amsterdam // // This program 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 2 of the License, or // (at your option) any later version. // // Thi...
```c++ // // Copyright (C) 2016 University of Amsterdam // // This program 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 2 of the License, or // (at your option) any later version. // // Thi...
9e9c421a-fcbf-4c0f-a79d-79a8a94d1f10
{ "language": "C++" }
```c++ // Copyright (c) 2015 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #include "atom/common/event_emitter_caller.h" #include "atom/common/node_includes.h" namespace mate { namespace internal { v8::Local<v8::Value> CallEmitWithArgs(v8::Isolate*...
```c++ // Copyright (c) 2015 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #include "atom/common/event_emitter_caller.h" #include "base/memory/scoped_ptr.h" #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" #include "atom/commo...
2e7e6225-784b-427a-9927-62e18afb0491
{ "language": "C++" }
```c++ #include "message_passing.h" namespace openmc { namespace mpi { int rank; int n_procs; #ifdef OPENMC_MPI MPI_Comm intracomm; MPI_Datatype bank; #endif } // namespace mpi } // namespace openmc ``` Make sure rank/nprocs is set for serial runs
```c++ #include "message_passing.h" namespace openmc { namespace mpi { int rank {0}; int n_procs {1}; #ifdef OPENMC_MPI MPI_Comm intracomm; MPI_Datatype bank; #endif } // namespace mpi } // namespace openmc ```
4397c2d1-ae35-4ffb-9a89-d7f3b36e4f45
{ "language": "C++" }
```c++ #include <iostream> #include <string> #include <Lexer.hpp> #include <Parser.hpp> #include <Visitors.hpp> int main() { std::string input_line; double ans = 0; while (true) { std::cout << ">>> "; std::getline(std::cin, input_line); if (input_line == "quit" || input_line == ...
```c++ #include <iostream> #include <string> #include <Lexer.hpp> #include <Parser.hpp> #include <Visitors.hpp> int main() { std::string input_line; double ans = 0; std::cout << "miniMAT: It's like MATLAB, but smaller." << std::endl; std::cout << "Copyright (C) 2014 Federico Menozzi" << std::endl; ...
ae69e748-e4c6-4e8a-bb79-65c1f6fea934
{ "language": "C++" }
```c++ /* * Copyright 2006 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkTypes.h" static const size_t kBufferSize = 256; #define LOG_TAG "skia" #include <android/log.h> void SkDebugf(const char format[], ...
```c++ /* * Copyright 2006 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkTypes.h" static const size_t kBufferSize = 256; #define LOG_TAG "skia" #include <android/log.h> static bool gSkDebugToStdOut = fals...
4cb1ca39-7086-4d14-8e9a-a07934960124
{ "language": "C++" }
```c++ //===- Error.cpp ----------------------------------------------------------===// // // The LLVM Linker // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===---------------------------------------------------------...
```c++ //===- Error.cpp ----------------------------------------------------------===// // // The LLVM Linker // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===---------------------------------------------------------...
dad5f904-9bae-4399-8401-f5ee695b2883
{ "language": "C++" }
```c++ #include <config/config_class.h> #include <config/config_object.h> #include <config/config_value.h> #include "wanproxy_config_class_interface.h" WANProxyConfigClassInterface wanproxy_config_class_interface; bool WANProxyConfigClassInterface::activate(ConfigObject *) { /* Eventually would like to do something...
```c++ #include <config/config_class.h> #include <config/config_object.h> #include <config/config_value.h> #include "wanproxy_config_class_interface.h" WANProxyConfigClassInterface wanproxy_config_class_interface; bool WANProxyConfigClassInterface::activate(ConfigObject *co) { if (!ConfigClassAddress::activate(co))...
14799e6f-e7b7-47ef-a45c-7167a7dfe047
{ "language": "C++" }
```c++ /*============================================================================= Library: CppMicroServices Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in ...
```c++ /*============================================================================= Library: CppMicroServices Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in ...
ef0cbb33-1f28-4314-b13d-28796f249066
{ "language": "C++" }
```c++ #include <iostream> #include <nlohmann/json.hpp> int main (int argc, char** argv) { // for convenience using json = nlohmann::json; json j2 = { {"pi", 3.141}, {"happy", true}, {"name", "Niels"}, {"nothing", nullptr}, {"answer", { {"everything", 42} }}, {"list", {1, 0, 2...
```c++ #include <iostream> #include <json.hpp> int main (int argc, char** argv) { // for convenience using json = nlohmann::json; json j2 = { {"pi", 3.141}, {"happy", true}, {"name", "Niels"}, {"nothing", nullptr}, {"answer", { {"everything", 42} }}, {"list", {1, 0, 2}}, {...
ac0393bd-0e00-4bc3-a47a-06b6227023a2
{ "language": "C++" }
```c++ #include <iostream> #include <stdexcept> #include "Badger.hpp" int main() { try { badger::Badger b; b.run(); return EXIT_SUCCESS; } catch(const std::exception &e) { std::cout << e.what() << std::endl; } } ``` Support accrus pour la compilation avec Min...
```c++ #include <iostream> #include <stdexcept> #include "Badger.hpp" // Include cstdlib for EXIT_SUCCESS with MinGW #include <cstdlib> int main() { try { badger::Badger b; b.run(); return EXIT_SUCCESS; } catch(const std::exception &e) { std::cout << e.what() << ...
496ad067-1302-4e9f-966b-43d07061a741
{ "language": "C++" }
```c++ #include "paddle/platform/place.h" #include "gtest/gtest.h" #include <sstream> TEST(Place, Equality) { paddle::platform::CpuPlace cpu; paddle::platform::GpuPlace g0(0), g1(1), gg0(0); EXPECT_EQ(cpu, cpu); EXPECT_EQ(g0, g0); EXPECT_EQ(g1, g1); EXPECT_EQ(g0, gg0); EXPECT_NE(g0, g1); EXPECT_TRUE...
```c++ #include "paddle/platform/place.h" #include <sstream> #include "gtest/gtest.h" TEST(Place, Equality) { paddle::platform::CpuPlace cpu; paddle::platform::GpuPlace g0(0), g1(1), gg0(0); EXPECT_EQ(cpu, cpu); EXPECT_EQ(g0, g0); EXPECT_EQ(g1, g1); EXPECT_EQ(g0, gg0); EXPECT_NE(g0, g1); EXPECT_TRUE...
c7e69393-b8af-4514-8d66-8d1a357df5b4
{ "language": "C++" }
```c++ // Copyright (c) 2013-2021 mogemimi. Distributed under the MIT license. #include "TimeSourceEmscripten.hpp" #include <emscripten.h> namespace Pomdog::Detail::Emscripten { TimePoint TimeSourceEmscripten::Now() const { const auto now = ::emscripten_get_now(); return TimePoint{Duration{static_cast<double...
```c++ // Copyright (c) 2013-2021 mogemimi. Distributed under the MIT license. #include "TimeSourceEmscripten.hpp" #include <emscripten.h> #include <type_traits> namespace Pomdog::Detail::Emscripten { TimePoint TimeSourceEmscripten::Now() const { const auto now = ::emscripten_get_now(); static_assert(std::is...
7e40761e-c920-4a7e-860d-c29e4c3fb2b7
{ "language": "C++" }
```c++ #include <mpi.h> #include <iostream> using namespace std; int main() { MPI::Init(); int rank = MPI::COMM_WORLD.Get_rank(); int size = MPI::COMM_WORLD.Get_size(); cout << "Hello from rank " << rank << " of " << size << "!" << endl; MPI::Finalize(); } ``` Print hostname where hellompi runs
```c++ #include <cstdlib> #include <iostream> #include <mpi.h> #include <string> #ifndef HOST_NAME_MAX #define HOST_NAME_MAX 256 #endif using namespace std; int main() { MPI::Init(); int rank = MPI::COMM_WORLD.Get_rank(); int size = MPI::COMM_WORLD.Get_size(); char host[HOST_NAME_MAX]; int status = gethostnam...
b8761912-7210-4556-a378-6997a91f00a2
{ "language": "C++" }
```c++ /** * \ file WhiteNoiseGeneratorFilter.cpp */ #include <cmath> #include <ATK/Tools/WhiteNoiseGeneratorFilter.h> #include <array> #define BOOST_TEST_DYN_LINK #define BOOST_TEST_NO_MAIN #include <boost/test/unit_test.hpp> const size_t PROCESSSIZE = 1024*1024; BOOST_AUTO_TEST_CASE( WhiteNoiseGeneratorFilter...
```c++ /** * \ file WhiteNoiseGeneratorFilter.cpp */ #include <cmath> #include <ATK/Tools/WhiteNoiseGeneratorFilter.h> #include <array> #define BOOST_TEST_DYN_LINK #define BOOST_TEST_NO_MAIN #include <boost/test/unit_test.hpp> const size_t PROCESSSIZE = 1024*1024; BOOST_AUTO_TEST_CASE( WhiteNoiseGeneratorFilter...
c1a6b4cf-56ea-4619-9b25-60b763ae2fc9
{ "language": "C++" }
```c++ #include "RoundRobinPartitioner.hpp" #include <vector> #include <iostream> #include "LogicalProcess.hpp" namespace warped { std::vector<std::vector<LogicalProcess*>> RoundRobinPartitioner::partition( const std::vector<LogicalProcess*>& lps, ...
```c++ #include "RoundRobinPartitioner.hpp" #include <vector> #include <iostream> #include "LogicalProcess.hpp" namespace warped { std::vector<std::vector<LogicalProcess*>> RoundRobinPartitioner::partition( const std::vector<LogicalProcess*>& lps, ...
0396591c-4451-4b97-8f9e-2bd201245a64
{ "language": "C++" }
```c++ //===-- Passes.cpp - Target independent code generation passes ------------===// // // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===---...
```c++ //===-- Passes.cpp - Target independent code generation passes ------------===// // // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===---...
241629bc-8cb4-4af2-9751-d190f4cfb615
{ "language": "C++" }
```c++ // This file is part of the GLERI project // // Copyright (c) 2012 by Mike Sharov <msharov@users.sourceforge.net> // This file is free software, distributed under the MIT License. #include "rglrp.h" #define N(n,s) "\0" #n "\0" #s "\0" /*static*/ const char PRGLR::_cmdNames[] = N(Error,s) N(Restate,(q...
```c++ // This file is part of the GLERI project // // Copyright (c) 2012 by Mike Sharov <msharov@users.sourceforge.net> // This file is free software, distributed under the MIT License. #include "rglrp.h" #define N(n,s) "\0" #n "\0" #s "\0" /*static*/ const char PRGLR::_cmdNames[] = N(GLError,s) N(Restate,...
d6449d36-94e0-445d-9040-603b4ced34a5
{ "language": "C++" }
```c++ #include "lexical/Lexical.h" #include <iostream> #include <vector> #include <string> using namespace std; using namespace ecc; int main() { Lexical lexical( "/home/amir/github/EasyCC-CPP/lexical/state_machine.json", "/home/amir/github/EasyCC-CPP/lexical/config.json", "/home/amir/github/EasyC...
```c++ #include "lexical/Lexical.h" #include <iostream> #include <vector> #include <string> using namespace std; using namespace ecc; int main() { Lexical lexical( "/home/amir/github/EasyCC-CPP/lexical/state_machine.json", "/home/amir/github/EasyCC-CPP/lexical/config.json", "/home/amir/github/EasyC...
9c310b99-740f-4e27-b3a9-fe84fa4b5310
{ "language": "C++" }
```c++ #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } ``` Add initialize tauComboBox in MainWindow class constructor.
```c++ #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QStringList tauList; tauList << "1" << "0.1" << "0.01" << "0.001" << "0.0001"; ui->tauComboBox->addItems(tauList); } MainWindow::...
f4dbc269-a6c8-4543-9a8c-d6165d96f508
{ "language": "C++" }
```c++ #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file #include "catch.hpp" #include "EasyRandom.hpp" using namespace EasyRandom; TEST_CASE( "TEST_TEST", "RANDOM" ) { const auto randomNumber = Random::get( ); REQUIRE( randomNumber >= -10 ); REQUIRE( random...
```c++ #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file #include "catch.hpp" #include "EasyRandom.hpp" #include <limits> using namespace EasyRandom; TEST_CASE( "Test random random" ) { const auto firstRandomNumber = Random::get( std::numeric_limits<std::intmax_t>::...
25689e1e-9bd2-4006-8606-61fd91fd3df4
{ "language": "C++" }
```c++ /* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #include "halfling/halfling_engine.h" #include "crate_demo/graphics_manager.h" #include "crate_demo/game_state_manager.h" int WINAPI WinMain(HINSTANCE...
```c++ /* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #include "halfling/halfling_engine.h" #include "crate_demo/graphics_manager.h" #include "crate_demo/game_state_manager.h" int WINAPI WinMain(HINSTANCE...
614cdb72-5478-4cbc-95f9-4a455902a1f9
{ "language": "C++" }
```c++ /* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #include "halfling/halfling_engine.h" #include "crate_demo/graphics_manager.h" #include "crate_demo/game_state_manager.h" namespace CrateDemo { int A...
```c++ /* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #include "halfling/halfling_engine.h" #include "crate_demo/graphics_manager.h" #include "crate_demo/game_state_manager.h" int WINAPI WinMain(HINSTANCE...
8bcfbd33-82a5-4bb9-bf62-76593d43a445
{ "language": "C++" }
```c++ #include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <boost/make_shared.hpp> #include <boost/bind.hpp> #include <boost/lambda/lambda.hpp> #include <boost/foreach.hpp> #include <boost/type_traits.hpp> #define foreach BOOST_FOREACH #include <vector> #include <string> #include <algorithm> #inclu...
```c++ #include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <boost/make_shared.hpp> #include <boost/bind.hpp> #include <boost/lambda/lambda.hpp> #include <boost/foreach.hpp> #include <boost/type_traits.hpp> #define foreach BOOST_FOREACH #include <vector> #include <string> #include <algorithm> #inclu...
d2c421f9-5b5b-4993-b372-6056445bb345
{ "language": "C++" }
```c++ //===-- HexagonMCAsmInfo.cpp - Hexagon asm properties ---------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===-- HexagonMCAsmInfo.cpp - Hexagon asm properties ---------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
2b92f700-3ed9-4efd-8731-6117191c3eec
{ "language": "C++" }
```c++ // Author: Shengjia Yan // Date: 2017年7月1日 // Email: sjyan@seu.edu.cn // Time Complexity: O(logn) // Space Complexity: O(1) class Solution { public: /** * @param A an integer array sorted in ascending order * @param target an integer * @return an integer */ int findPosition(vector<i...
```c++ // Author: Shengjia Yan // Date: 2017年7月1日 // Email: sjyan@seu.edu.cn // Time Complexity: O(logn) // Space Complexity: O(1) // 经典二分查找问题 class Solution { public: /** * @param A an integer array sorted in ascending order * @param target an integer * @return an integer */ int findPosit...
23b07773-b970-45b8-8ef1-4502a7e34093
{ "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 "chrome/browser/app_modal_dialog_queue.h" #include "chrome/browser/browser_list.h" void AppModalDialogQueue::AddDialog(AppModal...
```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 "chrome/browser/app_modal_dialog_queue.h" #include "chrome/browser/browser_list.h" void AppModalDialogQueue::AddDialog(AppModal...
c3905bef-a583-48c0-af99-1e69b54c6091
{ "language": "C++" }
```c++ #include "DocumentIteratorContainer.h" #include "DocumentIterator.h" #include "CombinedDocumentIterator.h" using namespace sf1r; DocumentIteratorContainer::~DocumentIteratorContainer() { for (std::vector<DocumentIterator*>::iterator it = docIters_.begin(); it != docIters_.end(); ++it) { ...
```c++ #include "DocumentIteratorContainer.h" #include "DocumentIterator.h" #include "CombinedDocumentIterator.h" using namespace sf1r; DocumentIteratorContainer::~DocumentIteratorContainer() { for (std::vector<DocumentIterator*>::iterator it = docIters_.begin(); it != docIters_.end(); ++it) { ...
41ef9b62-b2ef-4282-8089-0767857605c8
{ "language": "C++" }
```c++ #include "shiftrConnector.h" #include <Bridge.h> void ShiftrConnector::init(const char* deviceLogin, const char* pwd) { client.begin("broker.shiftr.io"); this->deviceLogin = deviceLogin; this->pwd = pwd; connect(); client.subscribe("/bottle-openner"); // client.unsubscribe("/bottle-openner"); }...
```c++ #include "shiftrConnector.h" #include <Bridge.h> void ShiftrConnector::init(const char* deviceLogin, const char* pwd) { client.begin("broker.shiftr.io"); this->deviceLogin = deviceLogin; this->pwd = pwd; connect(); client.subscribe("/bottle-openner"); // client.unsubscribe("/bottle-openner"); }...
9c1dab22-3d9c-4600-9d5b-f7060909d8d7
{ "language": "C++" }
```c++ /* * Copyright 2014 Matthias Fuchs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or ag...
```c++ /* * Copyright 2014 Matthias Fuchs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or ag...
07364d42-a51b-4d61-b05d-c66ff599ebe7
{ "language": "C++" }
```c++ // Copyright 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/posix/safe_strerror.h" #include <errno.h> #include <stdio.h> #include <string.h> #include "base/stl_util.h" namespace base { voi...
```c++ // Copyright 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/posix/safe_strerror.h" #include <errno.h> #include <stdio.h> #include <string.h> #include "base/stl_util.h" #include "build/build_...
a90ed83f-953c-4bdf-9e88-467ff921dcb9
{ "language": "C++" }
```c++ #include <gtest/gtest.h> #include "OnOffSwitch.h" TEST(TestOnOffSwitch, main) { using namespace antoniocoratelli; OnOffSwitch on_off_switch; std::cout << on_off_switch.info() << std::endl; EXPECT_EQ(true, on_off_switch.in<StateOff>()); EXPECT_EQ(false, on_off_switch.in<StateOn>()); on...
```c++ #include <gtest/gtest.h> #include "OnOffSwitch.h" TEST(TestOnOffSwitch, main) { using namespace antoniocoratelli; // Initializing the switch: it's Off by default. OnOffSwitch on_off_switch; std::cout << on_off_switch.info() << std::endl; EXPECT_EQ(true, on_off_switch.in<StateOff>()); EX...
b262c5c8-5bd9-48eb-b875-2f8c70e04988
{ "language": "C++" }
```c++ #include "qniteartist.h" QniteArtist::QniteArtist(QQuickItem* parent): QQuickItem(parent), m_axes{nullptr}, m_selectable{false} { } QniteArtist::~QniteArtist() { } QniteAxes* QniteArtist::axes() const { return m_axes; } void QniteArtist::setAxes(QniteAxes* axes) { if (m_axes != axes) { m_axes =...
```c++ #include "qniteartist.h" #include "qniteaxes.h" QniteArtist::QniteArtist(QQuickItem* parent): QQuickItem(parent), m_axes{nullptr}, m_selectable{false} { } QniteArtist::~QniteArtist() { } QniteAxes* QniteArtist::axes() const { return m_axes; } void QniteArtist::setAxes(QniteAxes* axes) { if (m_axes ...
c8c15fdb-406a-485e-867d-0f8044d7c39f
{ "language": "C++" }
```c++ #include <numeric> #include <vector> #include "bulk/bulk.hpp" #include "set_backend.hpp" int main() { environment env; env.spawn(env.available_processors(), [](bulk::world& world, int s, int p) { // block distribution int size = 10; std::vector<int> xs(size); std::vect...
```c++ #include <numeric> #include <vector> #include "bulk/bulk.hpp" #include "set_backend.hpp" int main() { environment env; env.spawn(env.available_processors(), [](bulk::world& world, int s, int p) { // block distribution int size = 1000; int local_size = size / p; std::ve...
a3f69ca0-4240-4643-a671-f35478d3d944
{ "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"); ...
32c815ed-8b3e-49d5-b594-a7c751304b99
{ "language": "C++" }
```c++ #include "keytar.h" namespace keytar { bool AddPassword(const std::string& service, const std::string& account, const std::string& password) { return false; } bool GetPassword(const std::string& service, const std::string& account, std::str...
```c++ #include "keytar.h" #include <gnome-keyring.h> namespace keytar { namespace { const GnomeKeyringPasswordSchema kGnomeSchema = { GNOME_KEYRING_ITEM_GENERIC_SECRET, { { "service", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, { "account", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, { NULL } } }; } // nam...
78e05191-59b0-42a3-ba00-120ac68a7891
{ "language": "C++" }
```c++ // Copyright (c) 2020-2022 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include <config/bitcoin-config.h> #endif #include <tinyformat.h> #include <util/syserror....
```c++ // Copyright (c) 2020-2022 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include <config/bitcoin-config.h> #endif #include <tinyformat.h> #include <util/syserror....
6315bb08-f4c3-41d5-a698-0a148990810d
{ "language": "C++" }
```c++ #include <iostream> #include "../src/ADSR.h" using namespace std; int main() { homu::ADSR adsr(10000); adsr.setAttack(0); adsr.setDecay(0); adsr.setSustain(1); adsr.setRelease(0); adsr.start(); for (int i = 0; i < 10000; ++i) { float s = adsr.nextSample(); if (i >= ...
```c++ #include <iostream> #include "../src/ADSR.h" using namespace std; int main() { homu::ADSR adsr(10000); adsr.setAttack(0); adsr.setDecay(0); adsr.setSustain(1); adsr.setRelease(0); adsr.start(); for (int i = 0; i < 1000; ++i) { float s = adsr.nextSample(); if (i >= 5...
4dcaf1f1-d6c9-442b-b587-cf10d385aad8
{ "language": "C++" }
```c++ #include <gtest/gtest.h> #include <tudocomp/util/vbyte.hpp> #include "tudocomp/tudocomp.hpp" #include "test/util.hpp" using namespace tdc; template<class int_t> void test_vbyte(const int_t& i) { std::stringstream ss; write_vbyte(ss, i); DCHECK_EQ(read_vbyte<size_t>(ss), i) << ", contents of buffer: " << ve...
```c++ #include <gtest/gtest.h> #include <tudocomp/util/vbyte.hpp> #include "test/util.hpp" using namespace tdc; template<class int_t> void test_vbyte(const int_t& i) { std::stringstream ss; write_vbyte(ss, i); DCHECK_EQ(read_vbyte<size_t>(ss), i) << ", contents of buffer: " << vec_to_debug_string(ss.str()); } T...
78cfa45e-a70d-4f69-8c3a-264f0a585a8d
{ "language": "C++" }
```c++ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN #define BOOST_TEST_MODULE state #include <boost/test/unit_test.hpp> #include "response.h" BOOST_AUTO_TEST_CASE(boolean_success_false) { cJSON *id = cJSON_CreateString("request1"); cJSON *response = create_boolean_success_response(id, 0); cJSON *result = ...
```c++ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN #define BOOST_TEST_MODULE state #include <boost/test/unit_test.hpp> #include "response.h" BOOST_AUTO_TEST_CASE(boolean_success_false) { cJSON *id = cJSON_CreateString("request1"); cJSON *response = create_boolean_success_response(id, 0); cJSON *result = ...
1115cd26-898e-4bf4-8eae-803ae68e37c9
{ "language": "C++" }
```c++ #include <Spark/SparseLinearSolvers.hpp> #include <iostream> Eigen::VectorXd spark::sparse_linear_solvers::DfeBiCgSolver::solve( const Eigen::SparseMatrix<double>& A, const Eigen::VectorXd& b) { Eigen::VectorXd vd(b.size()); return vd; } ``` Add hand written preconditioned bicgstab
```c++ #include <Spark/SparseLinearSolvers.hpp> #include <iostream> #include <stdexcept> using Vd = Eigen::VectorXd; Eigen::VectorXd spark::sparse_linear_solvers::DfeBiCgSolver::solve( const Eigen::SparseMatrix<double>& A, const Eigen::VectorXd& b) { std::cout << "Running bicgstab!!!" << st...
414dc160-1fb2-4abb-9e26-6f9908e8bce5
{ "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/IncludeTask.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/IncludeTask.hpp> #i...
cba16139-bd13-435e-85d8-881c44f3e479
{ "language": "C++" }
```c++ #ifndef WARGEN_CPP #define WARGEN_CPP #include <algorithm> #include <vector> #include <iostream> #include <fstream> int main() { std::vector<char> cards = {'1','1','1','1','2','2','2','2','3','3','3','3','4','4','4','4','5','5','5','5','6','6','6','6','7','7','7','7','8','8','8','8','9','9','9','9','T','T','T...
```c++ #ifndef WARGEN_CPP #define WARGEN_CPP #include <algorithm> #include <vector> #include <iostream> #include <fstream> int main() { std::vector<char> cards = {'1','1','1','1','2','2','2','2','3','3','3','3','4','4','4','4','5','5','5','5','6','6','6','6','7','7','7','7','8','8','8','8','9','9','9','9','T','T','T...
06edaab5-6e0f-4bf7-a0bd-68f5bb5b811c
{ "language": "C++" }
```c++ #include "params.hpp" #include "../coding/multilang_utf8_string.hpp" namespace search { SearchParams::SearchParams() : m_inputLanguageCode(StringUtf8Multilang::UNSUPPORTED_LANGUAGE_CODE), m_searchMode(ALL), m_validPos(false) { } void SearchParams::SetPosition(double lat, double lon) { m_lat = lat; m_l...
```c++ #include "params.hpp" #include "../coding/multilang_utf8_string.hpp" namespace search { SearchParams::SearchParams() : m_inputLanguageCode(StringUtf8Multilang::UNSUPPORTED_LANGUAGE_CODE), m_searchMode(ALL), m_validPos(false) { } void SearchParams::SetPosition(double lat, double lon) { m_lat = lat; m_l...
335e9642-827e-4a7a-8383-68b582ad136f
{ "language": "C++" }
```c++ #include "grune/all.hpp" #include <boost/filesystem.hpp> #include <fstream> #define ADD_TEST(name) \ extern void name(std::ostream&); ADD_TEST(test_anbncn); ADD_TEST(test_numbers); ADD_TEST(test_numbers_simple); ADD_TEST(test_tdh); ADD_TEST(test_turtle); typedef void (*test_fcn_t)(std::ostream&); void ru...
```c++ #include "grune/all.hpp" #include <boost/filesystem.hpp> #include <fstream> #define ADD_TEST(name) \ extern void name(std::ostream&); ADD_TEST(test_anbncn); ADD_TEST(test_numbers); ADD_TEST(test_numbers_simple); ADD_TEST(test_tdh); ADD_TEST(test_turtle); typedef void (*test_fcn_t)(std::ostream&); void r...
b7204353-acfe-44eb-ae54-9a2ed76fe302
{ "language": "C++" }
```c++ // // Gyroid.cpp // VolumeRenderer // // Created by Calvin Loncaric on 6/26/11. // #include "Gyroid.h" #include <cmath> float Gyroid::valueAt(float x, float y, float z) const { return (cosf(x) * sinf(y) + cosf(y) * sinf(z) + cosf(z) * sinf(x)); } vector Gyroid::gradientAt(float x, float y, float z) con...
```c++ // // Gyroid.cpp // VolumeRenderer // // Created by Calvin Loncaric on 6/26/11. // #include "Gyroid.h" #include <cmath> float Gyroid::valueAt(float x, float y, float z) const { return (cosf(x) * sinf(y) + cosf(y) * sinf(z) + cosf(z) * sinf(x)); } vector Gyroid::gradientAt(float x, float y, float z) con...
f86555f7-c676-4020-90fb-79af7e95b458
{ "language": "C++" }
```c++ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <string.h> #include <stdio.h> #include <excpt.h> #include "sapi4.hpp" int main(int argc, char** argv) { VOICE_INFO VoiceInfo; if (!InitializeForVoice(argv[1], &VoiceInfo)) { return 0; } UINT64 Len; LPSTR outFile = (LPSTR)malloc(17); GetTTS(&...
```c++ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <string.h> #include <stdio.h> #include <excpt.h> #include "sapi4.hpp" int main(int argc, char** argv) { VOICE_INFO VoiceInfo; if (!InitializeForVoice(argv[1], &VoiceInfo)) { return 0; } UINT64 Len; LPSTR outFile[17]; GetTTS(&VoiceInfo, atoi(...
fe2d7f81-fc12-4697-893e-0043884b63bd
{ "language": "C++" }
```c++ #pragma warning( disable : 4350 ) #pragma warning(push, 3) #include <iostream> #pragma warning(pop) int main(int , char **) { std::cout << "Hello CI!" << std::endl; return 0; } #pragma warning( disable : 4710 4514) ``` Make MSVC release build actually work
```c++ #pragma warning( disable : 4350 4710 ) #pragma warning(push, 3) #include <iostream> #pragma warning(pop) int main(int , char **) { std::cout << "Hello CI!" << std::endl; return 0; } #pragma warning( disable : 4514) ```
d0e94b5b-06bf-4628-819d-59494b26fe14
{ "language": "C++" }
```c++ #include <spdlog/spdlog.h> int main(int argc, char* argv[]) { auto console = spdlog::stdout_logger_mt("console"); console->info("Hello from INFO"); } ``` Fix missing include in the example
```c++ #include <spdlog/spdlog.h> #include <spdlog/sinks/stdout_sinks.h> int main(int argc, char* argv[]) { auto console = spdlog::stdout_logger_mt("console"); console->info("Hello from INFO"); return 0; } ```
c2e60405-c18f-4157-8897-457a4c5adc0e
{ "language": "C++" }
```c++ // // Created by Jan de Visser on 2021-09-22. // #include <core/Format.h> #include <core/StringUtil.h> #include <gtest/gtest.h> TEST(Format, format_int) { std::string formatted = Obelix::format("{}", 42); EXPECT_EQ(formatted, "42"); } TEST(Format, format_string) { std::string formatted = Obelix::f...
```c++ // // Created by Jan de Visser on 2021-09-22. // #include <core/Format.h> #include <core/StringUtil.h> #include <gtest/gtest.h> TEST(Format, format_int) { std::string formatted = Obelix::format("{}", 42); EXPECT_EQ(formatted, "42"); } TEST(Format, format_string) { std::string formatted = Obelix::f...
e45a970f-7e06-43f1-90c5-da4c4f4dc1cd
{ "language": "C++" }
```c++ /** * \file * \brief chip::lowLevelInitialization() implementation for STM32F0 * * \author Copyright (C) 2016 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info * * \par License * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL ...
```c++ /** * \file * \brief chip::lowLevelInitialization() implementation for STM32F0 * * \author Copyright (C) 2016 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info * * \par License * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL ...
3a24acd5-bf2d-4ea7-92f1-fcd5a923cceb
{ "language": "C++" }
```c++ #include "sn_sweeper_dd.hpp" namespace mocc { namespace sn { void SnSweeper_DD::sweep( int group ) { // Store the transport cross section somewhere useful for( auto &xsr: *xs_mesh_ ) { real_t xstr = xsr.xsmactr()[group]; for( auto &ireg: xsr.reg() ) { ...
```c++ #include "sn_sweeper_dd.hpp" namespace mocc { namespace sn { void SnSweeper_DD::sweep( int group ) { // Store the transport cross section somewhere useful for( auto &xsr: *xs_mesh_ ) { real_t xstr = xsr.xsmactr()[group]; for( auto &ireg: xsr.reg() ) { ...
d3d34c84-0c48-447a-ab42-a2443279c691
{ "language": "C++" }
```c++ // Licensed under the Apache License, Version 2.0. #include "support.h" #include <clocale> #include <cstdio> #include <cwchar> #include <sys/ioctl.h> #include <unistd.h> void setup() { setlocale(LC_ALL, "en_US.UTF-8"); } void clear_screen() { fputws(L"\033[2J\033[1;1H", stdout); } std::pair<size_t, size_t>...
```c++ // Licensed under the Apache License, Version 2.0. #include "support.h" #include <clocale> #include <cstdio> #include <cwchar> #include <sys/ioctl.h> #include <unistd.h> void setup() { setlocale(LC_ALL, "C.UTF-8"); } void clear_screen() { fputws(L"\033[2J\033[1;1H", stdout); } std::pair<size_t, size_t> scr...
0cc7a387-dce5-48cc-bf23-7f411baa65cc
{ "language": "C++" }
```c++ #include "partition.hpp" namespace SorterThreadedHelper { Partition::Partition(const std::set<double>::iterator pivotsBegin, const std::set<double>::iterator pivotsEnd, const std::vector<double>::iterator chunkBegin, const std::vector<doub...
```c++ #include "partition.hpp" namespace SorterThreadedHelper { Partition::Partition(const std::set<double>::iterator pivotsBegin, const std::set<double>::iterator pivotsEnd, const std::vector<double>::iterator chunkBegin, const std::vector<doub...
4fa62b0d-aed6-4103-8b15-15c2d35057b8
{ "language": "C++" }
```c++ #include <node.h> #include <v8.h> #ifdef _WIN32 #include "notificationstate-query.h" #endif using namespace v8; void Method(const v8::FunctionCallbackInfo<Value>& args) { Isolate* isolate = Isolate::GetCurrent(); HandleScope scope(isolate); int returnValue = -1; #ifdef _WIN32 returnValue = queryU...
```c++ #include <node.h> #include <v8.h> #ifdef _WIN32 #include "notificationstate-query.h" #endif using namespace v8; void Method(const v8::FunctionCallbackInfo<Value>& args) { Isolate* isolate = Isolate::GetCurrent(); HandleScope scope(isolate); int returnValue = -1; #ifdef _WIN32 returnValue = queryU...
699749d9-5de5-48e3-9f67-a02d31449007
{ "language": "C++" }
```c++ // NoteTrainer (c) 2016 Andrey Fidrya. MIT license. See LICENSE for more information. #include "Note.h" QString noteName(Note note) { switch (note) { case Note::C: return "do"; case Note::Cis: return "di"; case Note::D: return "re"; case Note::Ees: return "me"; case Note::E: retur...
```c++ // NoteTrainer (c) 2016 Andrey Fidrya. MIT license. See LICENSE for more information. #include "Note.h" #include "Utils/Utils.h" QString noteName(Note note) { switch (note) { case Note::C: return "do"; case Note::Cis: return "di"; case Note::D: return "re"; case Note::Ees: return "me"; ...
0545c9b4-5db9-45ca-bf6c-452c50578daa
{ "language": "C++" }
```c++ // This is the starting point // #include <iostream> #include <fstream> #include <sstream> int main() { std::string firstInputString; std::string secondInputString; std::cout << "Enter the first string" << std::endl; std::cin >> firstInputString; std::cout << "Enter the second string" << st...
```c++ // This is the starting point // #include <iostream> #include <fstream> #include <sstream> int main() { std::string first_input; std::string second_input; std::cout << "Enter the first string" << std::endl; std::cin >> first_input; std::cout << "Enter the second string" << std::endl; st...
821ed90a-d4b1-45e6-8dca-4e511d079d66
{ "language": "C++" }
```c++ #include <string> #include <benchmark/benchmark.h> #include "farmhash.h" static void BM_Farmhash(benchmark::State& state) { auto payload = std::string(state.range(0), '.'); while (state.KeepRunning()) util::Hash64(payload); state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(state.range(0)))...
```c++ #include <string> #include <benchmark/benchmark.h> #include "farmhash.h" static void BM_Farmhash(benchmark::State& state) { auto payload = std::string(state.range(0), '.'); for (auto _ : state) util::Hash64(payload); state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(state.range(0))); } //...
108da583-56ee-4a8e-8ef9-ba0f074a41b4
{ "language": "C++" }
```c++ #include "htmlsnap.h" #include <QPainter> #include <QDebug> #include <QWebFrame> #include <QTimer> #include <iostream> #include <QBuffer> HtmlSnap::HtmlSnap() { connect(&page, SIGNAL(loadFinished(bool)), this, SLOT(render())); } void HtmlSnap::loadHtml(char* html) { page.mainFrame()->setHtml(QString(ht...
```c++ #include "htmlsnap.h" #include <QPainter> #include <QDebug> #include <QWebFrame> #include <QTimer> #include <iostream> #include <QBuffer> HtmlSnap::HtmlSnap() { connect(&page, SIGNAL(loadFinished(bool)), this, SLOT(render())); } void HtmlSnap::loadHtml(char* html) { page.mainFrame()->setHtml(QString(ht...
8f436713-7ddb-4fa0-9c8f-eb8090e22f71
{ "language": "C++" }
```c++ #include "executor.h" #include <chrono> const std::time_t Executor::waitOnNullTask; const std::time_t Executor::waitOnEndTask; Executor::Executor(int id) : Thread(id), cLog("Executor #" + std::to_string(id)) { } Executor::~Executor() { } void Executor::SetTasksPool(TasksPool& p) { tasksPool = &p; } ...
```c++ #include "executor.h" #include <chrono> const std::time_t Executor::waitOnNullTask; const std::time_t Executor::waitOnEndTask; Executor::Executor(int id) : Thread(id), cLog("Executor #" + std::to_string(id)) { } Executor::~Executor() { } void Executor::SetTasksPool(TasksPool& p) { tasksPool = &p; } ...
8038de76-90f4-4ac4-8beb-9a412bcbb5df
{ "language": "C++" }
```c++ #include "Data.hpp" #include <stdexcept> #include <string> namespace Tools { Data::BitsType getBitsFromString(const std::string& buf) { Data::BitsType bits(buf.size()); for (size_t i = 0; i < buf.size(); ++i) { if (buf[i] == '0') bits[i] = 0; else if (buf[i] == '1') bits[i] = 1; ...
```c++ #include "Data.hpp" #include <stdexcept> #include <string> namespace Tools { Data::BitsType getBitsFromString(const std::string& buf) { Data::BitsType bits(buf.size()); for (size_t i = 0; i < buf.size(); ++i) { if (buf[i] == '0') bits[i] = 0; else if (buf[i] == '1') bits[i] = 1; ...
e05578cb-9032-40b5-ae7f-6d5dac003b84
{ "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...
675d9cf0-6b48-43f6-9c53-e71517be920a
{ "language": "C++" }
```c++ // Copyright 2015-2017 Directive Games Limited - All Rights Reserved #include "DriftPrivatePCH.h" #include "AndroidSecureStorage.h" #include "FileHelper.h" #if PLATFORM_ANDROID AndroidSecureStorage::AndroidSecureStorage(const FString& productName, const FString& serviceName) : productName_{ productName } ,...
```c++ // Copyright 2015-2017 Directive Games Limited - All Rights Reserved #include "DriftPrivatePCH.h" #include "AndroidSecureStorage.h" #include "FileHelper.h" #if PLATFORM_ANDROID AndroidSecureStorage::AndroidSecureStorage(const FString& productName, const FString& serviceName) : productName_{ productName } ,...
dda78984-6090-4484-b488-73e178d2d88b
{ "language": "C++" }
```c++ #include <cassert> #include <cmath> #include <limits> #include <serializer.h> void test(const double in) { Serializer s; writer<decltype(+in)>::write(s, in); const auto buf = s.data(); Deserializer d(s.buffer, s.buffer.size() - buf.second); const auto out = reader<decltype(+in)>::read(d); assert(in ...
```c++ #include <cassert> #include <cmath> #include <limits> #include <serializer.h> void test(const double in) { Serializer s; writer<decltype(+in)>::write(s, in); const auto buf = s.data(); Deserializer d(s.buffer, s.buffer.size() - buf.second); const auto out = reader<decltype(+in)>::read(d); assert(in ...
23048baf-1bb0-4bb8-b6a9-b9abaaaa2033
{ "language": "C++" }
```c++ #include "queryconfig.h" #include <thread> annis::QueryConfig::QueryConfig() : optimize(true), forceFallback(false), avoidNestedBySwitch(true), numOfParallelTasks(std::thread::hardware_concurrency()) { } ``` Change default config to use one thread less that CPUS available for the thread pool. Since th...
```c++ #include "queryconfig.h" #include <thread> annis::QueryConfig::QueryConfig() : optimize(true), forceFallback(false), avoidNestedBySwitch(true), numOfParallelTasks(std::thread::hardware_concurrency()-1) { } ```
af9b5556-9f59-4c4c-8fce-382c65ff6792
{ "language": "C++" }
```c++ #include <QApplication> #include <QDeclarativeView> #include <QUrl> #include <MDeclarativeCache> Q_DECL_EXPORT int main(int argc, char** argv) { QApplication* app = MDeclarativeCache::qApplication(argc, argv); QDeclarativeView viewer; viewer.setSource(QUrl("qrc:/qml/main.qml")); viewer.showFull...
```c++ #include <QApplication> #include <QDeclarativeView> #include <QUrl> #include <qplatformdefs.h> #if defined(MEEGO_EDITION_HARMATTAN) #include <MDeclarativeCache> #define NEW_QAPPLICATION(x, y) MDeclarativeCache::qApplication((x), (y)) Q_DECL_EXPORT #else #define NEW_QAPPLICATION(x, y) new QApplic...
f866f08c-f706-45f1-9d8e-43740b181563
{ "language": "C++" }
```c++ #include "gtest/gtest.h" //#include <nr.h> //#include <nrutil.h> #include "packages/transformation/src/newt2.cc" #include <irtkTransformation.h> const double EPSILON = 0.001; TEST(Packages_Transformation_newt2, irtkMultiLevelFreeFormTransformation_Inverse) { irtkCifstream iStream; iStream.Open("/vol/med...
```c++ #include "gtest/gtest.h" #include <irtkTransformation.h> const double EPSILON = 0.001; TEST(Packages_Transformation_newt2, irtkMultiLevelFreeFormTransformation_Inverse) { irtkCifstream iStream; iStream.Open("/vol/medic02/users/sp2010/PhD/Tumor/dofs/gradientnreg2-NGP-HG01.dof.gz"); irtkMultiLevelFreeF...
1838adee-bf38-42f0-a0b1-011a12276675
{ "language": "C++" }
```c++ #include "rubybasic/BindApplication.hpp" #include "mruby.h" #include "mrubybind.h" #include "ofAppRunner.h" namespace { static float get_frame_rate() { return ofGetFrameRate(); } static void set_window_pos(int x, int y) { ofSetWindowPosition(x, y); } static void set_window_size(int width, int heigh...
```c++ #include "rubybasic/BindApplication.hpp" #include "mruby.h" #include "mrubybind.h" #include "ofAppRunner.h" namespace { static float get_frame_rate() { return ofGetFrameRate(); } static void set_window_pos(int x, int y) { ofSetWindowPosition(x, y); } static void set_window_size(int width, int heigh...
7743c2ec-8ed5-44ff-8224-89e89dd5b2bd
{ "language": "C++" }
```c++ MATCH_TEST("x", UNANCHORED, "x"); MATCH_TEST("x", UNANCHORED, "xyz"); MATCH_TEST("x", UNANCHORED, "uvwx"); MATCH_TEST("x", UNANCHORED, "uvwxyz"); MATCH_TEST("x", ANCHOR_START, "x"); MATCH_TEST("x", ANCHOR_START, "xyz"); MATCH_TEST("x", ANCHOR_START, "uvwx"); MATCH_TEST("x", ANCHOR_START, "uvwxyz"); MATCH_TEST(...
```c++ MATCH_TEST("x", UNANCHORED, "x"); MATCH_TEST("x", UNANCHORED, "xyz"); MATCH_TEST("x", UNANCHORED, "uvwx"); MATCH_TEST("x", UNANCHORED, "uvwxyz"); MATCH_TEST("x", ANCHOR_START, "x"); MATCH_TEST("x", ANCHOR_START, "xyz"); MATCH_TEST("x", ANCHOR_START, "uvwx"); MATCH_TEST("x", ANCHOR_START, "uvwxyz"); MATCH_TEST(...
75aa6cc2-411b-422a-9855-66f370ca43d6
{ "language": "C++" }
```c++ //===- llvm/unittest/Support/DebugTest.cpp --------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===- llvm/unittest/Support/DebugTest.cpp --------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...