doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
d1dbabd2-0417-41b5-bf2d-d611c4628352
{ "language": "C++" }
```c++ #include <stan/math/rev/scal.hpp> #include <gtest/gtest.h> #include <test/unit/math/rev/scal/util.hpp> #include <limits> TEST(MathFunctions, is_any_nan_variadic_rev) { using stan::math::is_any_nan; double dbl_inf = std::numeric_limits<double>::infinity(); double dbl_nan = std::numeric_limits<double>::qui...
```c++ #include <stan/math/rev/scal.hpp> #include <gtest/gtest.h> #include <test/unit/math/rev/scal/util.hpp> #include <test/unit/math/rev/scal/fun/util.hpp> #include <limits> TEST(MathFunctions, is_any_nan_variadic_rev) { using stan::math::is_any_nan; double dbl_inf = std::numeric_limits<double>::infinity(); d...
c2db3476-7b95-4b4f-af89-0b7ac62a2a15
{ "language": "C++" }
```c++ #include "module_wpad.hpp" using namespace com::googlecode::libproxy; static const char *DEFAULT_WPAD_ORDER[] = { "wpad_dhcp", "wpad_slp", "wpad_dns", "wpad_dnsdevolution", NULL }; bool wpad_module::operator<(const wpad_module& module) const { for (int i=0 ; DEFAULT_WPAD_ORDER[i] ; i++) { if (module.ge...
```c++ #include "module_wpad.hpp" using namespace com::googlecode::libproxy; static const char *DEFAULT_WPAD_ORDER[] = { "wpad_dhcp", "wpad_slp", "wpad_dns_srv", "wpad_dns_txt", "wpad_dns_alias", NULL }; bool wpad_module::operator<(const wpad_module& module) const { for (int i=0 ; DEFAULT_WPAD_ORDER[i] ; i++) ...
93ae56ec-a33e-4940-97e0-ffcbb459e3bc
{ "language": "C++" }
```c++ // REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix CHECK-...
```c++ // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \ // RUN: FileCheck %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \ // RUN: FileCheck %s extern "C" int printf(...); static int count; static float fcount; class xpto { public: xpto() : i(count++...
de028676-5ad3-4e9d-a35f-92828bb77bca
{ "language": "C++" }
```c++ #include "stdafx.h" #include "MultipleSenderTest.h" #include "EventSender.h" class MultiEventA: public virtual EventReceiver { public: virtual void EventA(void) = 0; }; class MultiEventB: public virtual EventReceiver { public: virtual void EventB(void) = 0; }; class MultiSender: public EventSender<M...
```c++ #include "stdafx.h" #include "MultipleSenderTest.h" #include "EventSender.h" class MultiEventA: public virtual EventReceiver { public: virtual void Event(void) = 0; }; class MultiEventB: public virtual EventReceiver { public: virtual void Event(void) = 0; }; class MultiSender: public EventSender<Mul...
cbaecc04-e6d8-4f83-8e28-87d1abd65285
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s // CHECK: DW_TAG_subrange_type struct StructName { int member[]; }; struct StructName SN; ``` Check that we have an unknown upper bound range for our flexible array members.
```c++ // RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s // CHECK: metadata !{i32 {{.*}}, i64 1, i64 0} ; [ DW_TAG_subrange_type ] struct StructName { int member[]; }; struct StructName SN; ```
29520218-07bc-470a-9e71-71e80033e97b
{ "language": "C++" }
```c++ #include "iorequest.h" #include <QtDebug> #include "event.h" #include "actions/action.h" IORequest::IORequest(Player* source, IORequest::RequestType type, int refCount) : QObject(NULL), mRefCount(refCount), m_source(source), m_type(type), m_response(NULL) { } IORequest::~IORequest() { } IO...
```c++ #include "iorequest.h" #include <QtDebug> #include "event.h" #include "actions/action.h" IORequest::IORequest(Player* source, IORequest::RequestType type, int refCount) : QObject(NULL), mRefCount(refCount), m_source(source), m_type(type), m_response(NULL) { } IORequest::~IORequest() { } IO...
8abc9cf1-f42d-4f95-b7b4-96b8124342fc
{ "language": "C++" }
```c++ #include "StdAfx.h" #include "BlackArea.h" /* RawSpeed - RAW file decoder. Copyright (C) 2009 Klaus Post 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; e...
```c++ #include "StdAfx.h" #include "BlackArea.h" /* RawSpeed - RAW file decoder. Copyright (C) 2009 Klaus Post 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; e...
4d69ace9-4ffa-417c-bb93-c885f7ed5cd0
{ "language": "C++" }
```c++ #include "perf_precomp.hpp" using namespace std; using namespace cv; using namespace perf; using std::tr1::make_tuple; using std::tr1::get; CV_ENUM(AgastType, AgastFeatureDetector::AGAST_5_8, AgastFeatureDetector::AGAST_7_12d, AgastFeatureDetector::AGAST_7_12s, AgastFeatureDetector::OAST_9_1...
```c++ #include "perf_precomp.hpp" using namespace std; using namespace cv; using namespace perf; using std::tr1::make_tuple; using std::tr1::get; CV_ENUM(AgastType, AgastFeatureDetector::AGAST_5_8, AgastFeatureDetector::AGAST_7_12d, AgastFeatureDetector::AGAST_7_12s, AgastFeatureDetector::OAST_9_1...
39bf7bdd-db4e-4cf4-8db4-ec9e2d3f743e
{ "language": "C++" }
```c++ #include "filename/ast/filename-node-conditional.h" #include "filename/ast/filename-visitor.h" FilenameNodeConditional::FilenameNodeConditional(FilenameNodeCondition *condition, FilenameNode *ifTrue, FilenameNode *ifFalse) : condition(condition), ifTrue(ifTrue), ifFalse(ifFalse) {} FilenameNodeConditional::~...
```c++ #include "filename/ast/filename-node-conditional.h" #include "filename/ast/filename-node-condition.h" #include "filename/ast/filename-visitor.h" FilenameNodeConditional::FilenameNodeConditional(FilenameNodeCondition *condition, FilenameNode *ifTrue, FilenameNode *ifFalse) : condition(condition), ifTrue(ifTrue...
df37f5e4-fd66-4c79-b59f-cea0f9c7425e
{ "language": "C++" }
```c++ #include <cstdlib> #include "Application/Parameters/ApplicationParameters.h" #include "Application/Parameters/ApplicationParametersBuilder.h" #include "Application/Parameters/ApplicationParametersManager.h" #include "Application/Parameters/ApplicationParametersReader.h" #include "FileSystem/Entities/Executable....
```c++ #include <cstdlib> #include "Application/Parameters/ApplicationParameters.h" #include "Application/Parameters/ApplicationParametersBuilder.h" #include "Application/Parameters/ApplicationParametersManager.h" #include "Application/Parameters/ApplicationParametersReader.h" #include "FileSystem/Entities/Executable....
1bef18ad-0b2c-4e2b-b7fc-157c7aa1b15f
{ "language": "C++" }
```c++ #include <stan/prob/distributions/univariate/continuous/Cauchy.hpp> #include <gtest/gtest.h> TEST(stanProbDistributionsUnivariateContinuousCauchy,headerParses) { EXPECT_TRUE(true); } ``` Fix case of cauchy.h header in test to allow to compile on Linux.
```c++ #include <stan/prob/distributions/univariate/continuous/cauchy.hpp> #include <gtest/gtest.h> TEST(stanProbDistributionsUnivariateContinuousCauchy,headerParses) { EXPECT_TRUE(true); } ```
a9a14057-af2a-4f85-85e7-4b3104fb844c
{ "language": "C++" }
```c++ // Use RAII types #include <map> #include <memory> #include <string> #include <vector> int main() { std::vector<int> vec = {1, 2, 3, 4, 5}; std::map<std::string, int> map = {{"Foo", 10}, {"Bar", 20}}; std::string str = "Some text"; std::unique_ptr<int> ptr1 = std::make_unique<int>(8); std::shared_ptr<int>...
```c++ // Use RAII types #include <map> #include <memory> #include <string> #include <vector> int main() { std::vector<int> vec = {1, 2, 3, 4, 5}; std::map<std::string, int> map = {{"Foo", 10}, {"Bar", 20}}; std::string str = "Some text"; std::unique_ptr<int> ptr1 = std::make_unique<int>(8); std::shared_ptr<int>...
79619cf2-dbc0-441f-9526-fc51506f2a8d
{ "language": "C++" }
```c++ #include "brents_fun.h" using namespace std; double fun1(double x) { return -2.0*x+1; } double fun2(double x) { return x*x-2.0*x-3; } void brents_fun_test() { double eta=1e-8; double x; x=brents_fun(fun1,-1.0,5.0,eta); if(abs(x-0.5)<eta) cout<<"brents_fun passed quadratic order test!\n...
```c++ #include "brents_fun.h" using namespace std; double fun1(double x) { return -2.0*x+1; } double fun2(double x) { return x*x-2.0*x-3; } double fun3(double x,double y) { return x*x-2.0*x-1.0-y; } void brents_fun_test() { double eta=1e-8; double x; x=brents_fun(fun1,-1.0,5.0,eta); if(a...
dcabb9c2-bb1a-4a11-8b57-b19649fde8bb
{ "language": "C++" }
```c++ #include "AddChunksStage.h" #include <globjects/globjects.h> #include <gloperate/painter/AbstractCameraCapability.h> using namespace gl; using namespace glm; using namespace globjects; AddChunksStage::AddChunksStage() : AbstractStage("AddChunks") { addInput("camera", camera); addOutput("chunksToAd...
```c++ #include "AddChunksStage.h" #include <globjects/globjects.h> #include <gloperate/painter/AbstractCameraCapability.h> using namespace gl; using namespace glm; using namespace globjects; AddChunksStage::AddChunksStage() : AbstractStage("AddChunks") { addInput("camera", camera); addOutput("chunksToAd...
7d5fe8de-ad98-492e-b0a4-db87951159d5
{ "language": "C++" }
```c++ #include <QtCore/QCoreApplication> #include <QNetworkAccessManager> #include <QTimer> #include <QJSonDocument> #include <QJsonObject> #include <QDebug> #include "../QPubNub.h" int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QNetworkAccessManager networkAccessManager; QPubNub pu...
```c++ #include <QtCore/QCoreApplication> #include <QNetworkAccessManager> #include <QTimer> #include <QJSonDocument> #include <QJsonObject> #include <QDebug> #include "../QPubNub.h" int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QNetworkAccessManager networkAccessManager; QPubNub pu...
8ab9be73-e508-4feb-a53b-2909b9531b27
{ "language": "C++" }
```c++ // Test for the leak_check_at_exit flag. // RUN: LSAN_BASE="use_stacks=0:use_registers=0" // RUN: %clangxx_lsan %s -o %t // RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do // RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-do // RUN: LSAN...
```c++ // Test for the leak_check_at_exit flag. // RUN: LSAN_BASE="use_stacks=0:use_registers=0" // RUN: %clangxx_lsan %s -o %t // RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do // RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-do // RUN: LSAN...
32186a34-d865-41fb-a0bc-bb898471ae46
{ "language": "C++" }
```c++ #include "TwoLevelDetection.h" #include <opencv2/imgproc/imgproc.hpp> void TwoLevelDetection(const cv::Mat& input, cv::Mat& output, double detectionLevel, double measurementLevel, TwoLevelDetectionTemp& temp) { if (measurementLevel > detectionLevel) { throw std::runtime_error("TwoLevelDetection: it ...
```c++ #include "TwoLevelDetection.h" #include <opencv2/imgproc/imgproc.hpp> void TwoLevelDetection(const cv::Mat& input, cv::Mat& output, double detectionLevel, double measurementLevel, TwoLevelDetectionTemp& temp) { if (measurementLevel > detectionLevel) { throw std::runtime_error("TwoLevelDetection: it ...
7b1ecb04-fb3d-438e-9509-b918e2b75cb4
{ "language": "C++" }
```c++ #include "cropview.hpp" CropView::CropView(QGraphicsScene *scene) : QGraphicsView(scene) { setFrameShape(QFrame::NoFrame); // Time taken to solve: A george99g and 38 minutes. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setWindowFlags(...
```c++ #include "cropview.hpp" CropView::CropView(QGraphicsScene *scene) : QGraphicsView(scene) { setFrameShape(QFrame::NoFrame); // Time taken to solve: A george99g and 38 minutes. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setWindowFlags(...
3543223e-d1eb-47fe-8e30-bd0fca7d1803
{ "language": "C++" }
```c++ // Copyright (c) 2016-2018 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 <wallet/test/wallet_test_fixture.h> #include <rpc/server.h> #include <wallet/db.h> #include <wallet/wallet.h...
```c++ // Copyright (c) 2016-2018 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 <wallet/test/wallet_test_fixture.h> #include <rpc/server.h> #include <wallet/db.h> #include <wallet/wallet.h...
b7dba9ce-ef18-430d-b553-d170a0232786
{ "language": "C++" }
```c++ #define SYS_CLOCK_GETTIME 263 #include "linux_clock.cpp" ``` Fix a syscall number for 64-bit arm
```c++ #ifdef BITS_64 #define SYS_CLOCK_GETTIME 113 #endif #ifdef BITS_32 #define SYS_CLOCK_GETTIME 263 #endif #include "linux_clock.cpp" ```
0f5bc3e8-5898-4193-b511-fb022f6daf59
{ "language": "C++" }
```c++ #include "Halide.h" #include <stdio.h> #include <future> using namespace Halide; static std::atomic<int> foo; int main(int argc, char **argv) { // Test if the compiler itself is thread-safe. This test is // intended to be run in a thread-sanitizer. std::vector<std::future<void>> futures; for (...
```c++ #include "Halide.h" #include <stdio.h> #include <thread> using namespace Halide; int main(int argc, char **argv) { // Test if the compiler itself is thread-safe. This test is // intended to be run in a thread-sanitizer. // std::thread has implementation-dependent behavior; some implementations ...
bba5502f-b3dd-4347-b428-f4b3163b8e41
{ "language": "C++" }
```c++ #include "application.hpp" #include <SDL2/SDL.h> #include <stdexcept> Application *Application::instance_ = nullptr; Application::Application(int &argc, char **argv) { if (instance_ != nullptr) throw std::runtime_error("The program can have only one instance of Application"); instance_ = this; ...
```c++ #include "application.hpp" #include <SDL2/SDL.h> #include <stdexcept> #include <string> Application *Application::instance_ = nullptr; Application::Application(int &argc, char **argv) { if (instance_ != nullptr) throw std::runtime_error("The program can have only one instance of Application"); ...
cb4a3d7f-e370-4104-8735-e8512841e9cb
{ "language": "C++" }
```c++ #include "TestIODevice.hpp" #include <iostream> void TestIODevice::fakeWrite(const QByteArray& data) { readStore.append(data); emit readyRead(); } qint64 TestIODevice::readData(char* data, qint64 maxSize) { auto readData = readStore.left(maxSize); //std::cerr << "Read " << readData.size() << "...
```c++ #include "TestIODevice.hpp" #include <iostream> #include <cstring> void TestIODevice::fakeWrite(const QByteArray& data) { readStore.append(data); emit readyRead(); } qint64 TestIODevice::readData(char* data, qint64 maxSize) { auto readData = readStore.left(maxSize); //std::cerr << "Read " << r...
ac1558d9-b1c5-46ac-bf91-5fcdeca16b6f
{ "language": "C++" }
```c++ #include "tests-base.hpp" #include "helpers-casemapping.hpp" #include "helpers-strings.hpp" TEST(SpecialCasing, LithuanianRemoveDotAbove) { // Remove DOT ABOVE after "i" with upper or titlecase // U+0049 U+0307 // U+0069 EXPECT_STREQ("lt-LT", setlocale(LC_ALL, "lt-LT")); EXPECT_CASEMAPPING_...
```c++ #include "tests-base.hpp" #include "helpers-casemapping.hpp" #include "helpers-strings.hpp" TEST(SpecialCasing, LithuanianRemoveDotAbove) { EXPECT_STREQ("lt-LT", setlocale(LC_ALL, "lt-LT")); // Remove DOT ABOVE after "i" with upper or titlecase EXPECT_CASEMAPPING_EQ("i\xCC\x87", "i\xCC\x87", "I...
aaf83d37-207f-465d-9691-c97a87d8c027
{ "language": "C++" }
```c++ /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkColorMatrixFilter.h" static SkScalar byte_to_scale(U8CPU byte) { if (0xFF == byte) { // want to get this exact return 1; } else { ...
```c++ /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkColorMatrixFilter.h" static SkScalar byte_to_scale(U8CPU byte) { if (0xFF == byte) { // want to get this exact return 1; } else { ...
3b232c94-4a89-4f7e-aa3d-35332b58dabb
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -O3 -emit-llvm -gline-tables-only -S -verify -o /dev/null // REQUIRES: x86-registered-target // Test verifies optimization failures generated by the backend are handled // correctly by clang. LLVM tests verify all of the failure conditions. void test_switch(...
```c++ // RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -O3 -emit-llvm -gline-tables-only -S -verify -o /dev/null // REQUIRES: x86-registered-target // Test verifies optimization failures generated by the backend are handled // correctly by clang. LLVM tests verify all of the failure conditions. void test_switch(...
c77f505a-cfa9-424c-9374-abaf3084a689
{ "language": "C++" }
```c++ #include "WindowsAPIs.h" #include "TaskIcon.h" INT WINAPI WinMain(HINSTANCE hinst, HINSTANCE, LPSTR, INT) { hinstance = hinst; TaskIcon().MessageLoop(); return 0; } ``` Enable XINPUT right away maybe?
```c++ #include "WindowsAPIs.h" #include "TaskIcon.h" INT WINAPI WinMain(HINSTANCE hinst, HINSTANCE, LPSTR, INT) { hinstance = hinst; XInputEnable(TRUE); TaskIcon().MessageLoop(); return 0; } ```
ca548885-e126-4d82-8fd1-a96885c6bdab
{ "language": "C++" }
```c++ #include <SegmentList.hh> #include "catch.hpp" SCENARIO("Kernel heap allocator SegmentList", "[kernelheap]") { GIVEN("A segment list") { SegmentList list; WHEN("The list is empty") { THEN("The count of the list is zero") { CHECK(list.count() == 0); ...
```c++ #include <SegmentList.hh> #include "catch.hpp" SCENARIO("Kernel heap allocator SegmentList", "[kernelheap]") { GIVEN("A segment list") { SegmentList list; WHEN("The list is empty") { THEN("The count of the list is zero") { CHECK(list.count() == 0); ...
76fcc6ff-7dc0-4c94-98cb-1c807588f3fb
{ "language": "C++" }
```c++ #include "main_action_planner_node.hpp" int main(int argc, char** argv) { return 0; } ``` Add minimum code to main func of MAP node.
```c++ #include "main_action_planner_node.hpp" int main(int argc, char** argv) { ros::init(argc, argv, "main_action_planner_node"); ros::NodeHandle nh("~"); return 0; } ```
8de10849-fb09-4eb6-850e-37daa0d6875d
{ "language": "C++" }
```c++ #include "cg-operator-common.h" #include <binpac/autogen/operators/function.h> using namespace binpac; using namespace binpac::codegen; void CodeBuilder::visit(expression::operator_::function::Call* i) { auto func = ast::checkedCast<expression::Function>(i->op1()); auto args = callParameters(i->op2())...
```c++ #include "cg-operator-common.h" #include <binpac/autogen/operators/function.h> using namespace binpac; using namespace binpac::codegen; void CodeBuilder::visit(expression::operator_::function::Call* i) { auto func = ast::checkedCast<expression::Function>(i->op1()); auto args = callParameters(i->op2())...
5dbe4384-74d9-487b-bb7d-8cbcf82817a8
{ "language": "C++" }
```c++ #include <QtQuick> #include <sailfishapp.h> #include <QScopedPointer> #include <QQuickView> #include <QQmlEngine> #include <QGuiApplication> #include "factor.h" int main(int argc, char *argv[]) { // For this example, wizard-generates single line code would be good enough, // but very soon it won't be ...
```c++ #include <QtQuick> #include <sailfishapp.h> #include <QScopedPointer> #include <QQuickView> #include <QQmlEngine> #include <QGuiApplication> #include "factor.h" int main(int argc, char *argv[]) { // For this example, wizard-generates single line code would be good enough, // but very soon it won't be ...
432ac0ae-4767-4e12-9917-e18b46046fd4
{ "language": "C++" }
```c++ //===- IListIterator.cpp --------------------------------------------------===// // // The Bold Project // // This file is distributed under the New BSD License. // See LICENSE for details. // //===----------------------------------------------------------------------===// #include <...
```c++ //===- IListIterator.cpp --------------------------------------------------===// // // The Bold Project // // This file is distributed under the New BSD License. // See LICENSE for details. // //===----------------------------------------------------------------------===// #include <...
a22a8521-5c20-4f22-bb58-914169b75c5f
{ "language": "C++" }
```c++ #include <boost/python.hpp> #include "mue_algorithm.h" #include "teams.h" #include "distances.h" #include "seen_table.h" char const * peng() { return mue::peng().c_str(); } BOOST_PYTHON_MODULE (_pymue) { using namespace boost::python; def ("peng", peng); class_<mue::Team>("Team", init<int>()) .def("...
```c++ #include <boost/python.hpp> #include "mue_algorithm.h" #include "teams.h" #include "distances.h" #include "seen_table_wrapper.h" char const * peng() { return mue::peng().c_str(); } BOOST_PYTHON_MODULE (_pymue) { using namespace boost::python; def ("peng", peng); class_<mue::Team>("Team", init<int>()...
1ac7f0c1-cf9f-46f9-ba0f-29d22bbc3a61
{ "language": "C++" }
```c++ //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--------------------...
```c++ //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--------------------...
af1f9896-b607-4e91-a64c-8835df7d7bf6
{ "language": "C++" }
```c++ /********************************************************************** * * GEOS - Geometry Engine Open Source * http://geos.refractions.net * * Copyright (C) 2001-2002 Vivid Solutions Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public...
```c++ /********************************************************************** * * GEOS - Geometry Engine Open Source * http://geos.refractions.net * * Copyright (C) 2001-2002 Vivid Solutions Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public...
8c52195e-25e6-40f7-b9df-8455252b93b0
{ "language": "C++" }
```c++ #include "insertion.hpp" #include "swap.hpp" void insertion(int *data, const int size_of_data) { for(int i = 0; i < size_of_data; ++i) { int j; for(j = i; j >= 0 && data[j] < data[i]; --j); swap(data[i], data[j]); } } ``` Fix the logic of Insertion sort which is not working
```c++ #include "insertion.hpp" #include "swap.hpp" void insertion(int *data, const int size_of_data) { for(int i = 0; i < size_of_data; ++i) { for(int j = i; j > 0 && data[j] < data[j - 1]; --j) swap(data[j], data[j - 1]); } } ```
cbc2b2ba-9f74-4ab5-8a98-c3bcd2968196
{ "language": "C++" }
```c++ #include <Bull/Core/Exception/RuntimeError.hpp> #include <Bull/Render/Buffer/VertexArrayObject.hpp> #include <Bull/Render/OpenGL.hpp> namespace Bull { VertexArrayObject::VertexArrayObject() : m_vao(0) { gl::genVertexArrays(1, &m_vao); if(!gl::isVertexArray(m_vao)) { ...
```c++ #include <Bull/Core/Exception/RuntimeError.hpp> #include <Bull/Render/Buffer/VertexArrayObject.hpp> #include <Bull/Render/OpenGL.hpp> namespace Bull { VertexArrayObject::VertexArrayObject() : m_vao(0) { gl::genVertexArrays(1, &m_vao); if(!m_vao) { throw Runt...
c18bc353-54dd-484e-8681-76b61f3832b1
{ "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 "../client/gles2_lib.h" #include "../common/thread_local.h" namespace gles2 { namespace { gpu::ThreadLocalKey g_gl_context_key; } //...
```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 "../client/gles2_lib.h" #include "../common/thread_local.h" namespace gles2 { // TODO(kbr): the use of this anonymous namespace core ...
c7083544-06e9-4f4e-b68c-9ace94957a8d
{ "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...
19c03057-2898-4387-87a8-802bab802a73
{ "language": "C++" }
```c++ #include "stdafx.h" #include <string> #include "Logger.h" #ifdef _WIN64 #define PYTHONPATH L"python-embed-amd64" #else #define PYTHONPATH L"python-embed-win32" #endif EXTERN_C IMAGE_DOS_HEADER __ImageBase; std::wstring getPythonPath() { // https://stackoverflow.com/questions/6924195/get-dll-path-at-runtim...
```c++ #include "stdafx.h" #include <string> #include "Logger.h" #ifdef _WIN64 #define EMBEDDEDPYTHONPATH L"python-embed-amd64" #else #define EMBEDDEDPYTHONPATH L"python-embed-win32" #endif EXTERN_C IMAGE_DOS_HEADER __ImageBase; std::wstring getPythonPath() { // https://stackoverflow.com/questions/6924195/get-dl...
3d06d62c-f56f-4a12-af9d-d78af7333c2b
{ "language": "C++" }
```c++ /* * * Copyright 2019 Asylo authors * * 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 o...
```c++ /* * * Copyright 2019 Asylo authors * * 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 o...
60b3196b-fb03-45fd-b791-e4329b1168b5
{ "language": "C++" }
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "../DNAnalyzerServer/Dictionnaire.h" #include <exception> #include <cstring> using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace DNAnalyzerServerTest { TEST_CLASS(DictionnaireTest) { public: //ObtenirInstance TEST_METHOD(ObtenirI...
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "../DNAnalyzerServer/Dictionnaire.h" #include "../DNAnalyzerServer/Mots.h" #include <exception> #include <unordered_set> #include <cstring> #include <string> using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace DNAnalyzerServerTest { TE...
8fdc5c41-d13f-405e-867f-ff7e00ce1b10
{ "language": "C++" }
```c++ #include <string> #include <vector> #include <unistd.h> #include <gtest/gtest.h> #include <scxcorelib/scxstrencodingconv.h> #include "getusername.h" TEST(GetUserName,simple) { // allocate a WCHAR_T buffer to receive username DWORD lpnSize = L_cuserid; WCHAR_T lpBuffer[lpnSize]; BOOL result = GetUserName(lp...
```c++ #include <string> #include <vector> #include <unistd.h> #include <gtest/gtest.h> #include <scxcorelib/scxstrencodingconv.h> #include "getusername.h" class GetUserNameTest : public ::testing::Test { protected: DWORD lpnSize; std::vector<WCHAR_T> lpBuffer; BOOL result; std::string userName; GetUserNameTest(...
3e7520b4-c4f1-4175-8082-6d2f0f1ad0ba
{ "language": "C++" }
```c++ #include "textfile.ih" vector<unsigned char> indexedcorpus::readFile(string const &filename) { QFileInfo p(filename.c_str()); if (p.isFile()) throw runtime_error(string("readFile: '") + filename + "' is not a regular file!"); vector<unsigned char> data; ifstream dataStream(filename.c_str()); if...
```c++ #include "textfile.ih" vector<unsigned char> indexedcorpus::readFile(string const &filename) { QFileInfo p(filename.c_str()); if (!p.isFile()) throw runtime_error(string("readFile: '") + filename + "' is not a regular file!"); vector<unsigned char> data; ifstream dataStream(filename.c_str()); i...
e88f3696-a6b5-40ba-9745-96e20d116074
{ "language": "C++" }
```c++ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. * Use of this file is governed by the BSD 3-clause license that * can be found in the LICENSE.txt file in the project root. */ #include "Exceptions.h" using namespace antlr4; RuntimeException::RuntimeException(const std::string &msg) : std:...
```c++ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. * Use of this file is governed by the BSD 3-clause license that * can be found in the LICENSE.txt file in the project root. */ #include "Exceptions.h" using namespace antlr4; RuntimeException::RuntimeException(const std::string &msg) : std:...
05d8fbad-eeb3-4ef2-97b8-f8d2a1842bfc
{ "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" IN_PROC_BR...
```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...
9c8bdc31-fe4f-4351-a8b1-bc3acf209f3f
{ "language": "C++" }
```c++ /* * Copyright (c) 2013 The WebRTC 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 in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All co...
```c++ /* * Copyright (c) 2013 The WebRTC 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 in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All co...
03dc3c53-f4f0-4932-af09-a922d04132c5
{ "language": "C++" }
```c++ #include "DotGraphOutput.hh" #include "EdgeType.hh" string getEdgeStyle(EdgeType t) { switch (t) { case EdgeType::Plane: return "[color=red]"; case EdgeType::Train: return "[color=blue,style=dotted]"; default: return ""; } } template <typename V> void DotGraphOutput<V>::output(string path...
```c++ #include "DotGraphOutput.hh" #include "EdgeType.hh" string getEdgeStyle(EdgeType t) { switch (t) { case EdgeType::Plane: return "[color=red]"; case EdgeType::Train: return "[color=blue,style=dotted]"; default: return ""; } } template <typename V> void DotGraphOutput<V>::output(string path...
3716a435-ef2f-4a6c-9d6a-8051a89448a1
{ "language": "C++" }
```c++ #include "cpr/timeout.h" #include <limits> #include <stdexcept> #include <string> #include <type_traits> namespace cpr { long Timeout::Milliseconds() const { static_assert(std::is_same<std::chrono::milliseconds, decltype(ms)>::value, "Following casting expects milliseconds."); if (m...
```c++ #include "cpr/timeout.h" #include <limits> #include <stdexcept> #include <string> #include <type_traits> namespace cpr { long Timeout::Milliseconds() const { static_assert(std::is_same<std::chrono::milliseconds, decltype(ms)>::value, "Following casting expects milliseconds."); if (m...
19b9646a-93ff-4008-bc77-e29e73881cb3
{ "language": "C++" }
```c++ #include "Log.h" #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> #include <iostream> Log m_globalLog; Log* Log::instance() { return &m_globalLog; } Log::Log() : m_fd(-1) { } Log::~Log() { close(m_fd); } void Log::open(const std::string& path) { m_fd = ::open(path.c_s...
```c++ #include "Log.h" #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> #include <iostream> Log m_globalLog; Log* Log::instance() { return &m_globalLog; } Log::Log() : m_fd(-1) { } Log::~Log() { close(m_fd); } void Log::open(const std::string& path) { m_fd = ::open(path.c_s...
defe3cb2-7181-4561-b8d5-751b5a7f2a24
{ "language": "C++" }
```c++ #include "eval.h" #include "env.h" namespace mclisp { ConsCell *Eval(const ConsCell *exp, ConsCell *env /* env::g_user_env */) { if (Atom(exp)) return env::Lookup(env, exp); if (Atom(Car(exp))) { if (Eq(Car(exp), g_builtin_symbols["QUOTE"])) return Cadr(exp); if (Eq(Car(exp), g_builtin...
```c++ #include "eval.h" #include "env.h" namespace { using namespace mclisp; ConsCell *Evcon(const ConsCell *clauses, ConsCell *env) { // TODO Might want throw something more descriptive than TypeError. TYPECHECK(clauses, Listp); if (Null(clauses)) return kNil; TYPECHECK(Car(clauses), Consp); if (*E...
eacf34f7-3e9b-4697-a87d-5379eadd3c8e
{ "language": "C++" }
```c++ #include "localserver.h" namespace rclog { LocalServer::LocalServer(boost::asio::io_service &io_service, std::string socket_path) :socket_(io_service, datagram_protocol::endpoint(socket_path)) { do_receive(); } void LocalServer::do_receive() { socket_.async_receive_from(boost::asio::buffer(data_,...
```c++ #include "localserver.h" namespace rclog { LocalServer::LocalServer(boost::asio::io_service &io_service, std::string socket_path) :socket_(io_service, datagram_protocol::endpoint(socket_path)) { do_receive(); } void LocalServer::do_receive() { socket_.async_receive_from(boost::asio::buffer(data_,...
2d79f794-d035-47ad-a5c3-3841122a7fe2
{ "language": "C++" }
```c++ #include "gamescene.h" void GameScene::append_gameItem(QDeclarativeListProperty<GameItem> *list, GameItem *gameItem) { GameScene *scene = qobject_cast<GameScene *>(list->object); if (scene) { gameItem->setParentItem(scene); scene->m_gameItems.append(gameItem); } } GameScene::GameSce...
```c++ #include "gamescene.h" void GameScene::append_gameItem(QDeclarativeListProperty<GameItem> *list, GameItem *gameItem) { GameScene *scene = qobject_cast<GameScene *>(list->object); if (scene) { gameItem->setParentItem(scene); scene->m_gameItems.append(gameItem); } } GameScene::GameSce...
ec7720c0-8d7c-4b0d-a037-e25fc2f66b76
{ "language": "C++" }
```c++ #include <stan/math/prim/scal.hpp> #include <gtest/gtest.h> #include <limits> TEST(MathFunctions, is_nan) { using stan::math::is_nan; double infinity = std::numeric_limits<double>::infinity(); double nan = std::numeric_limits<double>::quiet_NaN(); double min = std::numeric_limits<double>::min(); doubl...
```c++ #include <stan/math/prim/scal.hpp> #include <gtest/gtest.h> #include <limits> TEST(MathFunctions, is_nan) { using stan::math::is_nan; double infinity = std::numeric_limits<double>::infinity(); double nan = std::numeric_limits<double>::quiet_NaN(); double min = std::numeric_limits<double>::min(); doubl...
0fd558b9-2695-4aa7-af2b-42c6dc19db5e
{ "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) //=========================================...
df76ecc0-a86b-40f8-8cfc-c5853cf9911b
{ "language": "C++" }
```c++ #include <turbodbc/time_helpers.h> #include <sql.h> #include <boost/date_time/gregorian/gregorian_types.hpp> #include <boost/date_time/posix_time/posix_time_types.hpp> namespace turbodbc { boost::posix_time::ptime const timestamp_epoch({1970, 1, 1}, {0, 0, 0, 0}); int64_t timestamp_to_microseconds(c...
```c++ #include <turbodbc/time_helpers.h> #ifdef _WIN32 #include <windows.h> #endif #include <cstring> #include <sql.h> #include <boost/date_time/gregorian/gregorian_types.hpp> #include <boost/date_time/posix_time/posix_time_types.hpp> namespace turbodbc { boost::posix_time::ptime const timestamp_epoch({1970, 1...
787cc2e9-58d9-49aa-922e-d8b467c84d97
{ "language": "C++" }
```c++ #include "../include/parlex/detail/abstract_syntax_tree.hpp" #include "graphviz_dot.hpp" #include "parlex/builder.hpp" #include "parlex/detail/grammar.hpp" parlex::detail::ast_node::ast_node(match const & m, std::vector<ast_node> const & children, leaf const * l) : match(m), children(children), l(l) {} std::...
```c++ #include "../include/parlex/detail/abstract_syntax_tree.hpp" #include "graphviz_dot.hpp" #include "parlex/builder.hpp" #include "parlex/detail/grammar.hpp" parlex::detail::ast_node::ast_node(match const & m, std::vector<ast_node> const & children, leaf const * l) : match(m), children(children), l(l) {} std::...
67b5db8c-00f1-4145-bde9-e270aa70ab53
{ "language": "C++" }
```c++ #include <iostream> #include <QtConcurrent> #include <QCoreApplication> #include <stdint.h> #include <pulse/simple.h> #include "DBMeter.hpp" using namespace std; DBMeter::DBMeter() { settings.setCodec("audio/PCM"); settings.setChannelCount(1); settings.setSampleRate(16000); recorder = new QAudioRecorder(...
```c++ #include <iostream> #include <QtConcurrent> #include <QCoreApplication> #include <stdint.h> #include "DBMeter.hpp" using namespace std; DBMeter::DBMeter() { settings.setCodec("audio/PCM"); settings.setChannelCount(1); settings.setSampleRate(16000); recorder = new QAudioRecorder(this); recorder->setAudio...
e842ac94-bdd6-49bc-a563-b46b82c164fb
{ "language": "C++" }
```c++ // Copyright 2016 Zheng Xian Qiu #include "Seeker.h" namespace Seeker { vector<ISubscriber*> Event::subscribers; void Event::Refresh() { SDL_Event ev; while(SDL_PollEvent(&ev)) { switch(ev.type) { case SDL_KEYDOWN: Dispatch(EventType::Key); break; case SD...
```c++ // Copyright 2016 Zheng Xian Qiu #include "Seeker.h" #include<algorithm> // Prevent use C++17 std::remove namespace Seeker { vector<ISubscriber*> Event::subscribers; void Event::Refresh() { SDL_Event ev; while(SDL_PollEvent(&ev)) { switch(ev.type) { case SDL_KEYDOWN: Disp...
66a0570b-e4b3-4622-badd-8dd5749ce420
{ "language": "C++" }
```c++ /* * 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 3 of the License, or * (at your option) any later version. * * Written (W) 2012 Chiyuan Zhang * Copyright (C) 2012...
```c++ /* * 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 3 of the License, or * (at your option) any later version. * * Written (W) 2012 Chiyuan Zhang * Copyright (C) 2012...
b453397b-83af-41cf-a3e7-55aa755f002a
{ "language": "C++" }
```c++ // Standard includes #include <stdlib.h> // OpenGL includes #include <GL/glew.h> #include <GLFW/glfw3.h> #include "fluidDynamics.h" void simulate() { // We ping-pong back and forth between two buffers on the GPU // u = advect(u); // u = diffuse(u); // u = addForces(u); // // p = compu...
```c++ // Standard includes #include <stdlib.h> // OpenGL includes #include <GL/glew.h> #include <GLFW/glfw3.h> #include "fluidDynamics.h" #define DEFAULT_WIDTH 640 #define DEFAULT_HEIGHT 480 void simulate() { // We ping-pong back and forth between two buffers on the GPU // u = advect(u); // u = diff...
531bfe11-0604-491d-b3cc-92ade1c7cc8e
{ "language": "C++" }
```c++ #include "serialutil.h" #include "usbutil.h" #include "listener.h" #include "signals.h" #include "log.h" #define VERSION_CONTROL_COMMAND 0x80 #define RESET_CONTROL_COMMAND 0x81 // USB #define DATA_ENDPOINT 1 extern void reset(); void setup(); void loop(); const char* VERSION = "2.0-pre"; #ifdef __CHIPKIT__ ...
```c++ #include "serialutil.h" #include "usbutil.h" #include "listener.h" #include "signals.h" #include "log.h" #define VERSION_CONTROL_COMMAND 0x80 #define RESET_CONTROL_COMMAND 0x81 // USB #define DATA_ENDPOINT 1 extern void reset(); void setup(); void loop(); const char* VERSION = "2.0-pre"; #ifdef __CHIPKIT__ ...
4248d806-ef20-4a52-8a68-1ca6319c737a
{ "language": "C++" }
```c++ //===-- AVRTargetInfo.cpp - AVR Target Implementation ---------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===-- AVRTargetInfo.cpp - AVR Target Implementation ---------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
ddd83fa9-a691-475c-aa96-0987c184044a
{ "language": "C++" }
```c++ #include <SFML\Window.hpp> int main() { sf::Window window(sf::VideoMode(800, 600), "SFML works!"); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); } window.display(); } return 0; }``` ADD fullscreen opti...
```c++ #include <SFML\Window.hpp> int main() { bool fullscreen = false; sf::Window window(sf::VideoMode(800, 600), "SFML works!"); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); if (event.type == sf::Event::KeyPre...
718fdfab-0ca7-4fb5-bece-be4361700c14
{ "language": "C++" }
```c++ #include "arithmetics.hpp" #include "gtest/gtest.h" TEST(AddTest, PerformsAdditionOnTwoIntegers) { EXPECT_EQ(2, arithmetics::add(1, 1)); EXPECT_EQ(2, arithmetics::add_buggy(1, 1)); } int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }``` Split tests into...
```c++ #include "arithmetics.hpp" #include "gtest/gtest.h" TEST(TestAdd, PerformsAdditionOnTwoIntegers) { EXPECT_EQ(2, arithmetics::add(1, 1)); } TEST(TestAdd, PerformsAdditionOnTwoIntegers_2) { EXPECT_EQ(2, arithmetics::add_buggy(1, 1)); } int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, arg...
0cfb5696-5838-4ddd-b85b-0c00f55e6316
{ "language": "C++" }
```c++ /* * Copyright (c) 2015 Cossack Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable l...
```c++ /* * Copyright (c) 2015 Cossack Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable l...
c0111d97-c7f1-433e-863a-a0240995c606
{ "language": "C++" }
```c++ #include "xchainer/python/device.h" #include <sstream> #include "xchainer/device.h" namespace xchainer { namespace py = pybind11; // standard convention void InitXchainerDevice(pybind11::module& m) { py::class_<Device>(m, "Device").def("__repr__", [](Device device) { std::ostringstream os; ...
```c++ #include "xchainer/python/device.h" #include <sstream> #include "xchainer/device.h" namespace xchainer { namespace py = pybind11; // standard convention void InitXchainerDevice(pybind11::module& m) { py::class_<Device>(m, "Device") .def(py::init(&MakeDevice)) .def("__eq__", py::overload...
88317c16-3b4f-4b3c-aafc-83615343218b
{ "language": "C++" }
```c++ // RUN: clang-cc -fsyntax-only -verify %s struct add_pointer { template<typename T> struct apply { typedef T* type; }; }; struct add_reference { template<typename T> struct apply { typedef T& type; // expected-error{{cannot form a reference to 'void'}} }; }; template<typename MetaFun, type...
```c++ // RUN: clang-cc -fsyntax-only -verify %s struct add_pointer { template<typename T> struct apply { typedef T* type; }; }; struct add_reference { template<typename T> struct apply { typedef T& type; // expected-error{{cannot form a reference to 'void'}} }; }; struct bogus { struct apply {...
43faf7a2-ac30-4650-bd38-be0270a27c23
{ "language": "C++" }
```c++ // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #include "platform/globals.h" #if defined(TARGET_OS_FUCHSIA) #include "bin/crypto.h" #include ...
```c++ // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #include "platform/globals.h" #if defined(TARGET_OS_FUCHSIA) #include "bin/crypto.h" #include ...
20235b73-8e42-4876-a3af-9d491affe058
{ "language": "C++" }
```c++ /* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkSGDraw.h" #include "SkSGGeometryNode.h" #include "SkSGInvalidationController.h" #include "SkSGPaintNode.h" namespace sksg { Draw::Draw(sk_sp<GeometryNode...
```c++ /* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkSGDraw.h" #include "SkSGGeometryNode.h" #include "SkSGInvalidationController.h" #include "SkSGPaintNode.h" namespace sksg { Draw::Draw(sk_sp<GeometryNode...
e26ae9ee-a5a7-44ab-860c-f84be5fd2e9c
{ "language": "C++" }
```c++ // [TODO] This belongs into the cmake platform files!! #if defined(WIN32) && !defined(_DEBUG) #pragma comment(linker, "/SUBSYSTEM:WINDOWS /entry:mainCRTStartup") #endif #include <memory> #include <gloperate/ext-includes-begin.h> #include <widgetzeug/dark_fusion_style.hpp> #include <gloperate/ext-includes-end...
```c++ // [TODO] This belongs into the cmake platform files!! #if defined(WIN32) && !defined(_DEBUG) #pragma comment(linker, "/SUBSYSTEM:WINDOWS /entry:mainCRTStartup") #endif #include <memory> #include <gloperate/ext-includes-begin.h> #include <widgetzeug/dark_fusion_style.hpp> #include <gloperate/ext-includes-end...
29a28992-6caa-401d-a440-4fa5b0145512
{ "language": "C++" }
```c++ #include "ofxShadersFX.h" namespace ofxShadersFX { Shader::Shader(ShaderType p_type) { setShaderType(p_type); } void Shader::begin() { // The shader needs reload if not loaded // or if modifications in attributes occurred since last frame if (!m_shader.isLoaded()...
```c++ // The MIT License (MIT) // Copyright (c) 2016 Alexandre Baron (Scylardor) // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to...
6c167ce9-feeb-4f2d-b007-89c043cffe94
{ "language": "C++" }
```c++ #include <cstdio> #include <algorithm> using namespace std; const int NMAX = 100000, PASI_INFINITI = NMAX*2; int v[NMAX], nVector, sizeOfCheat; int back(int pozitieCurenta, int cheatsAvailable) { if (pozitieCurenta > nVector) return PASI_INFINITI; if (pozitieCurenta == nVector...
```c++ // @palcu // InfoOltenia 2015, teleport, backtracking #include <cstdio> #include <algorithm> using namespace std; const int NMAX = 100000, PASI_INFINITI = NMAX*2; int v[NMAX], nVector, sizeOfCheat; int back(int pozitieCurenta, int cheatsAvailable) { if (pozitieCurenta > nVector) r...
afb4a2ba-9cac-4b9f-ba97-d0937e1df8ae
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-experimental-checks -verify %s struct X0 { }; bool operator==(const X0&, const X0&); // PR7287 struct test { int a[2]; }; void t2() { test p = {{1,2}}; test q; q = p; } bool PR7287(X0 a, X0 b) { retu...
```c++ // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-experimental-checks -verify %s struct X0 { }; bool operator==(const X0&, const X0&); // PR7287 struct test { int a[2]; }; void t2() { test p = {{1,2}}; test q; q = p; } bool PR7287(X0 a, X0 b) { retu...
d2f8d83c-d0b8-478c-8805-c8c4d35a6b14
{ "language": "C++" }
```c++ /* Copyright 2012 Dietrich Epp <depp@zdome.net> */ #include "level.hpp" #include "gamescreen.hpp" using namespace LD24; Level::~Level() { } void Level::nextLevel() { screen.nextLevel(); } void Level::setTipFlags(unsigned flags) { if (flags == m_tipflag) return; levelTips.clear(); for (...
```c++ /* Copyright 2012 Dietrich Epp <depp@zdome.net> */ #include "level.hpp" #include "gamescreen.hpp" using namespace LD24; Level::~Level() { } void Level::nextLevel() { screen.nextLevel(); } void Level::setTipFlags(unsigned flags) { if (flags == m_tipflag) return; levelTips.clear(); for (...
f06d0570-59ef-40b1-8a23-f6f668fa31d0
{ "language": "C++" }
```c++ // Rel native launcher for Linux. #include <iostream> #include <cstdlib> #include <unistd.h> #include <libgen.h> #include <string> #include <fstream> #include <streambuf> int main(int argc, char **argv) { // Convert first argument of argv[0] (full pathspec to this executable) to path where execut...
```c++ // Rel native launcher for Linux. #include <iostream> #include <cstdlib> #include <unistd.h> #include <libgen.h> #include <string> #include <fstream> #include <streambuf> int main(int argc, char **argv) { // Convert first argument of argv[0] (full pathspec to this executable) to path where execut...
41e15fbe-ee2d-4bcd-944d-3c5e8bd0735d
{ "language": "C++" }
```c++ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/public/common/context_menu_params.h" namespace content { const int32 CustomContextMenuContext::kCurrentRenderWidget = kint3...
```c++ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/public/common/context_menu_params.h" namespace content { const int32 CustomContextMenuContext::kCurrentRenderWidget = kint3...
dead72e8-f52a-4ccf-b669-7c51e4981e76
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 void foo(int* a, int *b) { a -= b; // expected-warning {{incompatible integer to pointer conversion assigning to 'int *' from 'long'}} } template<typename T> T declval(); struct true_type { static const bool va...
```c++ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 void foo(int* a, int *b) { a -= b; // expected-warning {{incompatible integer to pointer conversion assigning to 'int *' from}} } template<typename T> T declval(); struct true_type { static const bool value = t...
8745377c-3090-4977-bf0b-d5f518d7dc8b
{ "language": "C++" }
```c++ #include "variant/pwm_platform.hpp" #include "hal.h" static const PWMConfig motor_pwm_config = { 500000, // 500 kHz PWM clock frequency. 1000, // PWM period 2.0 ms. NULL, // No callback. { {PWM_OUTPUT_ACTIVE_HIGH, NULL}, {PWM_OUTPUT_ACTIVE_HIGH, NULL}, {PWM_OUTPUT_ACTIVE_HIGH, ...
```c++ #include "variant/pwm_platform.hpp" #include "hal.h" static const PWMConfig motor_pwm_config = { 500000, // 500 kHz PWM clock frequency. 2000, // PWM period 2.0 ms. NULL, // No callback. { {PWM_OUTPUT_ACTIVE_HIGH, NULL}, {PWM_OUTPUT_ACTIVE_HIGH, NULL}, {PWM_OUTPUT_ACTIVE_HIGH, ...
8cef06d6-08ee-456b-b368-b2a7d8455e0a
{ "language": "C++" }
```c++ #include "yebash.hpp" #include "History.hpp" #include "catch.hpp" #include <sstream> using namespace yb; TEST_CASE( "No suggestions when history is empty", "[basic.empty_history]" ) { std::stringstream ss; History history; history.read(ss); HistorySuggestion suggestion(history); auto c =...
```c++ #include "yebash.hpp" #include "History.hpp" #include "catch.hpp" #include <sstream> using namespace yb; TEST_CASE( "No suggestions when history is empty", "[basic.empty_history]" ) { std::stringstream ss; std::stringstream output; History history; history.read(ss); HistorySuggestion sugg...
23e41a8a-a25d-43cf-b141-75b4d44bd240
{ "language": "C++" }
```c++ #include <QTest> #include "mainwindow.h" #include "test-suite.h" QMap<QDateTime, QString> _log; QMap<QString, QString> _md5; mainWindow *_mainwindow; int main(int argc, char *argv[]) { QApplication a(argc, argv); int failed = 0; for (QObject *suite : TestSuite::suites) { ...
```c++ #include <QTest> #include "mainwindow.h" #include "test-suite.h" QMap<QDateTime, QString> _log; QMap<QString, QString> _md5; mainWindow *_mainwindow; int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); int failed = 0; for (QObject *suite : TestSuite::suites) { ...
58665972-b496-44df-b966-68651cad2689
{ "language": "C++" }
```c++ #include "Thread/Unix/ThreadImpl.hh" #include "Thread/ThreadException.hh" namespace LilWrapper { ThreadImpl::ThreadImpl(Thread *thread) { this->_isActive = pthread_create(&this->_thread, NULL, &ThreadImpl::entryPoint, thread) == 0; if (!this->_isActive) throw ThreadException("Thread Exception...
```c++ #include "Thread/Unix/ThreadImpl.hh" #include "Thread/ThreadException.hh" namespace LilWrapper { ThreadImpl::ThreadImpl(Thread *thread) { this->_isActive = pthread_create(&this->_thread, NULL, &ThreadImpl::entryPoint, thread) == 0; if (!this->_isActive) throw ThreadException("Thread Ex...
6326be52-bc8b-4aa5-b57d-a77d38616a63
{ "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...
738fdd6b-da0e-4932-8f1d-76823a1cc833
{ "language": "C++" }
```c++ /* * Copyright (c) 2016 Lech Kulina * * This file is part of the Realms Of Steel. * For conditions of distribution and use, see copyright details in the LICENSE file. */ #include <cstdlib> #include <boost/property_tree/info_parser.hpp> #include <application/Logger.h> #include <application/Application.h> #in...
```c++ /* * Copyright (c) 2016 Lech Kulina * * This file is part of the Realms Of Steel. * For conditions of distribution and use, see copyright details in the LICENSE file. */ #include <cstdlib> #include <boost/property_tree/info_parser.hpp> #include <application/Logger.h> #include <application/Application.h> #in...
3b4fc454-2d1d-4f12-8ca4-31619b9751b6
{ "language": "C++" }
```c++ #include <iostream> #include <cstlib> #include <vector> ``` Use fscanf to read in file.
```c++ #include <iostream> #include <cstdlib> #include <vector> #include <bitset> #include <cstring> #include <string> #include <fstream> #include <cstdio> #include "rand.h" using namespace std; class individual { public: int key[26]; float fit; }; // user functions go here int main() { // get cipher f...
5d0c25ef-82a1-4071-97b3-03e670aefdeb
{ "language": "C++" }
```c++ #include <stdexcept> #include "Person.h" Person::Person(std::string name) { if(name.empty()){ throw std::invalid_argument("Name can not be empty."); } this->name = name; }; ``` Add verification to Person constructor
```c++ #include <stdexcept> #include "Person.h" Person::Person(std::string name) { if(name.empty()){ throw std::invalid_argument("Name cannot be empty."); } this->name = name; }; ```
05b75a45-71eb-4e0f-9b6a-90c8163c67e3
{ "language": "C++" }
```c++ #include "gtest/gtest.h" int main(int argc, char *argv[]) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } ``` Make ASSERTs in helper functions fail the parent testcase
```c++ #include "gtest/gtest.h" class ThrowListener : public testing::EmptyTestEventListener { void OnTestPartResult(const testing::TestPartResult& result) override { if (result.type() == testing::TestPartResult::kFatalFailure) { throw testing::AssertionException(result); } } }; int main(int a...
ee39607c-010a-4c3d-a518-c36625bc0728
{ "language": "C++" }
```c++ #include "BoardMarker.hpp" BoardMarker::BoardMarker (void) : m(NONE), c(' ') {} bool BoardMarker::apply_modifier(Modifier& m) { if (this->m != NONE) { return false; } this->m = m; return true; } bool BoardMarker::set_char(char& c) { if (this->c != ' ') { return false; } this->c = toupper...
```c++ #include "BoardMarker.hpp" BoardMarker::BoardMarker (void) : m(NONE), c(' ') {} bool BoardMarker::apply_modifier(Modifier& m) { if (this->m != NONE) { return false; } this->m = m; return true; } bool BoardMarker::set_char(char& c) { if (this->c != ' ') { return this->c == c; } this->c = ...
22357819-b359-4a43-a1f3-43372e17672b
{ "language": "C++" }
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/tabs/dock_info.h" #include "chrome/browser/ui/views/tabs/tab.h" #include "build/build_config.h" #if !defined(OS_W...
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/tabs/dock_info.h" #include "chrome/browser/ui/views/tabs/tab.h" #include "build/build_config.h" #if defined(USE_A...
16837adb-731c-4bbe-bda9-cd9e7b813f92
{ "language": "C++" }
```c++ #include "messagedirector.h" #include "../core/config.h" ConfigVariable<std::string> bind_addr("messagedirector/bind", "unspecified"); MessageDirector MessageDirector::singleton; void MessageDirector::InitializeMD() { if(!m_initialized) { if(bind_addr.get_val() != "unspecified") { } } } MessageDirect...
```c++ #include "../core/global.h" #include "messagedirector.h" #include "../core/config.h" using boost::asio::ip::tcp; // I don't want to type all of that god damned shit ConfigVariable<std::string> bind_addr("messagedirector/bind", "unspecified"); MessageDirector MessageDirector::singleton; void MessageDirector::In...
cb03e14e-5f69-46f7-a808-461fc842f3c4
{ "language": "C++" }
```c++ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
```c++ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
b394f96e-b841-442f-a51b-bab5b4baaf97
{ "language": "C++" }
```c++ // RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s // TAG_member is used to encode debug info for 'z' in A. // CHECK: TAG_member class A { public: int z; }; A *foo (A* x) { A *a = new A(*x); return a; } ``` Add a test to verify that -flimit-debug-info is working in some way.
```c++ // RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s // TAG_member is used to encode debug info for 'z' in A. // CHECK: TAG_member class A { public: int z; }; A *foo (A* x) { A *a = new A(*x); return a; } // Verify that we're not emitting a full definition of B in limit debug mode. // RUN: %clang -em...
1fbdc805-f4ff-4e70-ac6e-e856232261ac
{ "language": "C++" }
```c++ #include <opencv2/opencv.hpp> #include <unistd.h> int main(int argc, char** argv){ if(argc!=2){ std::cout << "Nope.\n"; return -1; } cv::VideoCapture _capture(CV_CAP_OPENNI); std::cout << "Started streaming data to main system..\n"; int c=0; while(1){ cv::Mat depthMap, rgb; usleep(500...
```c++ #include <opencv2/opencv.hpp> #include <opencv/highgui.h> #include <unistd.h> int main(int argc, char** argv){ if(argc!=2){ std::cout << "Nope.\n"; return -1; } cv::VideoCapture _capture(CV_CAP_OPENNI); std::cout << "Started streaming data to main system..\n"; int c=0; cv::namedWindow("DEPTH"...
28d9a19d-d551-4a6f-aa10-beb092871d51
{ "language": "C++" }
```c++ /* This file is part of Fabula. Copyright (C) 2010 Mike McQuaid <mike@mikemcquaid.com> Fabula is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at yo...
```c++ /* This file is part of Fabula. Copyright (C) 2010 Mike McQuaid <mike@mikemcquaid.com> Fabula is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at yo...
3da4c81b-5f26-427c-a513-c02ffcef9ee4
{ "language": "C++" }
```c++ #include "imageviewer.h" #include "ui_imageviewer.h" ImageViewer::ImageViewer(QWidget *parent) : QMainWindow(parent), ui(new Ui::ImageViewer) { ui->setupUi(this); QImage image("/Users/Wojtek/Pictures/Three-eyed_crow.jpg"); ui->imageLabel->setPixmap(QPixmap::fromImage(image)); } ImageViewer...
```c++ #include "imageviewer.h" #include "ui_imageviewer.h" ImageViewer::ImageViewer(QWidget *parent) : QMainWindow(parent), ui(new Ui::ImageViewer) { ui->setupUi(this); ui->imageLabel->setBackgroundRole(QPalette::Base); ui->imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); ...
31ffd384-be97-432e-9f1c-a4e907ca239f
{ "language": "C++" }
```c++ #include <stdio.h> #include <stdarg.h> #include <iostream> #include <fstream> #include <string> #include "platform.h" void logMsg(const char* fmt, ...) { va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); } std::string stringFromResource(const char* _path) { std:...
```c++ #include <stdio.h> #include <stdarg.h> #include <iostream> #include <fstream> #include <string> #include "platform.h" void logMsg(const char* fmt, ...) { va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); } void requestRender() { // TODO: implement non-continuous...
ef710f82-c1b4-450b-86a3-fa9cbeac4a04
{ "language": "C++" }
```c++ // STL #include <cassert> #include <iostream> #include <sstream> #include <fstream> #include <string> // DSIM #include <dsim/DSIM_Service.hpp> #include <dsim/config/dsim-paths.hpp> // ///////// M A I N //////////// int main (int argc, char* argv[]) { try { // Output log File std::string lLogFile...
```c++ // STL #include <cassert> #include <iostream> #include <sstream> #include <fstream> #include <string> // DSIM #include <dsim/DSIM_Service.hpp> #include <dsim/config/dsim-paths.hpp> // ///////// M A I N //////////// int main (int argc, char* argv[]) { try { // Schedule input file name std::string...
16e4fa24-8e7f-43e7-84fb-4c3225deb123
{ "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 <hspp/Tasks/SimpleTasks/IncludeTask.hpp> namespace He...
```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 <hspp/Tasks/SimpleTasks/IncludeTask.hpp> #include <st...
a4ac4385-a333-4b71-92d9-665bac86020f
{ "language": "C++" }
```c++ #include <test.hpp> TEST_CASE("basic") { SECTION("default constructed pbf message is okay") { mapbox::util::pbf item; REQUIRE(!item.next()); } SECTION("empty buffer is okay") { std::string buffer; mapbox::util::pbf item(buffer.data(), 0); REQUIRE(!item.next...
```c++ #include <test.hpp> TEST_CASE("basic") { SECTION("default constructed pbf message is okay") { mapbox::util::pbf item; REQUIRE(!item.next()); } SECTION("empty buffer is okay") { std::string buffer; mapbox::util::pbf item(buffer.data(), 0); REQUIRE(!item); //...
e16f8468-13f4-42d8-b5b6-82f1027174e5
{ "language": "C++" }
```c++ #include "Rainback.hpp" #include <lua-cxx/LuaEnvironment.hpp> #include <lua-cxx/LuaValue.hpp> #include <QFile> int main(int argc, char* argv[]) { Lua lua; rainback::Rainback rainback(lua); std::string srcdir(getenv("srcdir")); QFile testRunner(QString(srcdir.c_str()) + "/test_lua.lua"); re...
```c++ #include "Rainback.hpp" #include <lua-cxx/LuaEnvironment.hpp> #include <lua-cxx/LuaValue.hpp> #include <QFile> #include <QCoreApplication> int main(int argc, char* argv[]) { QCoreApplication app(argc, argv); Lua lua; rainback::Rainback rainback(lua); std::string srcdir(getenv("srcdir")); ...