doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
e8899b9f-0364-40ca-8bde-c307471a2936
{ "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 "views/controls/menu/menu_config.h" #include "grit/app_resources.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/...
```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 "views/controls/menu/menu_config.h" #include "grit/app_resources.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/...
d1a6825a-205e-4de0-93d3-f138d6aaaae4
{ "language": "C++" }
```c++ /* * SimNetworkFunctions.cpp * * Created on: 18.04.2016 * Author: Marc Hartung */ #include "../../include/network_impl/SimNetworkFunctions.hpp" #include <iostream> namespace NetOff { std::string createStringFromData(const char * data) { size_t num = getIntegralFromData<size_t>(data)...
```c++ /* * SimNetworkFunctions.cpp * * Created on: 18.04.2016 * Author: Marc Hartung */ #include "network_impl/SimNetworkFunctions.hpp" #include <iostream> namespace NetOff { std::string createStringFromData(const char * data) { size_t num = getIntegralFromData<size_t>(data); con...
21120c4b-86b5-4c04-9a92-43302daa41ce
{ "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/webui/options2/chromeos/stats_options_handler.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "b...
```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/webui/options2/chromeos/stats_options_handler.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "b...
a1453e5b-4d6f-4ce5-a417-7cc5b4dd066f
{ "language": "C++" }
```c++ #include "Limiter.h" #include "Testing.h" #include <iostream> auto TestWithPeakLoadInTheBeginning(int maxAllowedRps) { const auto startTime = std::chrono::steady_clock::now(); int sentRequestsCount = 0; Limiter limiter(maxAllowedRps, 100); for (; sentRequestsCount < maxAllowedRps; ++sentRequestsCount) { ...
```c++ #include "Limiter.h" #include "Testing.h" #include <iostream> auto TestWithPeakLoadInTheBeginning(int maxAllowedRps) { const auto startTime = std::chrono::steady_clock::now(); int sentRequestsCount = 0; Limiter limiter(maxAllowedRps, 10000); for (; sentRequestsCount < maxAllowedRps; ++sentRequestsCount) ...
d1a0fdfe-bb7c-4ae9-b0e4-05502550e793
{ "language": "C++" }
```c++ #include<iostream> #include<boost/filesystem.hpp> using namespace boost::filesystem; //bool CopyDir(path const & source_path, path const & destination_path); int main(int argc, char *argv[]) { if(argc < 3) { std::cout << "USAGE " << argv[0] << " source destination" << std::endl; r...
```c++ #include<iostream> #include<boost/filesystem.hpp> using namespace boost::filesystem; //bool CopyDir(path const & source_path, path const & destination_path); int main(int argc, char *argv[]) { if(argc < 3) { std::cout << "USAGE " << argv[0] << " source destination" << std::endl; r...
4bb674c3-5ff4-416d-b545-5b8ff3fef286
{ "language": "C++" }
```c++ // RUN: %clang_cc1 %s -triple i386-pc-windows-msvc19.0.0 -emit-obj \ // RUN: -debug-info-kind=line-tables-only -fms-extensions class __declspec(dllexport) A { A(int * = new int) {} }; // CHECK: define {{.*}}void @"\01??_FA@@AAEXXZ" // CHECK-SAME: !dbg ![[SP:[0-9]+]] // CHECK-NOT: {{ret }} // CHECK: call x8...
```c++ // RUN: %clang_cc1 %s -triple i386-pc-windows-msvc19.0.0 -emit-llvm \ // RUN: -debug-info-kind=line-tables-only -fms-extensions -o - | FileCheck %s class __declspec(dllexport) A { A(int * = new int) {} }; // CHECK: define {{.*}}void @"\01??_FA@@AAEXXZ" // CHECK-SAME: !dbg ![[SP:[0-9]+]] // CHECK-NOT: {{ret...
b2378adb-5013-47ab-b1c3-e04fb097305a
{ "language": "C++" }
```c++ int main() { int *a; int *n = a; a = n; *n = 5; return 0; }``` Add a special condition so that static analyzers could write the exact condition when problem happens
```c++ #include <stdio.h> int main() { int input; if (scanf("%d", &input) == 1) { if (input == 2) { int *a; int *n = a; a = n; *n = 5; } else { printf("OK\n"); } } return 0; }```
712c0c2a-2b1b-43b7-8318-23d4f4607716
{ "language": "C++" }
```c++ extern "C" { #include "packet_queue.h" #include "error.h" #include "nrf51.h" #include "nrf51_bitfields.h" } #include "CppUTest/TestHarness.h" TEST_GROUP(packet_queue) { void setup(void) { } void teardown(void) { } }; TEST(packet_queue, test_packet_queue_init_suc...
```c++ extern "C" { #include "packet_queue.h" #include "error.h" #include "nrf51.h" #include "nrf51_bitfields.h" } #include "CppUTest/TestHarness.h" TEST_GROUP(packet_queue) { packet_queue_t queue; void setup(void) { packet_queue_init(&queue); } void teardown(void) ...
d1e2b592-e3d2-4429-a2b3-345f714ca03e
{ "language": "C++" }
```c++ #include <osgDB/ImageOptions> using namespace osgDB; ImageOptions::ImageOptions() { init(); } ImageOptions::ImageOptions(const std::string& str) { init(); _str = str; } void ImageOptions::init() { _sourceImageSamplingMode = NEAREST; _sourceImageWindowMode = ALL_IMAGE; _dest...
```c++ #include <osgDB/ImageOptions> using namespace osgDB; ImageOptions::ImageOptions() { init(); } ImageOptions::ImageOptions(const std::string& str) { init(); _str = str; } void ImageOptions::init() { _sourceImageSamplingMode = NEAREST; _sourceImageWindowMode = ALL_IMAGE; _dest...
cc1acc74-ce72-41bf-a0de-a45253406038
{ "language": "C++" }
```c++ #pragma once #include <threadingzeug/parallelfor.h> namespace threadingzeug { int getNumberOfThreads() { return std::max(static_cast<size_t>(2), static_cast<size_t>(std::thread::hardware_concurrency())); } } // namespace threadingzeug ``` Remove pragma from source file
```c++ #include <threadingzeug/parallelfor.h> namespace threadingzeug { int getNumberOfThreads() { return std::max(static_cast<size_t>(2), static_cast<size_t>(std::thread::hardware_concurrency())); } } // namespace threadingzeug ```
53e74265-5585-4a3f-9fe1-df17dab5c5ab
{ "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...
abd5e175-24c3-4597-9f95-4adb8f677541
{ "language": "C++" }
```c++ #include "thread_checker.h" #include <windows.h> #include "Processthreadsapi.h" namespace dux { #ifdef _WIN32 ThreadChecker::ThreadChecker() : thread_id_(GetCurrentThreadId()) {} bool ThreadChecker::IsCreationThreadCurrent() const { return GetCurrentThreadId() == thread_id_; } #endif } // namespace dux...
```c++ #include "thread_checker.h" #ifdef _WIN32 #include <windows.h> #include "Processthreadsapi.h" namespace dux { ThreadChecker::ThreadChecker() : thread_id_(GetCurrentThreadId()) {} bool ThreadChecker::IsCreationThreadCurrent() const { return GetCurrentThreadId() == thread_id_; } } // namespace dux #endi...
763161e5-38c1-4a97-8caf-b8be69f7a1cd
{ "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. // //===---------------------------------...
579e330f-e64c-405d-b071-d9cfe9ebb77a
{ "language": "C++" }
```c++ #include <iostream> #include <ccspec/core/formatters/text_formatter.h> namespace ccspec { namespace core { namespace formatters { using std::endl; using std::exception; using std::exception_ptr; using std::list; using std::ostream; using std::rethrow_exception; // Public methods. void TextFormatter::afterEac...
```c++ #include <iostream> #include <ccspec/core/formatters/text_formatter.h> namespace ccspec { namespace core { namespace formatters { using std::endl; using std::exception; using std::exception_ptr; using std::list; using std::ostream; using std::rethrow_exception; // Public methods. void TextFormatter::afterEac...
c5795c66-fe5f-42bc-8d7e-085a2276952d
{ "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/extensions/extension_apitest.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, SessionRestoreApis) { ASSERT_TRUE(RunExten...
```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/extensions/extension_apitest.h" // Flaky on ChromeOS http://crbug.com/251199 #if defined(OS_CHROMEOS) #define MAYBE_S...
8aeefd6b-73cd-4a6f-ab87-025c49b47906
{ "language": "C++" }
```c++ // Copyright 2004-present Facebook. All Rights Reserved. #include "ApkManager.h" #include <boost/filesystem.hpp> #include <iostream> #include <sstream> namespace { bool check_directory(std::string& apkdir) { if (!boost::filesystem::is_directory(apkdir.c_str())) { std::cerr << "error: apkdir is not a wr...
```c++ // Copyright 2004-present Facebook. All Rights Reserved. #include "ApkManager.h" #include <boost/filesystem.hpp> #include <iostream> #include <sstream> namespace { void check_directory(std::string& dir) { if (!boost::filesystem::is_directory(dir.c_str())) { std::cerr << "error: not a writable directory...
69c141fb-4d6d-4d87-9326-7a14096700b1
{ "language": "C++" }
```c++ #include <iostream> #include <string> std::string parse_command(const std::string& input) { return input.substr(0, input.find(' ')); } int main() { std::cout << "PUCRS FAT16 SHELL\n"; std::cout << "$ "; std::string cmd; getline (std::cin, cmd); std::cout << "-> Will execute: " << parse_command(cmd...
```c++ #include <iostream> #include <string> std::string parse_command(const std::string& input) { return input.substr(0, input.find(' ')); } int main() { std::cout << "PUCRS FAT16 SHELL\n"; while (true) { std::cout << "$ "; std::string cmd; getline (std::cin, cmd); std::cout << "-> Will execute...
3e4d0c53-227a-499b-920a-85404fb12e1d
{ "language": "C++" }
```c++ #include <dns_sd.h> #include <ev++.h> int main(int argc, char *argv[]) { (void)argc; (void)argv; return 0; } ``` Check if we have enough arguments
```c++ #include <iostream> #include <dns_sd.h> #include <ev++.h> #include "build_version.h" int main(int argc, char *argv[]) { if (2 != argc) { std::cerr << argv[0] << " <announce file>" << std::endl; std::cerr << "Version: " << VERSION << std::endl; return -1; } return 0; } ```
ebef4d1f-4a9e-41e4-b92b-bb71b97f338a
{ "language": "C++" }
```c++ // Copyright 2017, Dawid Kurek, <dawikur@gmail.com> #include "lel/operation/increment_decrement.hpp" #include "gtest/gtest.h" TEST(increment_decrement_test, TODO) {} ``` Add tests for pre/post inc/decrement
```c++ // Copyright 2017, Dawid Kurek, <dawikur@gmail.com> #include "lel/operation/increment_decrement.hpp" #include "gtest/gtest.h" TEST(increment_decrement_test, preincrement) { LeL::Operation::__PreIncrement pre_increment; int i = 5; ASSERT_EQ(6, pre_increment(i)); } TEST(increment_decrement_test, postin...
6d454f9a-ce55-4a22-a965-e5273c3d1ea6
{ "language": "C++" }
```c++ #include "Assignment.h" #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 Cours...
```c++ #include "Assignment.h" #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 Cours...
c0a45d3c-4091-44c6-b6ce-9b5f8db25213
{ "language": "C++" }
```c++ /* ***** BEGIN LICENSE BLOCK ***** * Sconspiracy - Copyright (C) IRCAD, 2004-2010. * Distributed under the terms of the BSD Licence as * published by the Open Source Initiative. * ****** END LICENSE BLOCK ****** */ MiniLauncher::MiniLauncher( ::boost::filesystem::path profilePath ) { ::boost::filesyst...
```c++ /* ***** BEGIN LICENSE BLOCK ***** * Sconspiracy - Copyright (C) IRCAD, 2004-2010. * Distributed under the terms of the BSD Licence as * published by the Open Source Initiative. * ****** END LICENSE BLOCK ****** */ MiniLauncher::MiniLauncher( ::boost::filesystem::path profilePath ) { ::boost::filesyst...
df99a33a-4a0d-42c4-bab9-7f96924baf55
{ "language": "C++" }
```c++ #include <QGuiApplication> #include <QQmlApplicationEngine> #include <QQmlContext> #include "System/management.h" int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; // Create management object and register it as context property Management *man = ...
```c++ #include <ctime> #include <QGuiApplication> #include <QQmlApplicationEngine> #include <QQmlContext> #include "System/management.h" int main(int argc, char *argv[]) { srand((unsigned)time(NULL)); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; // Create management object and re...
4603395b-e3b1-433f-9321-2ae10fad3082
{ "language": "C++" }
```c++ #include <iomanip> #include <iostream> #include <boost/log/trivial.hpp> #include <boost/log/utility/setup/console.hpp> static void color_fmt(boost::log::record_view const& rec, boost::log::formatting_ostream& strm) { auto severity = rec[boost::log::trivial::severity]; bool color = false; if (severity) { ...
```c++ #include <iomanip> #include <iostream> #include <boost/log/trivial.hpp> #include <boost/log/utility/setup/console.hpp> static void color_fmt(boost::log::record_view const& rec, boost::log::formatting_ostream& strm) { auto severity = rec[boost::log::trivial::severity]; bool color = false; if (severity) { ...
69d18fdb-f683-46a0-ad8a-59f6288cf41c
{ "language": "C++" }
```c++ //////////////////////////////////////////////////////////////////////////// // // Copyright 2016 Realm 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...
```c++ //////////////////////////////////////////////////////////////////////////// // // Copyright 2016 Realm 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...
31d51e66-0169-468e-b3bb-c98b92aff46f
{ "language": "C++" }
```c++ #include <opencv2/opencv.hpp> #include <iostream> using namespace std; using namespace cv; int main() { VideoCapture cap(0); if (!cap.isOpened()) { cout << "Error opening webcam" << endl; return -1; } int frame_width = cap.get(CV_CAP_PROP_FRAME_WIDTH); int frame_height = cap.get(CV_CAP_PROP...
```c++ #include <opencv2/opencv.hpp> #include <iostream> using namespace std; using namespace cv; int main() { VideoCapture cap(0); if (!cap.isOpened()) { cout << "Error opening webcam" << endl; return -1; } int frame_width = cap.get(CV_CAP_PROP_FRAME_WIDTH); int frame_height = cap.get(CV_CAP_PROP...
8ed293c0-8181-40a6-89e9-f093ec398e72
{ "language": "C++" }
```c++ #include "gtest/gtest.h" #include "motor_shield.h" MotorShield mshield(1, 3, 4, 5); TEST(MotorShield, Initialization) { ASSERT_TRUE(1 == 1); } ``` Add a test for MotorShield constructor
```c++ #include "gtest/gtest.h" #include "motor_shield.h" #define SPEED_L 1 #define DIR_L 2 #define SPEED_R 3 #define DIR_R 4 MotorShield mshield(SPEED_L, DIR_L, SPEED_R, DIR_R); TEST(MotorShield, Initialization) { ASSERT_EQ(0, mshield.getMinSpeed()); ASSERT_EQ(255, mshield.getMaxSpeed()); ASSERT_EQ(SPEED_L,...
7d97c90d-a846-4e0b-a79d-3c76dd2710b1
{ "language": "C++" }
```c++ /* * msg - user messages - implementation * Copyright(c) 2004 of wave++ (Yuri D'Elia) <wavexx@users.sf.net> * Distributed under GNU LGPL without ANY warranty. */ // c system headers #include <stdarg.h> #include <cstdio> using std::vfprintf; using std::fprintf; // data const char* prg; bool verbose = false...
```c++ /* * msg - user messages - implementation * Copyright(c) 2004 of wave++ (Yuri D'Elia) <wavexx@users.sf.net> * Distributed under GNU LGPL without ANY warranty. */ // local headers #include "msg.hh" // c system headers #include <stdarg.h> #include <cstdio> using std::vfprintf; using std::fprintf; // data c...
024649b3-c1b3-42ea-8985-2065e8c9d6b2
{ "language": "C++" }
```c++ #include "Graph.h" ``` Add new functions and finished module Graph.h
```c++ #include "Graph.h" #include <fstream> using namespace std; void main() { setlocale(LC_ALL, "Russian"); ifstream inputFile("inputfile.txt"); int numberOfCountries = 0; List **mapOfWorld = creatingCoutries(inputFile); printMap(mapOfWorld); deleteMap(mapOfWorld); system("pause"); }```
e2696331-05bf-4154-a804-8dfad52d0977
{ "language": "C++" }
```c++ // // Created by Konstantin Gredeskoul on 1/23/16. // #include "gtest/gtest.h" #include "macros_color_test.h" TEST(rgb_pixel, set_color) { pixel.setColor(purple); EXPECT_EQ_COLORS(pixel.getColor(), purple); wait_for(10); EXPECT_EQ_COLORS(pixel.getColor(), purple); } TEST(rgb_pixel, fade_same_...
```c++ // // Created by Konstantin Gredeskoul on 1/23/16. // #include "gtest/gtest.h" #include "macros_color_test.h" TEST(rgb_pixel, set_color) { pixel.setColor(purple); EXPECT_EQ_COLORS(pixel.getColor(), purple); wait_for(10); EXPECT_EQ_COLORS(pixel.getColor(), purple); } //TEST(rgb_pixel, fade_sam...
00c94639-1023-4191-9194-6df658c5c6c6
{ "language": "C++" }
```c++ /* googletalkcalldialog.cpp - Google Talk and Google libjingle support Copyright (c) 2009 by Pali Rohár <pali.rohar@gmail.com> ************************************************************************* * * * This library i...
```c++ /* googletalkcalldialog.cpp - Google Talk and Google libjingle support Copyright (c) 2009 by Pali Rohár <pali.rohar@gmail.com> ************************************************************************* * * * This library i...
dda98564-e4ef-4a23-8722-fff38c33bab7
{ "language": "C++" }
```c++ // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp // RUN: not cpp11-migrate -format-style=FOO -use-auto %t.cpp -- -std=c++11 // RUN: not cpp11-migrate -format-style=/tmp/ -use-auto %t.cpp -- -std=c++11 // RUN: cpp11-migrate -format-style=LLVM -use-auto %t.cpp -- -std=c++11 // RUN: FileCheck --strict-whitespace -input-...
```c++ // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp // RUN: not cpp11-migrate -format-style=non_existent_file.yaml -use-auto %t.cpp -- -std=c++11 // RUN: touch %T/non_format_config.yaml // RUN: not cpp11-migrate -format-style=%T/non_format_config.yaml -use-auto %t.cpp -- -std=c++11 // RUN: cpp11-migrate -format-style=LL...
149b9f5e-ead4-48e8-94b7-93187cea32e4
{ "language": "C++" }
```c++ #include "cvd/colourspace.h" namespace CVD { namespace ColourSpace { inline void yuv420p_to_rgb_c(const unsigned char* y, const unsigned char* u, const unsigned char* v, unsigned char* rgb, unsigned int width, unsigned int height); extern "C"{ void cvd_asm_yuv420p_to_rgb(const unsigned char*, unsigned...
```c++ #include "cvd/colourspace.h" #include "cvd/utility.h" namespace CVD { namespace ColourSpace { inline void yuv420p_to_rgb_c(const unsigned char* y, const unsigned char* u, const unsigned char* v, unsigned char* rgb, unsigned int width, unsigned int height); extern "C"{ void cvd_asm_yuv420p_to_rgb(const...
2cdfc4d1-0351-4cee-868a-f780b412eb32
{ "language": "C++" }
```c++ // // MathsUtilities.cpp // TimGameLib // // Created by Tim Brier on 10/04/2015. // Copyright (c) 2015 tbrier. All rights reserved. // #include "MathsUtilities.hpp" #include <random> #include <functional> namespace MathsUtilities { std::function<int()> GetRandomGeneratorFunctionForRange(int min, int m...
```c++ // // MathsUtilities.cpp // TimGameLib // // Created by Tim Brier on 10/04/2015. // Copyright (c) 2015 tbrier. All rights reserved. // #include "MathsUtilities.hpp" #include <random> #include <functional> namespace MathsUtilities { std::function<int()> GetRandomGeneratorFunctionForRange(int min, int m...
d0b179ba-681c-4503-a691-79c179f4926a
{ "language": "C++" }
```c++ #include "Control.h" #include <sstream> Control::Control() { } Control::Control(int id, HWND parent) : _id(id), _parent(parent) { _hWnd = GetDlgItem(parent, id); } Control::~Control() { } bool Control::Text(std::wstring text) { return SetDlgItemText(_parent, _id, text.c_str()) == TRUE; } bool Con...
```c++ #include "Control.h" #include <sstream> Control::Control() { } Control::Control(int id, HWND parent) : _id(id), _parent(parent) { _hWnd = GetDlgItem(parent, id); } Control::~Control() { } bool Control::Text(std::wstring text) { return SetDlgItemText(_parent, _id, text.c_str()) == TRUE; } bool Con...
8109f47e-9112-4e90-a48b-ef4e0fd2d6a4
{ "language": "C++" }
```c++ //===--- DriverOptions.cpp - Driver Options Table -------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===--- DriverOptions.cpp - Driver Options Table -------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
619467a8-b6a9-412e-b8d5-8dc07338b5cd
{ "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/chromeos/login/textfield_with_margin.h" #include "chrome/browser/chromeos/login/helper.h" #include "ui/base/keycodes/...
```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/chromeos/login/textfield_with_margin.h" #include "chrome/browser/chromeos/login/helper.h" #include "ui/base/keycodes/...
93941c8c-8a29-4440-9a18-995e12114502
{ "language": "C++" }
```c++ VectorXf v; v.setLinSpaced(5,0.5f,1.5f).transpose(); cout << v << endl; ``` Remove confusing transpose() in setLinSpaced() docs.
```c++ VectorXf v; v.setLinSpaced(5,0.5f,1.5f); cout << v << endl; ```
c020465b-50df-4a30-b290-896c2560762b
{ "language": "C++" }
```c++ // Copyright (c) 2015 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #include "atom/common/api/event_emitter_caller.h" #include "atom/common/api/locker.h" #include "atom/common/node_includes.h" namespace mate { namespace internal { v8::Local<...
```c++ // Copyright (c) 2015 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #include "atom/common/api/event_emitter_caller.h" #include "atom/common/api/locker.h" #include "atom/common/node_includes.h" namespace mate { namespace internal { v8::Local<...
312fb461-b15d-4026-a8d6-11cbff1714c0
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -verify %s // REQUIRES: thread_support // expected-warning@* 0-1{{stack nearly exhausted}} // expected-note@* 0+{{}} template<int N> struct X : X<N-1> {}; template<> struct X<0> {}; X<1000> x; template<typename ...T> struct tuple {}; template<typename ...T> auto f(tuple<T...> t) -> decltype...
```c++ // RUN: %clang_cc1 -verify %s // REQUIRES: thread_support // FIXME: Detection of, or recovery from, stack exhaustion does not work on // NetBSD at the moment. Since this is a best-effort mitigation for exceeding // implementation limits, just disable the test. // UNSUPPORTED: system-netbsd // expected-warning@...
f81dd885-bd55-44b7-b790-4f4e8b6c5d1f
{ "language": "C++" }
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/app_modal_dialog_queue.h" #include "chrome/browser/browser_list.h" void AppModalDialogQueue::AddDialog(AppModal...
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/app_modal_dialog_queue.h" #include "chrome/browser/browser_list.h" void AppModalDialogQueue::AddDialog(AppModal...
7b142b4b-c7af-4551-8820-10a821b8f35b
{ "language": "C++" }
```c++ #include <immintrin.h> bool is_sorted_avx512(int32_t* a, size_t n) { const __m512i shuffle_pattern = _mm512_setr_epi32(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15); size_t i = 0; while (i < n - 16) { const __m512i curr = _mm512_loadu_si512(reinterpret_cast<const __m512i*>(a + i))...
```c++ #include <immintrin.h> bool is_sorted_avx512(int32_t* a, size_t n) { static const __m512i shuffle_pattern = _mm512_setr_epi32(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15); size_t i = 0; while (i < n - 16) { const __m512i curr = _mm512_loadu_si512(reinterpret_cast<const __m512i*>(...
7b610910-3f6f-47f2-b4ca-85900bdbb99f
{ "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 "crypto/ec_signature_creator.h" #include "base/logging.h" namespace crypto { // static ECSignatureCreator* ECSignatureCreator::Crea...
```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 "crypto/ec_signature_creator.h" #include "base/logging.h" namespace crypto { // static ECSignatureCreator* ECSignatureCreator::Crea...
3fcfebba-f6c7-48b7-9402-1814dc4f8982
{ "language": "C++" }
```c++ #include "../Coin.h" #include "../Params.h" #include "../../../streams.h" #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_SUITE(sigma_coin_tests) BOOST_AUTO_TEST_CASE(pubcoin_serialization) { secp_primitives::GroupElement coin; coin.randomize(); sigma::PublicCoinV3 pubcoin(coin, sigma::ZQ_GOL...
```c++ #include "../Coin.h" #include "../Params.h" #include "../../../streams.h" #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_SUITE(sigma_coin_tests) BOOST_AUTO_TEST_CASE(pubcoin_serialization) { secp_primitives::GroupElement coin; coin.randomize(); sigma::PublicCoinV3 pubcoin(coin, sigma::ZQ_GOL...
7e080b85-454d-469b-a936-6cb451f9291c
{ "language": "C++" }
```c++ /****************************************************************************** * The MIT License (MIT) * * Copyright (c) 2016-2017 Baldur Karlsson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to dea...
```c++ /****************************************************************************** * The MIT License (MIT) * * Copyright (c) 2016-2017 Baldur Karlsson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to dea...
50b1e26b-5e5a-40bd-bf3c-13e31b61a477
{ "language": "C++" }
```c++ // ep1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <gtest\gtest.h> int _tmain(int argc, _TCHAR* argv[]) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } ``` Add two tests to demo 'override' specifier.
```c++ // ep1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <memory> #include <gtest\gtest.h> using namespace std; struct Foo { virtual int Plus(int left, int right) { return 2; } }; struct Bar : public Foo { virtual int Plus(int left, short right)...
5ebd1ff0-5c4f-44dc-81c2-b3894259ad52
{ "language": "C++" }
```c++ // Copyright (c) 2012-2015 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 "compat/sanity.h" #include "key.h" #include "test/test_bitcoin.h" #include <boost/test/unit_test.hpp> BOOST...
```c++ // Copyright (c) 2012-2015 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 "compat/sanity.h" #include "key.h" #include "test/test_bitcoin.h" #include <boost/test/unit_test.hpp> BOOST...
80c0ff31-9168-4c76-871c-c6064b1aa1a6
{ "language": "C++" }
```c++ /* * Unit tests for the checkerboard. * Author: Dino Wernli */ #include <gtest/gtest.h> #include "scene/texture/checkerboard.h" #include "test/test_util.h" namespace { static IntersectionData DataWithCoords(Scalar ss, Scalar tt) { Ray r(Point3(0, 0, 0), Vector3(0, 0, 1)); IntersectionData data(r); d...
```c++ /* * Unit tests for the checkerboard. * Author: Dino Wernli */ #include <gtest/gtest.h> #include "scene/texture/checkerboard.h" #include "test/test_util.h" namespace { static IntersectionData DataWithCoords(Scalar ss, Scalar tt) { Ray r(Point3(0, 0, 0), Vector3(0, 0, 1)); IntersectionData data(r); d...
2776bab3-22c1-43ec-b03a-c28462914988
{ "language": "C++" }
```c++ // Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "auto_id.h" using namespace autowiring; // Index that will be given to the next auto_id instance. Zero is reserved. static int s_index = 1; const auto_id_block auto_id_t<void>::s_block{ 0, &typeid(void), &typ...
```c++ // Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "auto_id.h" using namespace autowiring; // Index that will be given to the next auto_id instance. Zero is reserved. static int s_index = 1; const auto_id_block auto_id_t<void>::s_block{ 0, &typeid(void), &typ...
d7a75f56-9da5-4e4d-a889-01c9aced17f4
{ "language": "C++" }
```c++ #include "codearea.h" #include <algorithm> namespace openlocationcode { const double kLatitudeMaxDegrees = 90; const double kLongitudeMaxDegrees = 180; CodeArea::CodeArea(double latitude_lo, double longitude_lo, double latitude_hi, double longitude_hi, size_t code_length) { latitude_lo_ ...
```c++ #include "codearea.h" #include <algorithm> namespace openlocationcode { const double kLatitudeMaxDegrees = 90; const double kLongitudeMaxDegrees = 180; CodeArea::CodeArea(double latitude_lo, double longitude_lo, double latitude_hi, double longitude_hi, size_t code_length) { latitude_lo_ ...
7f98951f-e0c4-47e2-bdc4-f509def0efb6
{ "language": "C++" }
```c++ // Copyright 2013 The Flutter 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 "impeller/archivist/archivist_fixture.h" #include "flutter/fml/paths.h" namespace impeller { namespace testing { ArchivistFixture::Archi...
```c++ // Copyright 2013 The Flutter 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 "impeller/archivist/archivist_fixture.h" #include "flutter/fml/paths.h" namespace impeller { namespace testing { ArchivistFixture::Archi...
7f2fdc3e-66f3-4f05-8202-c7e73992e272
{ "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/extensions/api/system_info_cpu/cpu_info_provider.h" namespace extensions { bool CpuInfoProvider::QueryCpuTimePerProc...
```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/extensions/api/system_info_cpu/cpu_info_provider.h" #include <mach/mach_host.h> #include "base/mac/scoped_mach_port....
bb9abf4d-7434-48a8-84db-2e6ccf63b6a6
{ "language": "C++" }
```c++ // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "skia/ext/opacity_filter_canvas.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkTLazy.h" ...
```c++ // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "skia/ext/opacity_filter_canvas.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkTLazy.h" ...
5beb2e36-972d-4f2c-91fb-b84b977a584c
{ "language": "C++" }
```c++ #include "SliderKnob.h" SliderKnob::SliderKnob(std::wstring bitmapName, int x, int y, int width, int height) : Meter(bitmapName, x, y, 1), _track(x, y, width, height) { _units = _track.Width - _rect.Width; } Gdiplus::Rect SliderKnob::Location() { return _rect; } void SliderKnob::Draw(Gdiplus::Bitm...
```c++ #include "SliderKnob.h" SliderKnob::SliderKnob(std::wstring bitmapName, int x, int y, int width, int height) : Meter(bitmapName, x, y, 1), _track(x, y, width, height) { _units = _track.Width - _rect.Width; } Gdiplus::Rect SliderKnob::Location() { return _rect; } void SliderKnob::Draw(Gdiplus::Bitm...
b74e23c7-6734-4bf5-89ce-81c59502e6d3
{ "language": "C++" }
```c++ /*============================================================================= MYPROJECT: A software package for whatever. Copyright (c) University College London (UCL). All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FIT...
```c++ /*============================================================================= MYPROJECT: A software package for whatever. Copyright (c) University College London (UCL). All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FIT...
9472343b-2c10-4703-8ed8-f944a33755b0
{ "language": "C++" }
```c++ #include "fade_effect.h" unsigned int FadeEffect::maxDelay() { return -1; } void FadeEffect::init() { // Handle a corner case in which the update just increments // a color and overflows the byte if( R() == 255 ) R(254); if( G() == 255 ) G(254); if( B() == 255 ) R(254); stage = 0; ...
```c++ #include "fade_effect.h" unsigned int FadeEffect::maxDelay() { return -1; } void FadeEffect::init() { // Handle a corner case in which the update just increments // a color and overflows the byte if( R() == 255 ) R(254); if( G() == 255 ) G(254); if( B() == 255 ) R(254); if( R() == 0...
9445a9e0-54ce-4b83-8635-d242501e06b8
{ "language": "C++" }
```c++ // Nikita Kouevda // 2013/11/01 #include <iostream> #include "prime.hpp" using namespace std; int main(int argc, char *argv[]) { if (argc < 2) { cerr << "Usage: prime number ..." << endl; return 1; } for (int i = 1; i < argc; ++i) { cout << argv[i] << " is"; if (!isPrime(atol(argv[i])...
```c++ // Nikita Kouevda // 2013/11/04 #include <iostream> #include "prime.hpp" using namespace std; int main(int argc, char *argv[]) { int i, n; char *endptr; if (argc < 2) { cerr << "usage: prime number ..." << endl; return 1; } for (i = 1; i < argc; ++i) { n = strtol(argv[i], &endptr, 10)...
2af09cd0-7f3f-47dc-83b8-7e17b86a9e0f
{ "language": "C++" }
```c++ #include "MediaServiceHandler.h" using namespace ::com::kurento::kms::api; namespace com { namespace kurento { namespace kms { MediaServerServiceHandler::MediaServerServiceHandler() { manager = MediaSessionManager::getInstance(); } MediaServerServiceHandler::~MediaServerServiceHandler() { MediaSessionMana...
```c++ #include "MediaServiceHandler.h" #include "log.h" using namespace ::com::kurento::kms::api; using ::com::kurento::log::Log; static Log l("MediaServiceHandler"); #define d(...) aux_debug(l, __VA_ARGS__); #define i(...) aux_info(l, __VA_ARGS__); namespace com { namespace kurento { namespace kms { MediaServer...
acae442d-fc1c-4d2a-a944-a9d97a01a439
{ "language": "C++" }
```c++ // Insure __block_holder_tmp is allocated on the stack. // RUN: %llvmgxx %s -S -O2 -o - | egrep {__block_holder_tmp.*alloca} // <rdar://problem/5865221> extern void fubar_dispatch_sync(void (^PP)(void)); void fubar() { __block void *voodoo; fubar_dispatch_sync(^(void){voodoo=0;}); } ``` Mark this test as Dar...
```c++ // Insure __block_holder_tmp is allocated on the stack. Darwin only. // RUN: %llvmgxx %s -S -O2 -o - | egrep {__block_holder_tmp.*alloca} // XFAIL: * // XTARGET: darwin // <rdar://problem/5865221> // END. extern void fubar_dispatch_sync(void (^PP)(void)); void fubar() { __block void *voodoo; fubar_dispatch_s...
8dd91e5a-c258-4d2b-a96e-d095914e95d7
{ "language": "C++" }
```c++ // StackTrace.cpp // Implements the functions to print current stack traces #include "Globals.h" #include "StackTrace.h" #ifdef _WIN32 #include "../StackWalker.h" #else #ifdef __GLIBC__ #include <execinfo.h> #endif #include <unistd.h> #endif // FreeBSD uses size_t for the return type of backtrace() #if...
```c++ // StackTrace.cpp // Implements the functions to print current stack traces #include "Globals.h" #include "StackTrace.h" #ifdef _WIN32 #include "../StackWalker.h" #else #ifdef __GLIBC__ #include <execinfo.h> #endif #include <unistd.h> #endif void PrintStackTrace(void) { #ifdef _WIN32 // Reuse th...
13439025-1b04-4848-a0b5-4207217eb17b
{ "language": "C++" }
```c++ // Includes. #include "UI/mainwindow.h" #include "App/App.h" #include "App/Factories/TextFileNFDelegate.h" #include "System/QtBasedFileSystem.h" // Qt. #include <QApplication> QString titleString() { QString name = QString::fromStdString(App::appName()); QString version = QString::fromStdString(App:...
```c++ // Includes. #include "UI/mainwindow.h" #include "App/App.h" #include "System/QtBasedFileSystem.h" // Qt. #include <QApplication> QString titleString() { QString name = QString::fromStdString(App::appName()); QString version = QString::fromStdString(App::appVersion()); return QString("%1 - v%2")....
70e1dde6-e51e-4f61-b353-dd489ca2cb10
{ "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/browser/renderer_host/render_view_host_observer.h" #include "content/browser/renderer_host/render_view_host.h" RenderViewHo...
```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/browser/renderer_host/render_view_host_observer.h" #include "content/browser/renderer_host/render_view_host.h" RenderViewHo...
ca7ebe60-2b87-4767-848b-ed85d9d6e3e2
{ "language": "C++" }
```c++ #include <constrained_ik/enum_types.h> #include <ros/console.h> using namespace constrained_ik::constraint_types; const std::string ConstraintType::names_[] = {"Primary", "Auxiliary", "Inactive"}; const std::map<std::string, ConstraintTypes> ConstraintType::name_to_enum_map_ = boost::assign::map_list_of ("Prim...
```c++ #include <constrained_ik/enum_types.h> #include <ros/console.h> using namespace constrained_ik::constraint_types; const std::string ConstraintType::names_[] = {"Primary", "Auxiliary", "Inactive"}; const std::map<std::string, ConstraintTypes> ConstraintType::name_to_enum_map_ = boost::assign::map_list_of ("prim...
b9882410-498f-49c6-bfb0-09b2e5fa2303
{ "language": "C++" }
```c++ #include <xpcc/architecture.hpp> #include "../stm32f4_discovery.hpp" // ---------------------------------------------------------------------------- MAIN_FUNCTION { defaultSystemClock::enable(); LedOrange::setOutput(xpcc::Gpio::High); LedGreen::setOutput(xpcc::Gpio::Low); LedRed::setOutput(xpcc::Gpio::High...
```c++ #include <xpcc/architecture.hpp> #include "../stm32f4_discovery.hpp" // ---------------------------------------------------------------------------- /** * Very basic example of USART usage. * The ASCII sequence 'A', 'B', 'C, ... , 'Z', 'A', 'B', 'C', ... * is printed with 9600 baud, 8N1 at pin PA3. */ MAI...
c10fb2f2-8d79-4e12-b746-139067d76d5c
{ "language": "C++" }
```c++ #include "hapticbutton.h" #include <QPainter> HapticButton::HapticButton(const QString &label) : QWidget(0), m_label(label), m_checked(false), m_checkable(false) { setMinimumSize(100, 100); } void HapticButton::mousePressEvent(QMouseEvent *) { if (m_checkable) { m_checked = !m_checked; ...
```c++ #include "hapticbutton.h" #include <QPainter> HapticButton::HapticButton(const QString &label) : QWidget(0), m_label(label), m_checked(false), m_checkable(false) { setMinimumSize(100, 100); } void HapticButton::mousePressEvent(QMouseEvent *) { if (m_checkable) { m_checked = !m_checked; ...
a203ae51-e3cf-4270-bf48-17cc6ea7f8b3
{ "language": "C++" }
```c++ #include <ccspec/core/formatter.h> namespace ccspec { namespace core { using std::exception_ptr; using std::list; using std::ostream; // public methods. void Formatter::examplePassed(const ExecutionResult& execution_result) const { (void) execution_result; } void Formatter::exampleFailed(const Execution...
```c++ #include <ccspec/core/formatter.h> namespace ccspec { namespace core { using std::exception_ptr; using std::list; using std::ostream; // public methods. void Formatter::examplePassed(const ExecutionResult&) const {} void Formatter::exampleFailed(const ExecutionResult&) const {} void Formatter::afterEachHoo...
fc99dcdc-e32f-44bd-9b42-8dfd1047531d
{ "language": "C++" }
```c++ #include <exception> #include <iostream> #include <cstdlib> #include "IMPL/LCIOExceptionHandler.h" namespace IMPL { // create one globale instance of the handler LCIOExceptionHandler* LCIOExceptionHandler::_me = 0 ; /** Method catches any std::exception, prints the message to stdout * and then exits t...
```c++ #include <exception> #include <iostream> #include <cstdlib> #include "IMPL/LCIOExceptionHandler.h" namespace IMPL { // create one globale instance of the handler LCIOExceptionHandler* LCIOExceptionHandler::_me = 0 ; /** Method catches any std::exception, prints the message to stdout * and then exits t...
a85eff27-2d20-49ae-87a8-b06b72e3d4ea
{ "language": "C++" }
```c++ #include "./compile.h" #include "tree_sitter/compiler.h" namespace node_tree_sitter_compiler { using namespace v8; NAN_METHOD(Compile) { String::Utf8Value grammar_json(info[0]); TSCompileResult compile_result = ts_compile_grammar(*grammar_json); if (compile_result.error_message) { Local<Value> erro...
```c++ #include "./compile.h" #include "tree_sitter/compiler.h" namespace node_tree_sitter_compiler { using namespace v8; NAN_METHOD(Compile) { String::Utf8Value grammar_json(info[0]); TSCompileResult compile_result = ts_compile_grammar(*grammar_json); if (compile_result.error_type != TSCompileErrorTypeNone) ...
6dd2e7e0-0929-41f3-832d-7fc0a6f61c33
{ "language": "C++" }
```c++ #include "platform/platform.h" #include "WProgram.h" void openxc::platform::initialize() { // this is required to initialize the Wiring library from MPIDE's toolchain // (inspired by Arduino) init(); } ``` Install ISR on PIC32 with updated build script.
```c++ #include "platform/platform.h" #include "WProgram.h" extern "C" { extern void __use_isr_install(void); __attribute__((section(".comment"))) void (*__use_force_isr_install)(void) = &__use_isr_install; } void openxc::platform::initialize() { // this is required to initialize the Wiring library from MPIDE's t...
663d31b1-5b77-4487-86e9-17e6048218cf
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -emit-llvm-only -triple %itanium_abi_triple -fdump-record-layouts %s 2>/dev/null \ // RUN: | FileCheck %s union A { int f1: 3; A(); }; A::A() {} union B { int f1: 69; B(); }; B::B() {} // CHECK:*** Dumping AST Record Layout // CHECK-NEXT: 0 | union A // CHECK-NEXT: ...
```c++ // RUN: %clang_cc1 -emit-llvm-only -triple %itanium_abi_triple -fdump-record-layouts %s 2>/dev/null \ // RUN: | FileCheck %s union A { int f1: 3; A(); }; A::A() {} union B { char f1: 35; B(); }; B::B() {} // CHECK:*** Dumping AST Record Layout // CHECK-NEXT: 0 | union A // CHECK-NEXT: ...
bfea5c74-a321-4df4-adc1-749f59e29c1e
{ "language": "C++" }
```c++ #include "utils.h" #include <nlohmann/json.hpp> using json = nlohmann::json; std::string get_with_def(const std::map<std::string, std::string> &m, const std::string &key, const std::string &defval) { auto it = m.find(key); if (it == m.end()) return defval; return it->second;...
```c++ #include "utils.h" #include <nlohmann/json.hpp> using json = nlohmann::json; std::string get_with_def(const std::map<std::string, std::string> &m, const std::string &key, const std::string &defval) { auto it = m.find(key); if (it == m.end()) return defval; return it->second;...
ddbeb2d8-8cf1-4995-85eb-407a2158995d
{ "language": "C++" }
```c++ #include "utils/LinearAlg2D.h" int main(int argc, char** argv) { // Pick a function that's not defined in the header. const float angle = cura::LinearAlg2D::getAngleLeft ( cura::Point(1.0, 1.0), cura::Point(1.0, 2.0), cura::Point(3.0, 3.0) ); return (angle != 0.f) ? 0 : 1; } ``` Debug which v...
```c++ #include "settings/Settings.h" // For the default definition of 'CURA_ENGINE_VERSION' if none is given. #include "utils/LinearAlg2D.h" // For testing calling a simple non-header function. #include <cstdio> int main(int argc, char** argv) { // Test which version do we have here? std::fprintf(stdout, "test-p...
f9928693-4897-4743-b63c-93012e4e579e
{ "language": "C++" }
```c++ #include <thread> #include <mutex> struct Complex { std::mutex mutex; int i; Complex() : i(0) {} void mul(int x){ std::lock_guard<std::mutex> lock(mutex); i *= x; } void div(int x){ std::lock_guard<std::mutex> lock(mutex); i /= x; } void both(...
```c++ //======================================================================= // Copyright (c) 2014 Baptiste Wicht // Distributed under the terms of the MIT License. // (See accompanying file LICENSE or copy at // http://opensource.org/licenses/MIT) //================================================================...
9929ef9e-3ed3-4370-9fab-fbb9750a7b69
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s int a<::> = { 1, 2, 3 }; int b = a<:::a<:0:>:>; bool c = a<:0:><::b; template<int &n> void f() {} template void f<::b>(); #define x a<:: ## : b :> int d = x; // expected-error {{pasting formed ':::', an invalid preprocessing token}} expected-error {{expec...
```c++ // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s int a<::> = { 1, 2, 3 }; int b = a<:::a<:0:>:>; bool c = a<:0:><::b; template<int &n> void f() {} template void f<::b>(); #define x a<:: ## : b :> int d = x; // expected-error {{pasting formed ':::', an invalid preprocessing token}} expected-error {{expec...
132a095c-2bfc-4359-af7c-0e937f07c8f5
{ "language": "C++" }
```c++ /* * InitWeightTestProbe.cpp * * Created on: Sep 6, 2011 * Author: kpeterson */ #include "InitWeightTestProbe.hpp" #include "../PetaVision/src/include/pv_arch.h" #include "../PetaVision/src/layers/HyPerLayer.hpp" #include <string.h> #include <assert.h> namespace PV { InitWeightTestProbe::InitWeight...
```c++ /* * InitWeightTestProbe.cpp * * Created on: Sep 6, 2011 * Author: kpeterson */ #include "InitWeightTestProbe.hpp" #include "../PetaVision/src/include/pv_arch.h" #include "../PetaVision/src/layers/HyPerLayer.hpp" #include <string.h> #include <assert.h> namespace PV { InitWeightTestProbe::InitWeight...
48f36758-39b8-4b67-ad1b-a58f31ee47c9
{ "language": "C++" }
```c++ #include "unit_tests/tests.hpp" #include "grune/non_terminal.hpp" using namespace grune; class sequence_tests : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(sequence_tests); CPPUNIT_TEST(test_to_string); CPPUNIT_TEST_SUITE_END(); public: void test_to_string() { non_terminal A(...
```c++ #include "unit_tests/tests.hpp" #include "grune/non_terminal.hpp" using namespace grune; BOOST_AUTO_TEST_SUITE(sequence_tests) void test_to_string() { non_terminal A("A"); non_terminal B("B"); symbol c("c"); sequence s { A, B, c }; std::string expected = "A, B, \"c\""; BOOST_CHECK_EQ...
5bc70b0a-2d35-498a-bbe4-e4d1b1cd5224
{ "language": "C++" }
```c++ #include "login/http-post-login.h" #include <QNetworkRequest> #include <QUrlQuery> #include "models/site.h" #include "network/network-manager.h" HttpPostLogin::HttpPostLogin(HttpAuth *auth, Site *site, NetworkManager *manager, MixedSettings *settings) : HttpLogin("post", auth, site, manager, settings) {} Net...
```c++ #include "login/http-post-login.h" #include <QNetworkRequest> #include <QUrlQuery> #include "models/site.h" #include "network/network-manager.h" HttpPostLogin::HttpPostLogin(HttpAuth *auth, Site *site, NetworkManager *manager, MixedSettings *settings) : HttpLogin("post", auth, site, manager, settings) {} Net...
69a4dd6c-abed-4ab9-be3e-436201d18566
{ "language": "C++" }
```c++ #include <ros/ros.h> #include <nav_msgs/OccupancyGrid.h> int main(int argc, char *argv[]){ ros::init(argc, argv, "local_map_2d_publisher"); ros::NodeHandle node; ros::Publisher map_lc_pub = node.advertise<nav_msgs::OccupancyGrid>("local_map", 1); const int size = 5; nav_msgs::OccupancyGrid...
```c++ #include <ros/ros.h> #include <nav_msgs/OccupancyGrid.h> int main(int argc, char *argv[]){ ros::init(argc, argv, "local_map_2d_publisher"); ros::NodeHandle node; ros::Publisher map_lc_pub = node.advertise<nav_msgs::OccupancyGrid>("local_map", 1); const int size = 5; nav_msgs::OccupancyGrid...
1f69d1ae-b15c-44a9-835d-571ef8b3df50
{ "language": "C++" }
```c++ #include "catch.hpp" #include "MedianOfTwoSortedArrays.hpp" TEST_CASE("Median Of Two Sorted Arrays") { Solution s; SECTION("Two nums are empty") { vector<int> nums1; vector<int> nums2; REQUIRE(s.findMedianSortedArrays(nums1, nums2) == 0.0); } SECTION("Two nums do not overlap") { vecto...
```c++ #include "catch.hpp" #include "MedianOfTwoSortedArrays.hpp" TEST_CASE("Median Of Two Sorted Arrays") { Solution s; SECTION("Two nums are empty") { vector<int> nums1; vector<int> nums2; REQUIRE(s.findMedianSortedArrays(nums1, nums2) == 0.0); } SECTION("Two nums do not overlap (even case)")...
efc51625-a8e4-4557-982a-b106832ad520
{ "language": "C++" }
```c++ #include "../src/engine.h" #include "drawdevice.h" #include <QtGui> int main(int argc, char *argv[]) { Engine *eng = new Engine; if (!eng->loadWorldFromFile("world.rooms")) { eng->getLogger()->write("ERROR: cannot load world.rooms!", Log::ERROR); delete eng; return 1; } ...
```c++ #include "../src/engine.h" #include "drawdevice.h" #include <QtGui> int main(int argc, char *argv[]) { Engine *eng = new Engine; if (!eng->loadWorldFromFile("world.rooms")) { eng->getLogger()->write("ERROR: cannot load world.rooms!", Log::ERROR); delete eng; return 1; } ...
68b0d5fe-f35e-4945-8734-96123b2795b4
{ "language": "C++" }
```c++ #include "theme-loader.h" #include <QDir> #include <QApplication> ThemeLoader::ThemeLoader(QString path) : m_path(path) {} QStringList ThemeLoader::getAllThemes() const { return QDir(m_path).entryList(QDir::Dirs | QDir::NoDotAndDotDot); } bool ThemeLoader::setTheme(QString name) { QFile f(m_path + "/" + ...
```c++ #include "theme-loader.h" #include <QDir> #include <QApplication> ThemeLoader::ThemeLoader(QString path) : m_path(path) {} QStringList ThemeLoader::getAllThemes() const { return QDir(m_path).entryList(QDir::Dirs | QDir::NoDotAndDotDot); } bool ThemeLoader::setTheme(QString name) { QString dir = QString(m...
d6831d83-f98f-422c-8e5f-c7b9f9315e28
{ "language": "C++" }
```c++ #include "EpsilonDashboard.h" #include <QApplication> #include <QLockFile> #include <QDebug> #include <QDir> int main(int argc, char* argv[]) { QString tmpDir = QDir::tempPath(); QLockFile lockFile(tmpDir + "/epsilonDashboard.lock"); /* Trying to close the Lock File, if the attempt is unsuccessful ...
```c++ #include "EpsilonDashboard.h" #include <QApplication> #include <QLockFile> #include <QDebug> #include <QDir> int main(int argc, char* argv[]) { #if QT_VERSION >= 0x050600 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif QString tmpDir = QDir::tempPath(); QLockFile lockFile(tmpDir...
445faf9e-fdbd-42de-82d1-a6f0caf1468a
{ "language": "C++" }
```c++ //===-- SparcTargetAsmInfo.cpp - Sparc asm properties -----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===-- SparcTargetAsmInfo.cpp - Sparc asm properties -----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
5127d942-34a0-46fb-87f6-0840f26be27e
{ "language": "C++" }
```c++ #include <emscripten/bind.h> #include "checksieve.h" using namespace emscripten; EMSCRIPTEN_BINDINGS(sieve) { value_object<yy::position>("position") .field("column", &yy::position::column) .field("line", &yy::position::line) ; value_object<yy::location>("location") .fi...
```c++ #include <emscripten/bind.h> #include "checksieve.h" using namespace emscripten; EMSCRIPTEN_BINDINGS(sieve) { value_object<yy::position>("position") .field("column", &yy::position::column) .field("line", &yy::position::line) ; value_object<yy::location>("location") .fi...
32cb0e65-af74-4256-9077-eb3381f4ba7f
{ "language": "C++" }
```c++ #include <qv4unwindhelper.h> #include <wtf/Platform.h> #if CPU(X86_64) && OS(LINUX) # define USE_DW2_HELPER #elif CPU(X86) && OS(LINUX) # define USE_DW2_HELPER #elif OS(WINDOWS) // SJLJ will unwind on Windows # define USE_NULL_HELPER #elif OS(IOS) // SJLJ will unwind on iOS # define USE_NULL_HELPER...
```c++ #include <qv4unwindhelper.h> #include <wtf/Platform.h> #if CPU(X86_64) && (OS(LINUX) || OS(MAC_OS_X)) # define USE_DW2_HELPER #elif CPU(X86) && OS(LINUX) # define USE_DW2_HELPER #elif OS(WINDOWS) // SJLJ will unwind on Windows # define USE_NULL_HELPER #elif OS(IOS) // SJLJ will unwind on iOS # defi...
a110e2c2-baf9-48ca-828b-9e912f963217
{ "language": "C++" }
```c++ #include <cstdlib> extern "C" void __cxa_pure_virtual() { } void* operator new(size_t size) { return malloc(size); } void* operator new[](size_t size) { return malloc(size); } void operator delete(void *ptr) { free(ptr); } void operator delete[](void *ptr) { free(ptr); } ``` Add a basic implementation...
```c++ #include <os/Board.h> #include <cstdio> #include <cstdlib> extern "C" void __cxa_pure_virtual() { printf("__cxa_pure_virtual() called. Probably a bad build.\n"); os::board::shutdown(); } void* operator new(size_t size) { return malloc(size); } void* operator new[](size_t size) { return malloc(size); } ...
b8b084c6-6c9c-42db-8201-da1f79b30ec3
{ "language": "C++" }
```c++ #include <GL/glew.h> #include "editor.h" #include <util.h> #include <QtWidgets/QApplication> int main(int argc, char *argv[]) { freopen(util::savePath("editor_log.txt").c_str(), "a", stderr); QApplication a(argc, argv); Editor w; w.show(); return a.exec(); } ``` Add started and ended timestamps
```c++ #include <GL/glew.h> #include "editor.h" #include <util.h> #include <QtWidgets/QApplication> int main(int argc, char *argv[]) { freopen(util::savePath("editor_log.txt").c_str(), "a", stderr); util::logWithTime("Editor started"); QApplication a(argc, argv); Editor w; w.show(); int result = a.exec(); util...
85805339-24f4-453d-b04a-248b5ef88936
{ "language": "C++" }
```c++ #include <iostream> #include <vector> #include <string> #include <cstdlib> int main(int argc, char* argv[]) { using namespace std; vector<string> cmdlineargs(argv+1, argv+argc); for(auto rbiterv=cmdlineargs.rbegin(); rbiterv != cmdlineargs.rend(); ++rbiterv) { auto& arg = *rbiterv; ...
```c++ #include <iostream> #include <vector> #include <string> #include <cstdlib> int main(int argc, char* argv[]) { using namespace std; vector<string> cmdlineargs {argv+1, argv+argc}; for(auto rbiterv=cmdlineargs.rbegin(); rbiterv != cmdlineargs.rend(); ++rbiterv) { auto& arg = *rbiterv; ...
9ce96b59-1182-4a58-bacc-907cb64300f4
{ "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 "data_fetcher_shared_memory.h" #include "base/logging.h" #include "data_fetcher_impl_android.h" namespace content { DataFetcherSharedMe...
```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 "data_fetcher_shared_memory.h" #include "base/logging.h" #include "data_fetcher_impl_android.h" namespace content { DataFetcherSharedMe...
528632fc-1255-444d-9f92-b7e90abe49bf
{ "language": "C++" }
```c++ #include <chrono> #include <thread> #include "AudioSubsystem.h" #include "AudioSubsystem_OpenAL.h" #include "Decoders/iWaveDataProvider.h" #include "Decoders/WAV/WAVDataProvider.h" #include "Utils.h" int main( int argc, char* argv[] ) { const char* FileName = ( argc > 1 ) ? argv[1] : "test.wav"; auto AudioS...
```c++ #include <chrono> #include <thread> #include "AudioSubsystem.h" #include "AudioSubsystem_OpenAL.h" #include "Decoders/iWaveDataProvider.h" #include "Decoders/WAV/WAVDataProvider.h" #include "Utils.h" int main( int argc, char* argv[] ) { const char* FileName = ( argc > 1 ) ? argv[1] : "test.wav"; auto AudioS...
45df38e8-e4db-4d51-916d-05d91f603b01
{ "language": "C++" }
```c++ #include "CurlHandle.h" #include <curl/curl.h> namespace embeddedmz { CurlHandle::CurlHandle() { curl_global_init(CURL_GLOBAL_ALL); } CurlHandle::~CurlHandle() { curl_global_cleanup(); } CurlHandle &CurlHandle::instance() { static CurlHandle inst{}; return inst; } } // namespace embeddedmz ``` Check e...
```c++ #include "CurlHandle.h" #include <curl/curl.h> #include <stdexcept> namespace embeddedmz { CurlHandle::CurlHandle() { const auto eCode = curl_global_init(CURL_GLOBAL_ALL); if (eCode != CURLE_OK) { throw std::runtime_error{"Error initializing libCURL"}; } } CurlHandle::~CurlHandle() { curl_global_cl...
023901ac-3e08-4bfd-bf79-fe87ea532e7c
{ "language": "C++" }
```c++ #include "qmljscodestylesettingsfactory.h" #include "qmljscodestylesettingspage.h" #include "qmljstoolsconstants.h" #include <texteditor/tabpreferences.h> #include <texteditor/tabsettings.h> #include <QtGui/QLayout> using namespace QmlJSTools; QmlJSCodeStylePreferencesFactory::QmlJSCodeStylePreferencesFactory(...
```c++ #include "qmljscodestylesettingsfactory.h" #include "qmljscodestylesettingspage.h" #include "qmljstoolsconstants.h" #include <texteditor/tabpreferences.h> #include <texteditor/tabsettings.h> #include <QtGui/QLayout> using namespace QmlJSTools; QmlJSCodeStylePreferencesFactory::QmlJSCodeStylePreferencesFactory(...
897a539c-786b-4f8c-82dd-3d8ea1ff5854
{ "language": "C++" }
```c++ #include "Wall.h" Wall::Wall(Vector b, Vector t) : b_(b), t_(t) { } bool Wall::OnLeft(Vector p) { return (p.i < b_.i); } bool Wall::Between(Vector p) { return (p.j < t_.j) && (p.j > b_.j); } float Wall::Left() { return b_.i - 0.1; } float Wall::Right() { return b_.i + 0.1; } void Wall::Draw() { gl...
```c++ #include "Wall.h" Wall::Wall(Vector b, Vector t) : b_(b), t_(t) { } bool Wall::OnLeft(Vector p) { return (p.i < b_.i); } bool Wall::Between(Vector p) { return (p.j < t_.j) && (p.j > b_.j); } float Wall::Left() { return b_.i - 0.1; } float Wall::Right() { return b_.i + 0.1; } void Wall::Draw() { gl...
d8c5c3ee-876c-48df-a275-cd5114149187
{ "language": "C++" }
```c++ #include "board.h" #include <aery32/all.h> using namespace aery; #define UART0_PINMASK ((1 << 0) | (1 << 1)) int main(void) { init_board(); gpio_init_pins(porta, UART0_PINMASK, GPIO_FUNCTION_A); gpio_set_pin_high(LED); /* * Initializes USART0 in async mode with 8 data bits, 1 stop bit * and no par...
```c++ #include "board.h" #include <aery32/all.h> using namespace aery; int main(void) { init_board(); /* * In UC3A: * PA00 => RXD * PA01 => TXD */ #define UART0_SERIAL_PINMASK (0x1) gpio_init_pins(porta, UART0_SERIAL_PINMASK, GPIO_FUNCTION_A); /* * Initializes USART0 in async mode with 8 data bit...
e7b811a7-b1a3-46bf-8c44-8f6df1c8db1e
{ "language": "C++" }
```c++ #include <QGuiApplication> #include <QQmlEngine> #include <QQmlContext> #include <QQmlComponent> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlEngine engine; QQmlContext *objectContext = new QQmlContext(engine.rootContext()); QQmlComponent component(&engine, "main.qml"); QO...
```c++ #include <QGuiApplication> #include <QQuickView> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQuickView view; view.setSource(QUrl::fromLocalFile("main.qml")); view.show(); return app.exec(); } ```
2a31e6f2-08b7-45fb-b276-9cebe76d574e
{ "language": "C++" }
```c++ #include <catch.hpp> #include "../wold.hpp" namespace wold { TEST_CASE("foo", "[]") { REQUIRE(foo() == 42); } } // namespace wold ``` Add basic x3 parsing demo test
```c++ #include <catch.hpp> #include "../wold.hpp" #include <boost/spirit/home/x3.hpp> #include <iostream> namespace wold { TEST_CASE("foo", "[]") { REQUIRE(foo() == 42); } TEST_CASE("parsing", "[]") { using boost::spirit::x3::double_; using boost::spirit::x3::ascii::space; auto text = std::s...
6980fc17-5d38-41cd-be5e-54f1b55df592
{ "language": "C++" }
```c++ #include <iostream> using namespace std; int main() { cout << "Hello, world!" << endl; } ``` Add code to print cpu load information and bytes sent/received
```c++ #include <iostream> #include <chrono> #include <thread> #include <string> #include <fstream> #include <sstream> const std::string NETWORK_IF = "eth0"; using namespace std; int main() { while (true) { // Get current point in time as reference const auto now = std::chrono::steady_clock::now(); co...
bfc576a5-e12f-4fe2-9d70-72c72527c649
{ "language": "C++" }
```c++ #include "graphics/texture.h" #include "graphics/opengl.h" namespace sp { void BasicTexture::setRepeated(bool) { } void BasicTexture::setSmooth(bool value) { smooth = value; } void BasicTexture::loadFromImage(Image&& image) { this->image = std::move(image); } void BasicTexture::bind() { if (ha...
```c++ #include "graphics/texture.h" #include "graphics/opengl.h" namespace sp { void BasicTexture::setRepeated(bool) { } void BasicTexture::setSmooth(bool value) { smooth = value; } void BasicTexture::loadFromImage(Image&& image) { this->image = std::move(image); } void BasicTexture::bind() { if (ha...
ba2fad30-092d-4dbb-b043-568201eaed29
{ "language": "C++" }
```c++ /* * AvanceDB - an in-memory database similar to Apache CouchDB * Copyright (C) 2015-2017 Ripcord Software * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either versi...
```c++ /* * AvanceDB - an in-memory database similar to Apache CouchDB * Copyright (C) 2015-2017 Ripcord Software * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either versi...
0da4dfcc-ef4f-4e92-8090-a85e20bb70d0
{ "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. // //===---------------------------------...
091e00fd-4298-45a2-b2e3-a98bbea151b0
{ "language": "C++" }
```c++ #include <iostream> int main() { std::cout << "hello world" << std::endl; return 0; } ``` Move direction reader from console.
```c++ #include <iostream> //#include <stdio.h> enum MoveDirection { LEFT, UP, RIGHT, DOWN }; class ConsoleMoveDirectionReader { public: MoveDirection next() { while (true) { int keyCode = std::cin.get(); if (keyCode == 97) { return MoveDirection::LEFT; ...