doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
f7116fe9-2188-43fa-b17a-e3a2cb04dae5
{ "language": "C++" }
```c++ /* JEBTest: A C++ unit testing framework * Copyright 2013 Jan Erik Breimo * All rights reserved. * * This file is distributed under the BSD License. * License text is included with the source distribution. */ #include "MacroUtilities.hpp" #include "JEB/Sys/Path.hpp" #include "JEB/String/String.hpp" #unde...
```c++ /* JEBTest: A C++ unit testing framework * Copyright 2013 Jan Erik Breimo * All rights reserved. * * This file is distributed under the BSD License. * License text is included with the source distribution. */ #include "MacroUtilities.hpp" #include <algorithm> #include "JEB/Sys/Path.hpp" #include "JEB/Stri...
b0f37685-eae5-4e3d-a99f-030b6372e843
{ "language": "C++" }
```c++ #include "Registration.hpp" #include "comp/StaticObjRefID.hpp" #include "comp/Transform.hpp" #include "comp/ConstantRotation.hpp" #include "comp/CameraSelect.hpp" #include "comp/ClickBox2D.hpp" #include "comp/StaticCamera.hpp" #include "comp/StaticOrthoCamera.hpp" #include "comp/StaticMouseInput.hpp" #include "...
```c++ #include "Registration.hpp" #include "comp/StaticObjRefID.hpp" #include "comp/Transform.hpp" #include "comp/ConstantRotation.hpp" #include "comp/CameraSelect.hpp" #include "comp/ClickBox2D.hpp" #include "comp/StaticCamera.hpp" #include "comp/StaticOrthoCamera.hpp" #include "comp/StaticMouseInput.hpp" #include "...
d18fbf96-7a7c-4f66-9235-b0dbec9e47e8
{ "language": "C++" }
```c++ #include "core/example_module.hpp" using namespace core; int ExampleModule::getme(void){ return -value; } void ExampleModule::setme(int newvalue){ value = newvalue; } ``` Fix intentional bug in example module
```c++ #include "core/example_module.hpp" using namespace core; int ExampleModule::getme(void){ return value; } void ExampleModule::setme(int newvalue){ value = newvalue; } ```
d912c08b-0c89-4214-8b37-979b3e964dbc
{ "language": "C++" }
```c++ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: TreeNode *invertTree(TreeNode *root) { if (!root || (!root->left && !root->rig...
```c++ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: TreeNode *invertTree(TreeNode *root) { if (!root || (!root->left && !root->rig...
b578cbb4-9488-47e1-8baf-14e60d276b29
{ "language": "C++" }
```c++ //! [0] QPainter painter(this); QPen pen(Qt::green, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin); painter.setPen(pen); //! [0] //! [1] QPainter painter(this); QPen pen(); // creates a default pen pen.setStyle(Qt::DashDotLine); pen.setWidth(3); pen.setBrush(Qt::green); pen.setCapStyle(Qt::RoundCap); pen.s...
```c++ //! [0] QPainter painter(this); QPen pen(Qt::green, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin); painter.setPen(pen); //! [0] //! [1] QPainter painter(this); QPen pen(); // creates a default pen pen.setStyle(Qt::DashDotLine); pen.setWidth(3); pen.setBrush(Qt::green); pen.setCapStyle(Qt::RoundCap); pen.s...
70337c2d-a56b-4e15-8c83-e7206f8ce175
{ "language": "C++" }
```c++ #include "client.h" DEFINE_string(config_filename, "", "Where to find the config file."); int main(int argc, char* argv[]) { InitGoogle(argv[0], &argc, &argv, true); grr::Client::StaticInit(); grr::Client client(FLAGS_config_filename); client.Run(); return 0; } ``` Remove dependency on Google argum...
```c++ #include "client.h" int main(int argc, char* argv[]) { grr::Client::StaticInit(); if (argc != 2) { GOOGLE_LOG(FATAL) << "Usage is: client <config>"; } grr::Client client(argv[1]); client.Run(); return 0; } ```
9afb6647-9cf0-4489-8b58-00174f2522ac
{ "language": "C++" }
```c++ #include "VolumeSlider.h" #include "..\Controllers\Volume\CoreAudio.h" #include "..\Error.h" #include "..\Settings.h" #include "..\Skin.h" #include "SliderKnob.h" VolumeSlider::VolumeSlider(CoreAudio &volumeCtrl) : SliderWnd(L"3RVX-VolumeSlider", L"3RVX Volume Slider"), _settings(*Settings::Instance()), _volum...
```c++ #include "VolumeSlider.h" #include "..\Controllers\Volume\CoreAudio.h" #include "..\Error.h" #include "..\Settings.h" #include "..\Skin.h" #include "SliderKnob.h" VolumeSlider::VolumeSlider(CoreAudio &volumeCtrl) : SliderWnd(L"3RVX-VolumeSlider", L"3RVX Volume Slider"), _settings(*Settings::Instance()), _volum...
bbf30ac3-c08e-4bce-af6f-3dcb5c3fec55
{ "language": "C++" }
```c++ #include "common.th" // c <- multiplicand // d <- multiplier // b -> product .global imul imul: pushall(h,i,j) b <- 0 i <- d == 0 i <- c == 0 + i i <- i <> 0 jnzrel(i, L_done) h <- 1 j <- d >> 31 // save sign bit in j j <- -j // convert sign to flag d <- d ^...
```c++ #include "common.th" // c <- multiplicand // d <- multiplier // b -> product .global imul imul: pushall(h,i,j) b <- 0 #if IMUL_EARLY_EXITS i <- d == 0 i <- c == 0 + i i <- i <> 0 jnzrel(i, L_done) #endif h <- 1 j <- d >> 31 // save sign bit in j j <- -j // conve...
fefd53cb-8a4d-4c49-92ba-71ac97c456b0
{ "language": "C++" }
```c++ #pragma once #include "CurveWrapperCodec.h" namespace spotify { namespace json { using CurveWrapper = noise::module::Wrapper<noise::module::Curve>; codec::object_t<CurveWrapper> default_codec_t<CurveWrapper>::codec() { auto codec = codec::object<CurveWrapper>(); codec.required("type", cod...
```c++ #pragma once #include "CurveWrapperCodec.h" namespace spotify { namespace json { using CurveWrapper = noise::module::Wrapper<noise::module::Curve>; codec::object_t<CurveWrapper> default_codec_t<CurveWrapper>::codec() { auto codec = codec::object<CurveWrapper>(); codec.required("type", cod...
044c5bcb-0fd6-4d8b-9210-9f9538743f80
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -main-file-name cxx-virtual-destructor-calls.cpp %s -o - -fprofile-instrument=clang | FileCheck %s struct Member { ~Member(); }; struct A { virtual ~A(); }; struct B : A { Member m; virtual ~B(); }; // Base dtor // CHECK: @__profn__ZN1BD2Ev = ...
```c++ // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -main-file-name cxx-virtual-destructor-calls.cpp %s -o - -fprofile-instrument=clang | FileCheck %s struct Member { ~Member(); }; struct A { virtual ~A(); }; struct B : A { Member m; virtual ~B(); }; // Base dtor counters and profile data // CH...
b823f05a-1c99-4683-a348-5d640a7f311d
{ "language": "C++" }
```c++ #include "CuteHMILockScreenQMLPlugin.hpp" #include "cutehmi/lock_screen/Auth.hpp" #include <QtQml> void CuteHMILockScreenQMLPlugin::registerTypes(const char * uri) { Q_ASSERT(uri == QLatin1String("CuteHMI.LockScreen")); qmlRegisterSingletonType<cutehmi::lockscreen::Auth>(uri, 1, 0, "Auth", AuthProvider...
```c++ #include "CuteHMILockScreenQMLPlugin.hpp" #include "cutehmi/lock_screen/Auth.hpp" #include <QtQml> #include <memory> void CuteHMILockScreenQMLPlugin::registerTypes(const char * uri) { Q_ASSERT(uri == QLatin1String("CuteHMI.LockScreen")); qmlRegisterSingletonType<cutehmi::lockscreen::Auth>(uri, 1, 0, "...
0815089d-d5ec-48be-8d3a-0ca369967e30
{ "language": "C++" }
```c++ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/views/dropdown_bar_host.h" #include "base/logging.h" #include "ui/aura/window.h" #include "ui/views/widget/widget....
```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/views/dropdown_bar_host.h" #include "base/logging.h" #include "ui/aura/window.h" #include "ui/views/widget/widget....
c04a32a7-0732-4586-8d9c-31770496f100
{ "language": "C++" }
```c++ #include "OptionsManager.h" #include <fstream> #include <spotify/json.hpp> #include "codecs/OptionsCodec.h" OptionsManager::OptionsManager(std::string filename) { std::ifstream ifs(filename); if (!ifs.good()) { throw std::runtime_error("Could not open options file"); } std::strin...
```c++ #include "OptionsManager.h" #include <fstream> #include <boost/filesystem.hpp> #include <spotify/json.hpp> #include "codecs/OptionsCodec.h" OptionsManager::OptionsManager(std::string filename) { std::ifstream ifs(filename); if (!ifs.good()) { throw std::runtime_error("Could not open opti...
0d687f3c-127d-43c7-ad99-6306815feb49
{ "language": "C++" }
```c++ #include <QApplication> #include <QPushButton> int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton *hello("Hello world!"); hello.resize(100, 30); hello.show(); return app.exec(); } ``` Add license header to this file
```c++ /**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the tools applications of the Qt Toolkit. ** ** $QT_BEGIN_LICE...
c327edd9-696c-4c2c-9849-ab74e456bed6
{ "language": "C++" }
```c++ #include <evpp/exp.h> #include <evpp/tcp_server.h> #include <evpp/buffer.h> #include <evpp/tcp_conn.h> void OnMessage(const evpp::TCPConnPtr& conn, evpp::Buffer* msg, evpp::Timestamp ts) { std::string s = msg->NextAllString(); LOG_INFO << "Received a message [" << s << "]";...
```c++ #include <evpp/exp.h> #include <evpp/tcp_server.h> #include <evpp/buffer.h> #include <evpp/tcp_conn.h> #ifdef _WIN32 #include "winmain-inl.h" #endif void OnMessage(const evpp::TCPConnPtr& conn, evpp::Buffer* msg, evpp::Timestamp ts) { std::string s = msg->NextAllString(); ...
49a00b3c-5218-449f-9ebc-3e260beff845
{ "language": "C++" }
```c++ /* * Copyright (C) 2018 The Android Open Source Project * * 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...
```c++ /* * Copyright (C) 2018 The Android Open Source Project * * 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...
f12cc18c-d659-48bd-a5fb-d0e04d47d5f4
{ "language": "C++" }
```c++ /* * The MIT License (MIT) * * Copyright (c) 2017 Nathan Osman * * 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 ...
```c++ /* * The MIT License (MIT) * * Copyright (c) 2017 Nathan Osman * * 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 ...
c5027ace-b674-47d7-80a5-f7f4d66d68e9
{ "language": "C++" }
```c++ class MyClass { public: int memberResult() { return 1; } static int staticResult() { return 1; } int externResult(); }; // -- int MyClass::externResult() { return 1; } // -- MyClass m; // -- enum MyEnum { myEnumOne = 1, myEnumTwo, myEnumThree }; // -- class AnotherClass { pu...
```c++ class MyClass { public: int memberResult() { return 1; } static int staticResult() { return 1; } int externResult(); }; // -- int MyClass::externResult() { return 1; } // -- MyClass m; // -- enum MyEnum { myEnumOne = 1, myEnumTwo, myEnumThree }; // -- class AnotherClass { pu...
d2f9185a-28d7-413d-be06-8a06b84a23d9
{ "language": "C++" }
```c++ #include <string.h> #include "gfx/texture_atlas.h" const AtlasFont *Atlas::getFontByName(const char *name) const { for (int i = 0; i < num_fonts; i++) { if (!strcmp(name, fonts[i]->name)) return fonts[i]; } } const AtlasImage *Atlas::getImageByName(const char *name) const { for (int i = 0; i < num_imag...
```c++ #include <string.h> #include "gfx/texture_atlas.h" const AtlasFont *Atlas::getFontByName(const char *name) const { for (int i = 0; i < num_fonts; i++) { if (!strcmp(name, fonts[i]->name)) return fonts[i]; } return 0; } const AtlasImage *Atlas::getImageByName(const char *name) const { for (int i = 0; ...
e2415263-dc6f-498a-8a48-0c78d579862f
{ "language": "C++" }
```c++ #include "cinder/app/App.h" #include "cinder/app/RendererGl.h" #include "cinder/gl/gl.h" using namespace ci; using namespace ci::app; using namespace std; class EntityCreationApp : public App { public: void setup() override; void mouseDown( MouseEvent event ) override; void update() override; void draw()...
```c++ #include "cinder/app/App.h" #include "cinder/app/RendererGl.h" #include "cinder/gl/gl.h" #include "entityx/System.h" using namespace ci; using namespace ci::app; using namespace std; class EntityCreationApp : public App { public: EntityCreationApp(); void setup() override; void mouseDown( MouseEvent event...
4430a8ca-1c73-441b-ab69-ac31fa63c945
{ "language": "C++" }
```c++ #include <stdio.h> #include "interface.h" void printHelp() { printf("Usage: yabs [options]\n\n" "yabs, a simple build system.\n" "Options:\n" "\t-new\tCreate a new yabs build file\n" "\t-help\tPrint this dialog\n"); } ``` Fix help print to reflect parameter changes
```c++ #include <stdio.h> #include "interface.h" void printHelp() { printf("Usage: yabs [options]\n\n" "yabs, a simple build system.\n" "Options:\n" "\t-n\tCreate a new yabs build file\n" "\t-h\tPrint this dialog\n"); } ```
88a10db8-3f5f-4ad2-8916-cb4415fdf7e5
{ "language": "C++" }
```c++ #include "FlareScalingRule.h" float UFlareScalingRule::GetDPIScaleBasedOnSize(FIntPoint Size) const { float NominalAspectRatio = (16.0f / 9.0f); // Wide screen : scale 1 at 1920, scale 2 at 3840... if (Size.X / Size.Y > NominalAspectRatio) { return (Size.Y / 1080.0f); } // Square ratio : scale 1 at ...
```c++ #include "FlareScalingRule.h" float UFlareScalingRule::GetDPIScaleBasedOnSize(FIntPoint Size) const { float NominalAspectRatio = (16.0f / 9.0f); // Loading game if (Size.X == 0 || Size.Y == 0) { return 1; } // Wide screen : scale 1 at 1920, scale 2 at 3840... else if (Size.X / Size.Y > NominalAspec...
aeb56e74-e6c8-4542-84bc-a0f129db05b1
{ "language": "C++" }
```c++ // Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/android/important_file_writer_android.h" #include <string> #include "base/android/jni_string.h" #include "base/files/important_fil...
```c++ // Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/android/important_file_writer_android.h" #include <string> #include "base/android/jni_string.h" #include "base/files/important_fil...
ad921314-d7da-4da5-b186-a24544345c4c
{ "language": "C++" }
```c++ //===-- sanitizer_common_nolibc.cc ----------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===-- sanitizer_common_nolibc.cc ----------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
b37439ab-f455-43f9-9bbc-1ea14dc00710
{ "language": "C++" }
```c++ #include <cstdio> #include <cstdlib> #include <fcntl.h> #include <unistd.h> #include "touchscreen.h" int main() { touchscreen_init(); while(1) { int x, y; float z; TouchscreenEvent e; while((e = touchscreen_read(&x, &y, &z)) != TOUCHSCREEN_IDLE) { switch(e) { case TOUCHSCREEN_START: ...
```c++ #include <cstdio> #include <cstdlib> #include <fcntl.h> #include <unistd.h> #include "touchscreen.h" int main() { touchscreen_init(); while(1) { static bool dragging = false; int x, y; float z; TouchscreenEvent e; while((e = touchscreen_read(&x, &y, &z)) != TOUCHSCREEN_IDLE) { switch(...
c0ddc412-6243-4025-8783-7cc54a622b5c
{ "language": "C++" }
```c++ // ============================================================================= // Authors: Radu Serban, Justin Madsen // ============================================================================= // // Base class for a vehicle wheel. // A wheel subsystem does not own a body. Instead, when attached to a susp...
```c++ // ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2014 projectchrono.org // All right reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top leve...
707d911b-08db-48f8-8bd0-be44a968eb03
{ "language": "C++" }
```c++ /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
```c++ /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
4aaf50e6-1a8a-49e3-ba8e-92cfe6f8aa35
{ "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. // //===---------------------------------...
236a84e6-64da-4d6a-ac4b-771f0b0fbbf3
{ "language": "C++" }
```c++ // RUN: rm -rf %t // RUN: pp-trace -ignore FileChanged,MacroDefined %s -x objective-c++ -undef -target x86_64 -std=c++11 -fmodules -fcxx-modules -fmodules-cache-path=%t -I%S -I%S/Input | FileCheck --strict-whitespace %s // REQUIRES: x86-registered-target // CHECK: --- @import Level1A; // CHECK-NEXT: - Callback...
```c++ // RUN: rm -rf %t // RUN: pp-trace -ignore FileChanged,MacroDefined %s -x objective-c++ -undef -target x86_64 -std=c++11 -fmodules -fcxx-modules -fmodules-cache-path=%t -I%S -I%S/Input | FileCheck --strict-whitespace %s // CHECK: --- @import Level1A; // CHECK-NEXT: - Callback: moduleImport // CHECK-NEXT: Im...
ed4fa111-5964-4a8e-955f-b2b5f2755af9
{ "language": "C++" }
```c++ #include <Input.h> namespace nme { #if !defined(IPHONE) && !defined(WEBOS) && !defined(ANDROID) && !defined(BLACKBERRY) bool GetAcceleration(double &outX, double &outY, double &outZ) { return false; } #endif } ``` Set define for Tizen accelerometer
```c++ #include <Input.h> namespace nme { #if !defined(IPHONE) && !defined(WEBOS) && !defined(ANDROID) && !defined(BLACKBERRY) && !defined(TIZEN) bool GetAcceleration(double &outX, double &outY, double &outZ) { return false; } #endif } ```
4875639c-af08-4759-b4cc-a1be389b38f6
{ "language": "C++" }
```c++ // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: not %run %t 2>&1 | FileCheck %s #include <stdio.h> #include <string.h> #include <malloc.h> int main() { char *ptr = _strdup("Hello"); int subscript = 1; ptr[subscript] = '3'; printf("%s\n", ptr); fflush(0); // CHECK: H3llo subscript = -1; ptr[subscript...
```c++ // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: not %run %t 2>&1 | FileCheck %s #include <stdio.h> #include <string.h> #include <malloc.h> int main() { char *ptr = _strdup("Hello"); int subscript = 1; ptr[subscript] = '3'; printf("%s\n", ptr); fflush(0); // CHECK: H3llo subscript = -1; ptr[subscript...
d8a2c0ef-7cff-4ced-8bf1-b80a628f67bc
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit 2 %s template<int N, typename T> struct X : X<N+1, T*> {}; // expected-error-re@3 {{recursive template instantiation exceeded maximum depth of 1024{{$}}}} // expected-note@3 {{instantiation of template class}} // expected-note@3 {{skipping 1023...
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit 2 %s // // FIXME: Disable this test when Clang was built with ASan, because ASan // increases our per-frame stack usage enough that this test no longer fits // within our normal stack space allocation. // REQUIRES: not_asan template<int N, type...
d7f90414-52c2-422f-8645-418a59a9a374
{ "language": "C++" }
```c++ // Qt includes #include <QDebug> // Visomics includes #include "voAnalysis.h" #include "voAnalysisFactory.h" #include "voQObjectFactory.h" #include "voPCAStatistics.h" //---------------------------------------------------------------------------- class voAnalysisFactoryPrivate { public: voQObjectFactory<vo...
```c++ // Qt includes #include <QDebug> // Visomics includes #include "voAnalysis.h" #include "voAnalysisFactory.h" #include "voQObjectFactory.h" #include "voPCAStatistics.h" //---------------------------------------------------------------------------- class voAnalysisFactoryPrivate { public: voQObjectFactory<vo...
66b531c6-5f50-4fc9-90df-f29b35ef6546
{ "language": "C++" }
```c++ /** @file @brief Implementation @date 2014 @author Ryan Pavlik <ryan@sensics.com> <http://sensics.com> */ // Copyright 2014 Sensics, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You ma...
```c++ /** @file @brief Implementation @date 2014 @author Ryan Pavlik <ryan@sensics.com> <http://sensics.com> */ // Copyright 2014 Sensics, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You ma...
153c9659-3e74-4c8c-909c-041444e1b3e4
{ "language": "C++" }
```c++ #include <signal.h> #include <unistd.h> #include "mraa.hpp" bool running = true; bool relay_state = false; int last_touch; void sig_handler(int signo) { if (signo == SIGINT) running = false; } int main(int argc, char* argv[]) { mraa::Gpio* touch_gpio = new mraa::Gpio(492); ...
```c++ #include <signal.h> #include <unistd.h> #include "mraa.hpp" bool running = true; bool relay_state = false; int last_touch; void sig_handler(int signo) { if (signo == SIGINT) running = false; } int main(int argc, char* argv[]) { mraa::Gpio* touch_gpio = new mraa::Gpio(29); ...
6232985d-b64b-4b63-b0ff-8c7c8528a154
{ "language": "C++" }
```c++ /* Copyright (C) 2008 Patrick Spendrin <ps_ml@gmx.de> This file is part of the KDE project This library is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of th...
```c++ /* Copyright (C) 2008 Patrick Spendrin <ps_ml@gmx.de> This file is part of the KDE project This library is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of th...
a57565e7-270a-407f-9dc4-671b36f08375
{ "language": "C++" }
```c++ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE DummyClassTest #include <boost/test/unit_test.hpp> #include "../DummyClass/DummyClass.h" BOOST_AUTO_TEST_SUITE(FirstSuite) BOOST_AUTO_TEST_CASE( my_test1 ) { DummyClass obj; BOOST_REQUIRE_EQUAL(&obj, &obj); BOOST_REQUIRE_EQUAL(1, 1); } BOOST_AUTO...
```c++ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE DummyClassTest #include <boost/test/unit_test.hpp> #include "./DummyClass/DummyClass.h" BOOST_AUTO_TEST_SUITE(FirstSuite) BOOST_AUTO_TEST_CASE( my_test1 ) { DummyClass obj; BOOST_REQUIRE_EQUAL(&obj, &obj); BOOST_REQUIRE_EQUAL(1, 1); } BOOST_AUTO_...
12a491e2-4d6d-4e05-be3c-9e748f41ff9d
{ "language": "C++" }
```c++ #include <sstream> #include <string> #include <ccspec/matcher.h> namespace ccspec { namespace matchers { // Public methods. template <typename U> template <typename V> bool Eq<U>::match(V actual_value) const { return actual_value == this->expected_value(); } template <typename U> std::string Eq<U>::desc(...
```c++ #include <sstream> namespace ccspec { namespace matchers { // Public methods. template <typename U> template <typename V> bool Eq<U>::match(V actual_value) const { return actual_value == this->expected_value(); } template <typename U> std::string Eq<U>::desc() const { std::ostringstream s; s << "...
39203375-dc02-45ce-9721-0397a6fd8150
{ "language": "C++" }
```c++ #include "All.h" #include "Common.cpp" #include "WhisperPeer.cpp" ``` Disable SCUs on non MSVC builds.
```c++ #ifdef _MSC_VER #include "All.h" #include "Common.cpp" #include "WhisperPeer.cpp" #endif ```
5568aa04-eadf-400b-84ef-88ee2abb1881
{ "language": "C++" }
```c++ /* Copyright (c) 2014-2015 DataStax 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 agreed to in ...
```c++ /* Copyright (c) 2014-2015 DataStax 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 agreed to in ...
d3f0fbd7-888a-47c2-b1e0-fdaa95a3693a
{ "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 "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/ui_test_utils.h" #includ...
```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 "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/ui_test_utils.h" #includ...
5f077806-de9f-4098-89c3-1460aeae3819
{ "language": "C++" }
```c++ #include "xchainer/testing/numeric.h" #include <cassert> #include "xchainer/dtype.h" #include "xchainer/error.h" #include "xchainer/scalar.h" namespace xchainer { namespace testing { bool AllClose(const Array& a, const Array& b, double rtol, double atol) { if (a.shape() != b.shape()) { throw Dime...
```c++ #include "xchainer/testing/numeric.h" #include <cassert> #include "xchainer/dtype.h" #include "xchainer/error.h" #include "xchainer/scalar.h" namespace xchainer { namespace testing { bool AllClose(const Array& a, const Array& b, double rtol, double atol) { if (a.shape() != b.shape()) { throw Dime...
72c0fdbe-4295-45c7-aaa1-15719915c2e4
{ "language": "C++" }
```c++ // Copyright (c) Arduino. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include <time.h> #include <sys/time.h> #include <RTCZero.h> RTCZero rtc; extern "C" { int _gettimeofday(struct timeval* tp, void* /*tzvp*/) { s...
```c++ // Copyright (c) Arduino. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include <time.h> #include <sys/time.h> #include <RTCZero.h> RTCZero rtc; extern "C" { int _gettimeofday(struct timeval* tp, void* /*tzvp*/) { t...
3ed2484f-11f6-4d02-8405-877e1c233d1a
{ "language": "C++" }
```c++ // // This file is part of the Marble Desktop Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2009 Eckhart Wörner <ewoerner@kde.org> // #include "GpsdConnection.h" #inc...
```c++ // // This file is part of the Marble Desktop Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2009 Eckhart Wörner <ewoerner@kde.org> // #include "GpsdConnection.h" #inc...
aaa30aa9-a5de-4c3c-9ad3-acc5c1ad267b
{ "language": "C++" }
```c++ // Copyright 2014 MongoDB Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to...
```c++ // Copyright 2014 MongoDB Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to...
bc04bd98-f640-4fd2-b0e5-2b21ae054c2c
{ "language": "C++" }
```c++ /* ** Copyright (C) - Triton ** ** This program is under the terms of the LGPLv3 License. */ #include <iostream> #include <Syscalls.h> #include <TritonTypes.h> extern const char *syscallmap[]; const char *syscallNumberLinux64ToString(uint64 syscallNumber) { if (syscallNumber > 0 && syscallNumber < (uin...
```c++ /* ** Copyright (C) - Triton ** ** This program is under the terms of the LGPLv3 License. */ #include <iostream> #include <Syscalls.h> #include <TritonTypes.h> extern const char *syscallmap[]; const char *syscallNumberLinux64ToString(uint64 syscallNumber) { if (syscallNumber >= 0 && syscallNumber < (ui...
89c64a4b-f3f5-4058-8cc3-684e6f1441b2
{ "language": "C++" }
```c++ // Test that LargeAllocator unpoisons memory before releasing it to the OS. // RUN: %clangxx_asan %s -o %t // The memory is released only when the deallocated chunk leaves the quarantine, // otherwise the mmap(p, ...) call overwrites the malloc header. // RUN: ASAN_OPTIONS=quarantine_size=1 %t #include <assert....
```c++ // Test that LargeAllocator unpoisons memory before releasing it to the OS. // RUN: %clangxx_asan %s -o %t // The memory is released only when the deallocated chunk leaves the quarantine, // otherwise the mmap(p, ...) call overwrites the malloc header. // RUN: ASAN_OPTIONS=quarantine_size=1 %t #include <assert....
c2fac559-2220-4264-8d63-cd93389b902d
{ "language": "C++" }
```c++ // Test that we use the suppressions from __asan_default_suppressions. // RUN: %clangxx_asan %s -o %t && not %run %t 2>&1 | FileCheck %s extern "C" { const char *__asan_default_suppressions() { return "FooBar"; } } // CHECK: AddressSanitizer: failed to parse suppressions int main() {} // Test that we use the s...
```c++ // Test that we use the suppressions from __asan_default_suppressions. // RUN: %clangxx_asan %s -o %t && not %run %t 2>&1 | FileCheck %s extern "C" { const char *__asan_default_suppressions() { return "FooBar"; } } // CHECK: AddressSanitizer: failed to parse suppressions int main() {} ```
926517e1-0484-448a-92a4-9f91a7d9511d
{ "language": "C++" }
```c++ #include <tests.hh> BEGIN_TEST(values, client, ) client.setErrorCallback(callback(&dump)); client.setCallback(callback(&dump), "output"); client.send("output << 1;"); //= D output 1 client.send("output << \"coin\";"); //= D output "coin" client.send("error << non.existent;"); //= E error 1.39-50: Unknown ident...
```c++ #include <tests.hh> BEGIN_TEST(values, client, ) client.setErrorCallback(callback(&dump)); client.setCallback(callback(&dump), "output"); client.send("output << 1;"); //= D output 1 client.send("output << \"coin\";"); //= D output "coin" client.send("error << nonexistent;"); //= E error 1.39-49: lookup failed:...
eac1590e-851c-477a-ac1c-f1ec2386ed8c
{ "language": "C++" }
```c++ /* * User.cpp * * Created on: May 1, 2017 * Author: Daniel */ #include "User.hpp" using namespace std; User::User(string cuname, string chash) { uname = cuname; hash = chash; commandfd = 0; mediafd = 0; sessionkey = 0; } User::~User() { // TODO Auto-generated destructor stub } string User::...
```c++ /* * User.cpp * * Created on: May 1, 2017 * Author: Daniel */ #include "User.hpp" using namespace std; User::User(string cuname, string chash) { uname = cuname; hash = chash; commandfd = 0; mediafd = 0; sessionkey = 0; } User::~User() { // TODO Auto-generated destructor stub } string User::...
f8022930-a37e-435a-a193-f3561f58248b
{ "language": "C++" }
```c++ // Copyright (c) 20109 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" #include "net/base/mock_host_resolver.h" // This test failed at times on the Vista d...
```c++ // Copyright (c) 20109 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" #include "net/base/mock_host_resolver.h" // EXTREMELY flaky, crashy, and bad. See ht...
b5d87ad5-26c2-433a-a3fe-012d02a95f65
{ "language": "C++" }
```c++ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "acceptor.h" #include <vespa/vespalib/net/socket_spec.h> #include <functional> #ifdef __APPLE__ #include <poll.h> #endif namespace vespalib::ws { void Acceptor::accept_main(Handler<S...
```c++ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "acceptor.h" #include <vespa/vespalib/net/socket_spec.h> #include <functional> namespace vespalib::ws { void Acceptor::accept_main(Handler<Socket> &socket_handler) { while (!_is_...
65ec441f-4a0f-4408-b24d-eacc1a8570bd
{ "language": "C++" }
```c++ // RUN: rm -rf %t // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fmodules-cache-path=%t %s -emit-llvm -o - | FileCheck %s // CHECK: @_Z3varIiE = {{.*}} %union.union_type { i8 1 }, #pragma clang module build bar module bar { header "bar.h" { size 40 mtime 0 } export * } #pragma clang module conte...
```c++ // RUN: rm -rf %t // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fmodules-cache-path=%t %s -emit-llvm -o - | FileCheck %s // CHECK: @{{.*var.*}} = {{.*}} %union.union_type { i8 1 }, #pragma clang module build bar module bar { header "bar.h" { size 40 mtime 0 } export * } #pragma clang module con...
3790b793-960f-43fe-8e00-a376ba811098
{ "language": "C++" }
```c++ #include <iostream> int main(int argc, char* argv[]) { } ``` Add source for demo of odd VS 2013 behaviour
```c++ #include <functional> #include <type_traits> #include <iostream> int main(int argc, char* argv []) { auto f_1 = [](int x) { return x; }; std::cout << "auto f_1 = [](int x) { return x; };\n"; auto f_2 = [](int x, int y) { return x + y; }; std::cout << "auto f_2 = [](int x, int y) { return x + y; };\n"; st...
55f743ce-9e72-4b41-989f-bbf32e9e9407
{ "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...
dcf96b34-5ad0-4aab-b589-8abb1f5df3b3
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x struct S { int i; int mem(int); }; int foo(int S::* ps, S *s) { return (s->*ps)(1); // expected-error {{called object type 'int' is not a function or function pointer}} } struct S2 { int bitfield : 1; }; int S2::*pf = &S2::bitfield; // expected...
```c++ // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x struct S { int i; int mem(int); }; int foo(int S::* ps, S *s) { return (s->*ps)(1); // expected-error {{called object type 'int' is not a function or function pointer}} } struct S2 { int bitfield : 1; }; int S2::*pf = &S2::bitfield; // expected...
15fd84b7-25b7-4176-87a7-7c5e5bb2fede
{ "language": "C++" }
```c++ // This file is a part of the IncludeOS unikernel - www.includeos.org // // Copyright 2016-2017 Oslo and Akershus University College of Applied Sciences // and Alfred Bratterud // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License...
```c++ // This file is a part of the IncludeOS unikernel - www.includeos.org // // Copyright 2016-2017 Oslo and Akershus University College of Applied Sciences // and Alfred Bratterud // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License...
97047ece-495b-40fc-8878-891cdc31c58c
{ "language": "C++" }
```c++ #define BOOST_TEST_NO_MAIN #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE "VAST Unit Test Suite" #include "test.h" #include "vast/configuration.h" #include "vast/logger.h" int main(int argc, char* argv[]) { vast::configuration config; config.load("/dev/null"); vast::init(config); boost::unit_te...
```c++ #define BOOST_TEST_NO_MAIN #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE "VAST Unit Test Suite" #include <ze.h> #include "test.h" #include "vast/configuration.h" #include "vast/logger.h" int main(int argc, char* argv[]) { vast::configuration config; config.load("/dev/null"); vast::init(config); ...
85cdd424-091e-4ef1-96a1-7becc5c021ad
{ "language": "C++" }
```c++ #include <iostream> #include "pool.h" #include "machine.h" #include "job.h" int main () { Pool machine_pool; Job first_job(1, "one"); machine_pool.add_machine(Machine("one")); machine_pool.add_machine(Machine("two")); machine_pool.add_job(first_job); machine_pool.add_job(Job(2, "two")...
```c++ #include <iostream> #include "pool.h" #include "machine.h" #include "job.h" int main () { Pool machine_pool; machine_pool.add_machine(Machine("one")); machine_pool.add_machine(Machine("two")); Job first_job(1, "one"); machine_pool.add_job(first_job); machine_pool.add_job(Job(2, "two"...
660d30c1-4736-410e-8265-45b5cd446069
{ "language": "C++" }
```c++ // Copyright (C) 2018 Elviss Strazdins // This file is part of the Ouzel engine. #include "LoaderImage.hpp" #include "Cache.hpp" #include "graphics/ImageDataSTB.hpp" #include "graphics/Texture.hpp" #define STBI_NO_PSD #define STBI_NO_HDR #define STBI_NO_PIC #define STBI_NO_GIF #define STBI_NO_PNM #include "stb_...
```c++ // Copyright (C) 2018 Elviss Strazdins // This file is part of the Ouzel engine. #include "LoaderImage.hpp" #include "Cache.hpp" #include "graphics/ImageDataSTB.hpp" #include "graphics/Texture.hpp" namespace ouzel { namespace assets { LoaderImage::LoaderImage(): Loader(TYPE, {"jpg",...
c42e29e1-ea94-4b88-b66b-c68f43feb1ef
{ "language": "C++" }
```c++ /* * Project: Particle Fire Explosion * Stage: 1 * File: main.cpp * Author: suyashd95 */ #include <iostream> #include <SDL.h> using namespace std; int main() { if(SDL_Init(SDL_INIT_VIDEO) < 0) { cout << "SDL_Init failed." << endl; return 1; } cout << "SDL_Init succeeded." << endl; SDL_Quit(); ...
```c++ /* * Project: Particle Fire Explosion * Stage: 1 * File: main.cpp * Author: suyashd95 */ #include <iostream> #include <SDL.h> using namespace std; void setWindowToBlack(SDL_Window* window) { // We must call SDL_CreateRenderer in order for draw calls to affect this window. SDL_Renderer* renderer = SDL...
8ad5b3d8-1b83-4233-b612-caefcdbfeaea
{ "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...
7dc54819-c120-401d-9312-1303d1c75cc4
{ "language": "C++" }
```c++ /* * Illarionserver - server for the game Illarion * Copyright 2011 Illarion e.V. * * This file is part of Illarionserver. * * Illarionserver 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 Foundatio...
```c++ /* * Illarionserver - server for the game Illarion * Copyright 2011 Illarion e.V. * * This file is part of Illarionserver. * * Illarionserver 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 Foundatio...
85ba15e7-8ca4-4cf9-8c19-8aaa021169e9
{ "language": "C++" }
```c++ #include <Value.h> namespace tests { namespace valueSuite { TEST(ValueSuite, UInt8Test) { Value<uint8_t, 1, 3, true> v0={{{13, 37}, {1, 1}, {3, 7}}}; Value<uint8_t, 1, 3, true> v2={{{73, 1}, {3, 1}, {7, 1}}}; EXPECT_EQ(v0, v0) << "Equally assigned values are not equal"; EXPECT_NE(v0, v2) << "Unequally ass...
```c++ #include <Value.h> namespace tests { namespace valueSuite { TEST(ValueSuite, uInt8Test) { Value<uint8_t, 1, 3, true> v0={{{13, 37}, {1, 1}, {3, 7}}}; Value<uint8_t, 1, 3, true> v2={{{73, 1}, {3, 1}, {7, 1}}}; EXPECT_EQ(v0, v0) << "Equally assigned values are not equal"; EXPECT_NE(v0, v2) << "Unequally ass...
d38118aa-f813-4670-bcc6-019981434701
{ "language": "C++" }
```c++ #include "Simulation.hpp" using namespace aff3ct; using namespace aff3ct::simulation; Simulation ::Simulation(const factory::Simulation::parameters& simu_params) : params(simu_params) { } Simulation ::~Simulation() { } void Simulation ::build_communication_chain() { _build_communication_chain(); for (auto...
```c++ #include "Simulation.hpp" using namespace aff3ct; using namespace aff3ct::simulation; Simulation ::Simulation(const factory::Simulation::parameters& simu_params) : params(simu_params) { } Simulation ::~Simulation() { } void Simulation ::build_communication_chain() { _build_communication_chain(); for (auto...
c04179f1-5083-42a9-a6ed-cde56f890264
{ "language": "C++" }
```c++ #include "engine/events-manager.h" #include "engine/game-manager.h" void EventsManager::EventsLoop(sf::RenderWindow* window) { sf::Event event; auto instances = GameManager::GetInstancesManager(); while (window->pollEvent(event)) { switch (event.type) { case sf::Event::Closed: window-...
```c++ #include "engine/events-manager.h" #include "engine/game-manager.h" void EventsManager::EventsLoop(sf::RenderWindow* window) { sf::Event event; auto instances = GameManager::GetInstancesManager(); while (window->pollEvent(event)) { switch (event.type) { case sf::Event::Closed: window-...
ceaf1300-d38a-4eb6-9126-7f7aad57a7ae
{ "language": "C++" }
```c++ #include "Course.h" #include <cstdio> #include <iostream> using namespace std; int main() { if (remove("test-0.sqlite") != 0) { cout << "Error with deletion of database file\n"; } else { cout << "Database file successfully deleted\n"; } // test instantiation of a Course object. cout << "Tes...
```c++ #include "Course.h" #include "Assignment.h" #include <cstdio> #include <iostream> using namespace std; int main() { if (remove("test-0.sqlite") != 0) { cout << "Error with deletion of database file\n"; } else { cout << "Database file successfully deleted\n"; } // test instantiation of a Cours...
4658a1ec-a4ac-4b71-b967-797978306bf9
{ "language": "C++" }
```c++ ``` Add c++11 thread creation with functor object. It generates random vector of 1024 integers and creates two threads to summarize bottom and top half respectfully.
```c++ #include <iostream> #include <vector> #include <thread> #include <algorithm> #include <cstdlib> class AccumulatorFunctor { public: void operator() (const std::vector<int> &v, unsigned long long &acm, unsigned int beginIndex, unsigned int endIndex) { acm = 0; for (unsigned int i = beginIndex;...
49b04b07-1383-440e-a40e-2247628bd23e
{ "language": "C++" }
```c++ ``` Test case for revision 69683.
```c++ // RUN: %llvmgcc -c -g %s -o - | llc -fast -f -o %t.s // RUN: %compile_c %t.s -o %t.o // PR4025 template <typename _Tp> class vector { public: ~vector () { } }; class Foo { ~Foo(); class FooImpl *impl_; }; namespace { class Bar; } class FooImpl { vector<Bar*> thing; }; Foo::~Foo() { delete i...
98ebef50-ebf7-4ed7-a993-d90a8a8cc350
{ "language": "C++" }
```c++ ``` Add cpp program for postorder recursive Traversal
```c++ #include<iostream> using namespace std; struct node { int data; struct node *left; struct node *right; }; struct node *createNode(int val) { struct node *temp = (struct node *)malloc(sizeof(struct node)); temp->data = val; temp->left = temp->right = NULL; return temp; } void postorder(str...
77fa0fdb-4009-4597-8770-a019d08e0672
{ "language": "C++" }
```c++ ``` Add tests for new feature
```c++ // The MIT License (MIT) // Copyright (c) 2014 Rapptz // 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 // use, copy,...
c499deb0-252c-4fed-a227-101e485f2b12
{ "language": "C++" }
```c++ ``` Add implementation of Shared Pointer
```c++ /* * Copyright (C) 2015-2016 Pavel Dolgov * * See the LICENSE file for terms of use. */ #include <bits/stdc++.h> struct Foo { public: Foo() { std::cout << "Foo's constructor." << std::endl; } ~Foo() { std::cout << "Foo's destructor." << std::endl; } }; template<typename T>...
81263905-e6d1-4d68-944d-6bfa64fd40e6
{ "language": "C++" }
```c++ ``` Add solution for 190. Reverse Bits.
```c++ /** * link: https://leetcode.com/problems/reverse-bits/ */ class Solution { public: uint32_t reverseBits(uint32_t n) { bitset<32> res(n); string str = res.to_string(); reverse(str.begin(), str.end()); return bitset<32>(str).to_ulong(); } }; ```
cf444d17-e60f-49c5-8685-fdbb72aff8fa
{ "language": "C++" }
```c++ ``` Add C++ binary search implementation (recursive and iterative)
```c++ #include <cassert> #include <vector> template <class RandomAccessIterator, class KeyValue, class DefaultValue> DefaultValue recursive_binary_search( RandomAccessIterator start, RandomAccessIterator end, KeyValue key, DefaultValue default_value) { if (start == end) { return default_v...
2e1ef133-a34b-49e4-b2ab-9622d6295595
{ "language": "C++" }
```c++ ``` Test for llvm-gcc patch 73564.
```c++ // RUN: %llvmgxx -c -emit-llvm %s -o /dev/null -g // This crashes if we try to emit debug info for TEMPLATE_DECL members. template <class T> class K2PtrVectorBase {}; template <class T> class K2Vector {}; template <class U > class K2Vector<U*> : public K2PtrVectorBase<U*> {}; class ScriptInfoManager { void Pos...
0fb46718-a77a-4db1-9c8b-342a31b3676d
{ "language": "C++" }
```c++ ``` Add framework for image annotation implementation
```c++ #include "fish_detector/image_annotator/image_annotation.h" namespace fish_detector { namespace image_annotator { ImageAnnotation::ImageAnnotation(const std::string& image_file, const std::string& species, const std::string& subspecies, ...
393b47cd-04e8-4060-a2e7-9fc491fc0493
{ "language": "C++" }
```c++ ``` Divide two numbers (use substract.)
```c++ /** * Divide Two Integers * * cpselvis (cpselvis@gmail.com) * August 25th, 2016 */ #include<iostream> #include<cmath> using namespace std; class Solution { public: int divide(int dividend, int divisor) { if (divisor == 0 || (dividend == INT_MIN && divisor == -1)) { return INT_MAX; } ...
0ad9d049-d809-4bb5-80d4-dade698b55ec
{ "language": "C++" }
```c++ ``` Create Evaluate reverse polish notation.cpp
```c++ class Solution { public: stack<int> sta; bool isNum(string str) { if (str.size() > 1) return true; if (str[0] >= '0' && str[0] <= '9') return true; return false; } int evalRPN(vector<string>& tokens) { int a, b, i; string s; ...
ed29c25f-fbca-4ee9-a3be-00cdaedab42e
{ "language": "C++" }
```c++ ``` Test harness for the new SimpleXMLParser class.
```c++ /** \brief Test harness for the SimpleXmlParser class. * \author Dr. Johannes Ruscheinski (johannes.ruscheinski@uni-tuebingen.de) * * \copyright 2015 Universitätsbiblothek Tübingen. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of th...
20c4d944-a937-4f82-aa13-d879b74922db
{ "language": "C++" }
```c++ ``` Add solution for chapter 16 page 601
```c++ #include <iostream> #include<string> using namespace std; template <typename T> T fobj(T a, T b) { return a; } template <typename T> void fref(const T &a, const T &b) { } int main() { string s1("a value"); const string s2("another value"); fobj(s1, s2); fref(s1, s2); ...
850b7628-0b92-4357-8e31-9f791ed17b95
{ "language": "C++" }
```c++ ``` Add test for previously unflattenables
```c++ /* * Copyright 2015 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkAlphaThresholdFilter.h" #include "SkImage.h" #include "Test.h" static void test_flattenable(skiatest::Reporter* r, const SkFla...
ec4fca7f-79ea-49ad-a694-6413a09de9f2
{ "language": "C++" }
```c++ ``` Implement Snakes and Ladders using BFS
```c++ // http://www.geeksforgeeks.org/snake-ladder-problem-2/ #include <iostream> #include <cstring> #include <queue> using namespace std; struct QNode { int v; // vertex int d; //distance; }; int getMinDice(int moves[], int N) { bool *visited = new bool[N]; memset(visited, false, sizeof(visited)); queue<QNode...
34de3133-fea7-41ee-b387-538f34eb5cc3
{ "language": "C++" }
```c++ ``` Add solution to spiral traversal of matrix problem
```c++ #include <iostream> using std::cout; const int MAX = 20; void spiral_traversal(int matrix[][MAX], int rows, int cols) { int start_row = 0; int end_row = rows - 1; int start_column = 0; int end_column = cols - 1; while (start_row <= end_row && start_column <= end_column) { for (int i = start_col...
74cf626f-4467-455a-8067-84c5d1268349
{ "language": "C++" }
```c++ ``` Add test for time interpolator
```c++ #include "testing/gtest.hh" #include "geometry/spatial/time_interpolator.hh" namespace geometry { namespace spatial { TEST(TimeInterpolatorTest, time_interpolator) { const estimation::TimePoint t0 = {}; const estimation::TimeDuration dt = estimation::to_duration(1.0); const std::vector<geometry::spatia...
301f4f20-49ce-4df6-9852-b035b424f581
{ "language": "C++" }
```c++ ``` Add Chapter 19, exercise 13
```c++ // Chapter 19, exercise 13: Tracer class where constructor and destructor print // strings (given as argument to constructor). Use it to see where RAII objects // will do their job (local objects, member objects, global objects, objects // allocated with new...), then add copy constructor and copy assignment to ...
759a4a5d-bdfd-4456-aff3-9da0769cb679
{ "language": "C++" }
```c++ ``` Add Solution for 043 Multiply Strings
```c++ // 43. Multiply Strings /** * Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2. * * Note: * * 1. The length of both num1 and num2 is < 110. * 2. Both num1 and num2 contains only digits 0-9. * 3. Both num1 and num2 does not contain any leading zero...
fe61e47b-ba7d-4fdd-a4de-a5551ff38f48
{ "language": "C++" }
```c++ ``` Create : 521 Cheeses and a Mousetrap
```c++ #include <iostream> using namespace std; int main() { int N, K; cin >> N >> K; if (K == 0 || K > N) { cout << 0 << endl; return 0; } if (N % 2 == 1 && K == (N + 1) / 2) { cout << N - 1 << endl; } else { cout << N - 2 << endl; } return 0; } ``...
caaa3d34-1516-4d23-9ae7-aac373a6fd4d
{ "language": "C++" }
```c++ ``` Add test case for fix of linkage bug that miscompiled variable templates instantiated from similarly named local types (cf. r212233)
```c++ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -std=c++1y -O1 -disable-llvm-optzns %s -o - | FileCheck %s -check-prefix=CHECKA -check-prefix=CHECK // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -std=c++1y -O1 -disable-llvm-optzns -fcxx-exceptions %s -o - | FileCheck %s -check-pref...
9a8aada6-7458-48dc-b81c-fdaeea1b45a4
{ "language": "C++" }
```c++ ``` Add test case for insertion, retrieval and display
```c++ /* This program tests class LinkedList */ #include<iostream> #include<vector> #include "linkedlist.h" // tests insertion void testInsert(){ std::cout<<"Test Insert\n"; // define vector of values std::vector<int> values = {6,5,4,3,2,1}; // create linked list LinkedList ll; // insert values into link...
3a2d06f4-8d99-40fc-a32b-182c2f890a8e
{ "language": "C++" }
```c++ ``` Add benchmark of the fast detector
```c++ #include <chrono> #include <iostream> #include <opencv2/highgui/highgui.hpp> #include <opencv2/opencv.hpp> #include <vpp/vpp.hh> #include <vpp/utils/opencv_bridge.hh> #include <vpp/algorithms/FAST_detector/FAST.hh> #include "get_time.hh" int main(int argc, char* argv[]) { using namespace vpp; if (argc !=...
8cf26cea-92c2-4523-ae27-de985d13f640
{ "language": "C++" }
```c++ ``` Remove Duplicates from Sorted List II
```c++ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ class Solution { public: ListNode* dele...
bd7d1643-97d0-4617-af3a-248880ff105e
{ "language": "C++" }
```c++ ``` Add first version of C++ stl deque.
```c++ #include <iostream> #include <deque> using namespace std; // This is a very well known problem that can easily be found // in google as 'maximum sliding window' where basically we are // moving over an array printing each max value for each sub-array // (or window). You can take a look to the explanation and /...
267967e3-93d2-4484-8b95-01f2cc6b3ccc
{ "language": "C++" }
```c++ ``` Add code generation test for r86500.
```c++ // RUN: clang-cc %s -emit-llvm -o - | FileCheck %s // Check that call to constructor for struct A is generated correctly. struct A { A(int x = 2); }; struct B : public A {}; B x; // CHECK: call void @_ZN1AC1Ei ```
f76ab2f1-0abf-44b7-8616-9c3a935d029e
{ "language": "C++" }
```c++ // RUN: rm -rf %t // RUN: %clang_cc1 -x objective-c++ -fmodules -fmodule-cache-path %t -I %S/Inputs %s -verify // expected-no-diagnostics @import cxx_many_overloads; void g() { f(N::X<0>()); } ``` Fix conflict between r174685 and r174645 (rename -fmodule-cache-path <foo> to -fmodules-cache-path=<foo>).
```c++ // RUN: rm -rf %t // RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify // expected-no-diagnostics @import cxx_many_overloads; void g() { f(N::X<0>()); } ```
416cde1c-9f1e-47c4-8456-0b4fef327ad7
{ "language": "C++" }
```c++ ``` Add a simple test for temporaries.
```c++ // RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9 && struct A { A(); ~A(); void f(); }; void f() { // RUN: grep "call void @_ZN1AC1Ev" %t | count 2 && // RUN: grep "call void @_ZN1AD1Ev" %t | count 2 A(); A().f(); } ```
5cc13cbb-3e27-4755-96c1-15f08aed6abd
{ "language": "C++" }
```c++ ``` Add one more test for the handling of stack origins.
```c++ // Test that on the second entry to a function the origins are still right. // RUN: %clangxx_msan -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1 // RUN: FileCheck %s < %t.out // RUN: %clangxx_msan -m64 -O1 %s -o %t && not %run %t >%t.out 2>&1 // RUN: FileCheck %s < %t.out // RUN: %clangxx_msan -m64 -O2 %s -o %t ...
d2af1f00-8f4a-4edd-8b3e-74c431d5c685
{ "language": "C++" }
```c++ ``` Add test for dynamic stack allocation
```c++ #include "cxx_runtime.h" #include "output.h" Output output; int bar(char *buffer, int size) { char tmp[size * 2]; int index = 0; output << "enter bar\n"; for (int i = 0; i < size; i++) { if (buffer[i] == 'i') { tmp[index++] = '~'; tmp[index++] = 'i'; } else tmp[index++] = buffer[i]; } ...
a6b35999-499a-4874-9b8a-8f64addd407c
{ "language": "C++" }
```c++ ``` Add solution to homework 1
```c++ #include <iostream> #include <fstream> #include <stack> using std::ifstream; using std::ofstream; using std::ios; using std::cout; using std::stack; bool is_digit(char c) { return c >= '0' && c <= '9'; } void apply_operation(char operation, stack<double>& operands) { double second_operand = operands.top()...
c84f9dbf-fccd-4f73-9fcc-9be1f1354a71
{ "language": "C++" }
```c++ ``` Add basic test for -style=none.
```c++ // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp // RUN: clang-format -style=none -i %t.cpp // RUN: FileCheck -strict-whitespace -input-file=%t.cpp %s // CHECK: int i; int i; ```
c821ad45-a431-4aac-9644-808e521b163e
{ "language": "C++" }
```c++ ``` Add a template for Google Test
```c++ #if (defined(__GNUC__) && (__GNUC__ > (major) || __GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) # define <+FILE_CAPITAL+>_AVAILABLE_GCC_WARNING_PRAGMA #endif #ifdef <+FILE_CAPITAL+>_AVAILABLE_GCC_WARNING_PRAGMA # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Weffc++" # if __cplusplus >= 2...