doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
f20ba023-75d1-4aee-95a6-28125e109230
{ "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 "net/base/mock_host_resolver.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Jav...
```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 "net/base/mock_host_resolver.h" // Disabled, http://crbug.com/63589. IN_PROC...
68724bb9-ec40-424d-b243-09a25fc1d1a6
{ "language": "C++" }
```c++ #inlcude <iostream> using namespace std; int main(){ return 0; } ``` Print $ in for loop
```c++ #include <iostream> #include <string> using namespace std; int main(int argc,char **argv){ string command; cout << argv[1]; //While loop that repeats $ and cin command while(command != "exit"){ cout << "$"; cin >> command; } return 0; } ```
9b33986b-001f-4293-af0a-1ee9a5a322fe
{ "language": "C++" }
```c++ // This file is only compiled if the cmake option BP_USE_ADDITIONAL_SOURCEFILE is set to ON #ifndef HAS_ADDITIONAL_SOURCEFILE #error If this file is compiled, the target must have HAS_ADDITIONAL_SOURCEFILE defined #endif``` Fix no newline at end of file
```c++ // This file is only compiled if the cmake option BP_USE_ADDITIONAL_SOURCEFILE is set to ON #ifndef HAS_ADDITIONAL_SOURCEFILE #error If this file is compiled, the target must have HAS_ADDITIONAL_SOURCEFILE defined #endif ```
b4314783-e258-48b3-8135-253468355378
{ "language": "C++" }
```c++ #include "testingplayer.h" #ifdef XINE_PLAYER #include "xineplayer.h" #endif #include "qtsingleapplication.h" #include <QDebug> #include <QtDBus> int main(int argc, char** argv) { QtSingleApplication app(argc, argv); app.setApplicationName("mediahelper"); app.setOrganizationName("Nokia"); app.s...
```c++ #include "testingplayer.h" #ifdef XINE_PLAYER #include "xineplayer.h" #endif #include "qtsingleapplication.h" #include <QDebug> #include <QtDBus> int main(int argc, char** argv) { QtSingleApplication app(argc, argv); app.setApplicationName("mediahelper"); app.setOrganizationName("Nokia"); app.s...
9c108f36-bb85-43b9-b083-838664d60efc
{ "language": "C++" }
```c++ //======================================================================= // Copyright (c) 2013-2014 Baptiste Wicht. // Distributed under the terms of the MIT License. // (See accompanying file LICENSE or copy at // http://opensource.org/licenses/MIT) //==========================================================...
```c++ //======================================================================= // Copyright (c) 2013-2014 Baptiste Wicht. // Distributed under the terms of the MIT License. // (See accompanying file LICENSE or copy at // http://opensource.org/licenses/MIT) //==========================================================...
0de5f7bf-1e77-4525-a8e2-6e444f00d580
{ "language": "C++" }
```c++ #include "Context.h" #include <GL/glew.h> #include "Utilities.h" namespace ion { namespace GL { void Context::Init() { CheckedGLCall(glEnable(GL_DEPTH_TEST)); } void Context::Clear(std::initializer_list<EBuffer> Buffers) { static u32 const BufferLookup[3] = { GL_...
```c++ #include "Context.h" #include <GL/glew.h> #include "Utilities.h" namespace ion { namespace GL { void Context::Init() { CheckedGLCall(glEnable(GL_DEPTH_TEST)); CheckedGLCall(glDepthFunc(GL_LEQUAL)); } void Context::Clear(std::initializer_list<EBuffer> Buffers) { static...
0a5f47ce-3454-4492-a326-0f6ef20666a2
{ "language": "C++" }
```c++ #include "_TDDConfigure.h" // BTK error messages are not displayed #define TDD_SILENT_CERR int main() { #if defined(TDD_SILENT_CERR) std::streambuf* standardErrorOutput = std::cerr.rdbuf(0); #endif int err = CxxTest::ErrorPrinter().run(); #if defined(TDD_SILENT_CERR) std::cerr.rdbuf(standardErrorOutp...
```c++ #include "_TDDConfigure.h" #include <btkLogger.h> // BTK error messages are not displayed #define TDD_SILENT_CERR int main() { #if defined(TDD_SILENT_CERR) btk::Logger::SetVerboseMode(btk::Logger::Quiet); #endif return CxxTest::ErrorPrinter().run();; }; #include <cxxtest/Root.cpp> ```
5811c389-b345-404a-b165-695e8a0b7d49
{ "language": "C++" }
```c++ template<typename First, typename Second> class Pair { private: First first; Second second; public: template<typename Third> class Inner { Third third; }; }; int main(int argc, char *argv[]) { Pair<int,double> pp1; Pair<int,int> pp2; Pair<int,double>::Inner<char> p; ...
```c++ template<typename First, typename Second> class Pair { private: First first; Second second; public: virtual ~Pair() {} template<typename Third> class Inner { Third third; }; }; int main(int argc, char *argv[]) { Pair<int,double> pp1; Pair<int,int> pp2; Pair<int...
c90714c9-3f77-4cff-9b1b-91d0b7a2a45b
{ "language": "C++" }
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Bookmarks) { // TODO(erikkay) no initial s...
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" // TODO(brettw) bug 19866: this test is disabled because it is flaky. IN_PROC_BROWSER...
c8e75bf8-471e-4677-b561-30e0023afbe0
{ "language": "C++" }
```c++ #include "GLPlatform.hpp" #include <stdexcept> namespace CPM_GL_PLATFORM_NS { void glPlatformInit() { #ifdef GL_PLATFORM_USING_WIN GLenum err = glewInit(); if (GLEW_OK != err) { throw std::runtime_error("GLEW failed to initialize."); } #endif } } // namespace CPM_GL_PLATFORM_NS ``` Add correct ...
```c++ #include "GLPlatform.hpp" #include <stdexcept> namespace CPM_GL_PLATFORM_NS { void glPlatformInit() { #ifdef WIN32 GLenum err = glewInit(); if (GLEW_OK != err) { throw std::runtime_error("GLEW failed to initialize."); } #endif } } // namespace CPM_GL_PLATFORM_NS ```
989472fd-ab18-43ec-9d76-c42d22f9b580
{ "language": "C++" }
```c++ #include <iostream> #include <string> #include "../lcd/MiniLcdPCD8544.h" using namespace std; /** * Test the WiringPiLcdDisplay implementation */ int main() { unique_ptr<MiniLcdPCD8544> lcd(MiniLcdPCD8544::getLcdDisplayInstance()); lcd->init(); lcd->displayText("Text to display:", 0, 0); cout...
```c++ #include <iostream> #include <string> #include "../lcd/MiniLcdPCD8544.h" using namespace std; /** * Test the WiringPiLcdDisplay implementation */ int main() { unique_ptr<MiniLcdPCD8544> lcd(MiniLcdPCD8544::getLcdDisplayInstance()); lcd->init(); lcd->displayText("Text to display:", 0, 0); cout...
10764ba7-2efc-4335-916d-4ae17492a348
{ "language": "C++" }
```c++ /* * RandomConn.cpp * * Created on: Apr 27, 2009 * Author: rasmussn */ #include "RandomConn.hpp" #include <assert.h> #include <string.h> namespace PV { RandomConn::RandomConn(const char * name, HyPerCol * hc, HyPerLayer * pre, HyPerLayer * post, int channel) { this->connId = hc->numberOfCo...
```c++ /* * RandomConn.cpp * * Created on: Apr 27, 2009 * Author: rasmussn */ #include "RandomConn.hpp" #include <assert.h> #include <string.h> namespace PV { RandomConn::RandomConn(const char * name, HyPerCol * hc, HyPerLayer * pre, HyPerLayer * post, int channel) { this->connId = hc->numberOfCo...
ade26188-4308-4f6a-815b-16f7ac73a75e
{ "language": "C++" }
```c++ #include "display.h" #include "sensor.h" #include <LiquidCrystal.h> // Arduino LCD library #include <Arduino.h> // enables use of byte pics // pin definition for LCD #define LCD_CS 10 #define LCD_DC 9 #define LCD_RST 8 namespace LCD { TFT TFTscreen = TFT(LCD_CS, LCD_DC, LCD_RST); void setup() { ...
```c++ #include "display.h" #include "sensor.h" #include <LiquidCrystal.h> // Arduino LCD library #include <Arduino.h> // enables use of byte pics #define DISPLAY_RS 14 #define DISPLAY_E 15 #define DISPLAY_D4 5 #define DISPLAY_D5 4 #define DISPLAY_D6 3 #define DISPLAY_D7 2 namespace LCD { TFT TFTscreen = TFT(LCD...
8efcd25a-684c-40b2-95fc-48416180312e
{ "language": "C++" }
```c++ #include <gtest/gtest.h> #include <system.h> #include "mock_memorymodule.h" class SystemTest : public testing::Test { protected: System sys; StrictMockMemoryModule mem; }; //Dumy test TEST_F(SystemTest, TestMemoryAddressTranslation) { unsigned char dummy_buffer[10]; sys.installMemory(mem, 10, 1...
```c++ #include <gtest/gtest.h> #include <errors.h> #include <system.h> #include "mock_memorymodule.h" class SystemTest : public testing::Test { protected: System sys; StrictMockMemoryModule mem; }; //Dumy test TEST_F(SystemTest, TestMemoryAddressTranslation) { unsigned char dummy_buffer[10]; int iret...
b02b31e6-26ad-46ae-9f8f-89534da1db0b
{ "language": "C++" }
```c++ #define BOOST_TEST_MODULE Bitcoin Test Suite #include <boost/test/unit_test.hpp> #include "db.h" #include "txdb.h" #include "main.h" #include "wallet.h" CWallet* pwalletMain; CClientUIInterface uiInterface; extern bool fPrintToConsole; extern void noui_connect(); struct TestingSetup { CCoinsViewDB *pcoin...
```c++ #define BOOST_TEST_MODULE Bitcoin Test Suite #include <boost/test/unit_test.hpp> #include "db.h" #include "txdb.h" #include "main.h" #include "wallet.h" CWallet* pwalletMain; CClientUIInterface uiInterface; extern bool fPrintToConsole; extern void noui_connect(); struct TestingSetup { CCoinsViewDB *pcoin...
4245384b-1339-4ccf-bb78-031061c8143b
{ "language": "C++" }
```c++ // observable-ip-address.cpp : Defines the entry point for the console application. // #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { return 0; } ``` Add code that hangs until the IP address changes
```c++ // observable-ip-address.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <winsock2.h> #include <iphlpapi.h> #include <stdio.h> #include <windows.h> #pragma comment(lib, "iphlpapi.lib") #pragma comment(lib, "ws2_32.lib") int _tmain(int argc, _TCHAR* argv[]) { OVERLAP...
545af301-fd29-4f42-8fb8-476f469f3453
{ "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 "remoting/protocol/key_event_tracker.h" #include "base/logging.h" #include "remoting/proto/event.pb.h" namespace remoting { namespac...
```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 "remoting/protocol/key_event_tracker.h" #include "base/logging.h" #include "remoting/proto/event.pb.h" namespace remoting { namespac...
b1050bb2-e41f-40f2-904c-d8cd34c2c31a
{ "language": "C++" }
```c++ #include "advanced_assert.h" std::function<void (const char*)> AdvancedAssert::_loggingFunc; void AdvancedAssert::setLoggingFunc(const std::function<void (const char*)>& func) { _loggingFunc = func; } ``` Debug / release macros check added (required for normal assert functioning on non-Windows system...
```c++ #include "advanced_assert.h" #if defined _DEBUG == (defined NDEBUG || NDEBUG == 1) #error "Either _DEBUG or NDEBUG=1 must be defined" #endif std::function<void (const char*)> AdvancedAssert::_loggingFunc; void AdvancedAssert::setLoggingFunc(const std::function<void (const char*)>& func) { _loggingF...
87cff0ef-dc70-4af0-a72f-bded9cfb1d87
{ "language": "C++" }
```c++ #include <iostream> #include "../src/tisys.hpp" int main(int argc, char** argv){ cout << "Example" <<endl; Filesystem fs; if ( argc == 1 ) fs.info("."); else fs.info( argv[1] ); cout << fs; return 0; } ``` Put the using namespace std in the cpp files
```c++ #include <iostream> #include "../src/tisys.hpp" using namespace std; int main(int argc, char** argv){ cout << "Example" <<endl; Filesystem fs; if ( argc == 1 ) fs.info("."); else fs.info( argv[1] ); cout << fs; return 0; } ```
273b3516-f253-49a5-b3bb-2d24d1dfa3c9
{ "language": "C++" }
```c++ #include <cstdlib> #include <stdio.h> #include <string.h> #include <set> #include <string> #include <assert.h> using namespace std; set<string> done; void dump_header(string header) { if (done.find(header) != done.end()) return; done.insert(header); FILE *f = fopen(header.c_str(), "r"); if (...
```c++ #include <cstdlib> #include <stdio.h> #include <string.h> #include <set> #include <string> #include <assert.h> std::set<std::string> done; void dump_header(std::string header) { if (done.find(header) != done.end()) return; done.insert(header); FILE *f = fopen(header.c_str(), "r"); if (f == NU...
59e63f3d-62e0-4ac2-9da0-29e1e5e6f92a
{ "language": "C++" }
```c++ #include <ctx.hpp> #include <cl.hpp> #include <vector> namespace opencl { using std::vector; using cl::Platform; using cl::Device; void ctxCB(const char *errinfo, const void *private_info, size_t cb, void *user_data) { printf("Context Error: %s\n", errinfo); fflush(stdout); } const cl::Context& getCtx(un...
```c++ #include <ctx.hpp> #include <cl.hpp> #include <vector> namespace opencl { using std::vector; using cl::Platform; using cl::Device; void ctxCB(const char *errinfo, const void *private_info, size_t cb, void *user_data) { printf("Context Error: %s\n", errinfo); fflush(stdout); } const cl::Context& getCtx(un...
f2c7080a-4ff8-4192-b723-e362be07732b
{ "language": "C++" }
```c++ #include "SkTypeface.h" // ===== Begin Chrome-specific definitions ===== uint32_t SkTypeface::UniqueID(const SkTypeface* face) { return NULL; } void SkTypeface::serialize(SkWStream* stream) const { } SkTypeface* SkTypeface::Deserialize(SkStream* stream) { return NULL; } // ===== End Chrome-specific de...
```c++ #include "SkTypeface.h" // ===== Begin Chrome-specific definitions ===== uint32_t SkTypeface::UniqueID(const SkTypeface* face) { return 0; } void SkTypeface::serialize(SkWStream* stream) const { } SkTypeface* SkTypeface::Deserialize(SkStream* stream) { return NULL; } // ===== End Chrome-specific defin...
9d488b1a-9ed9-4a4a-bb2e-2019f2ca3627
{ "language": "C++" }
```c++ #include "gtest/gtest.h" #include "../include/rainy.h" using namespace rainy; TEST(SphereTest, InstanceTest) { Sphere sp(1.0, Vector3(0.0, 0.0, 0.0), Color(), Color(0.75, 0.75, 0.75), REFLECTION_DIFFUSE); EXPECT_EQ(0.0, sp.center().x()); EXPECT_EQ(0.0, sp.center().y()); EXPECT_EQ(0.0, sp.cente...
```c++ #include "gtest/gtest.h" #include "../include/rainy.h" using namespace rainy; TEST(SphereTest, InstanceTest) { Sphere sp(2.0, Vector3(0.0, 0.0, 0.0), Color(), Color(0.75, 0.75, 0.75), REFLECTION_DIFFUSE); EXPECT_EQ(0.0, sp.center().x()); EXPECT_EQ(0.0, sp.center().y()); EXPECT_EQ(0.0, sp.cente...
52baa770-7bfd-4a55-a7b2-94812812898b
{ "language": "C++" }
```c++ // Copyright (c) 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 "ipc/mojo/ipc_mojo_handle_attachment.h" #include "ipc/ipc_message_attachment_set.h" #include "third_party/mojo/src/mojo/edk/embedder/...
```c++ // Copyright (c) 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 "ipc/mojo/ipc_mojo_handle_attachment.h" #include "ipc/ipc_message_attachment_set.h" #include "third_party/mojo/src/mojo/edk/embedder/...
768b0380-0640-4a73-bb14-1dbc4a162cf2
{ "language": "C++" }
```c++ #include "xchainer/python/error.h" #include "xchainer/error.h" #include "xchainer/python/common.h" namespace xchainer { namespace py = pybind11; // standard convention void InitXchainerError(pybind11::module& m) { py::register_exception<XchainerError>(m, "XchainerError"); py::register_exception<Bac...
```c++ #include "xchainer/python/error.h" #include "xchainer/error.h" #include "xchainer/python/common.h" namespace xchainer { namespace py = pybind11; // standard convention void InitXchainerError(pybind11::module& m) { py::register_exception<XchainerError>(m, "XchainerError"); py::register_exception<Con...
342bb0f3-fe7d-4e53-81c4-143a3f8e552f
{ "language": "C++" }
```c++ // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "sky/tools/sky_snapshot/vm.h" #include "base/logging.h" #include "sky/tools/sky_snapshot/loader.h" #include "sky/tools/sky_snapshot/loggi...
```c++ // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "sky/tools/sky_snapshot/vm.h" #include "base/logging.h" #include "sky/tools/sky_snapshot/loader.h" #include "sky/tools/sky_snapshot/loggi...
1c7171fb-3dc8-4dc5-8c7a-96b62a95dd04
{ "language": "C++" }
```c++ #include <kernel/kernconf.hh> USDK_API kernconf_type kernconf = { // Default is large enough until we enable a mechanism to dynamically // reallocate task space on demand. /* .default_stack_size = */ 128 * 1024, /* .minimum_stack_size = */ 4 * 1024 }; ``` Use the stack size provided by ...
```c++ #include <kernel/config.h> #include <kernel/kernconf.hh> USDK_API kernconf_type kernconf = { // Default is large enough until we enable a mechanism to dynamically // reallocate task space on demand. /* .default_stack_size = */ URBI_KERNEL_STACK_SIZE * 1024, /* .minimum_stack_size = */ 4 ...
0d34173c-a946-4eff-81aa-d063ae77a8bf
{ "language": "C++" }
```c++ // cfiles, an analysis frontend for the Chemfiles library // Copyright (C) Guillaume Fraux and contributors -- BSD license #include <iostream> #include <set> #include "warnings.hpp" void warn(std::string message) { std::cerr << "[cfiles] " << message << std::endl; } void warn_once(std::string message) { ...
```c++ // cfiles, an analysis frontend for the Chemfiles library // Copyright (C) Guillaume Fraux and contributors -- BSD license #include <iostream> #include <set> #include "warnings.hpp" void warn(std::string message) { std::cerr << "[cfiles] " << message << std::endl; } void warn_once(std::string message) { ...
6a832070-befa-4ca7-9370-afab42e07e58
{ "language": "C++" }
```c++ #include "planning/simulation/interactable_geometry.hh" namespace jcc { namespace simulation { std::vector<RayIntersection> InteractableGeometry::all_intersections( const geometry::Ray& ray) { std::vector<RayIntersection> intersections; for (const auto& bbox : aabb_) { const auto intersection = bbo...
```c++ #include "planning/simulation/interactable_geometry.hh" #include <algorithm> namespace jcc { namespace simulation { std::vector<RayIntersection> InteractableGeometry::all_intersections( const geometry::Ray& ray) { std::vector<RayIntersection> intersections; for (const auto& bbox : aabb_) { const a...
e83d8564-fc52-403f-acce-532f013dafb6
{ "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. // //===---------------------------------...
662c8886-0cc6-4852-98a2-a5f79a9cb5e3
{ "language": "C++" }
```c++ /* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * ...
```c++ /* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * ...
3750f23a-4824-4e96-8a9c-97f4e5fe5baf
{ "language": "C++" }
```c++ // Copyright (c) 2022 Ultimaker B.V. // CuraEngine is released under the terms of the AGPLv3 or higher. #include "utils/IntPoint.h" #include <gtest/gtest.h> // NOLINTBEGIN(*-magic-numbers) namespace cura { TEST(IntPointTest, TestRotationMatrix) { PointMatrix rot2d(90); Point3Matrix rot_homogeneous(rot2...
```c++ // Copyright (c) 2022 Ultimaker B.V. // CuraEngine is released under the terms of the AGPLv3 or higher. #include "utils/IntPoint.h" #include <gtest/gtest.h> // NOLINTBEGIN(*-magic-numbers) namespace cura { TEST(IntPointTest, TestRotationMatrix) { PointMatrix rot2d(90); Point3Matrix rot_homogeneous(rot2...
c3c23160-41fd-4e7c-bff8-75be88904e45
{ "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/...
8985f718-4b0b-470a-9c98-a36328e3fa18
{ "language": "C++" }
```c++ #include "logger.h" namespace lightstep { //------------------------------------------------------------------------------ // LogDefault //------------------------------------------------------------------------------ static void LogDefault(LogLevel log_level, opentracing::string_view mes...
```c++ #include "logger.h" namespace lightstep { //------------------------------------------------------------------------------ // LogDefault //------------------------------------------------------------------------------ static void LogDefault(LogLevel log_level, opentracing::string_view mes...
b624afb3-6353-4bdb-b93c-23bff10db6ba
{ "language": "C++" }
```c++ // RUN: %clangxx_msan -O0 %s -c -o %t // RUN: %clangxx_msan -O3 %s -c -o %t // Regression test for MemorySanitizer instrumentation of a select instruction // with vector arguments. #if defined(__x86_64__) #include <emmintrin.h> __m128d select(bool b, __m128d c, __m128d d) { return b ? c : d; } #elif defined...
```c++ // RUN: %clangxx_msan -O0 %s -c -o %t // RUN: %clangxx_msan -O3 %s -c -o %t // Regression test for MemorySanitizer instrumentation of a select instruction // with vector arguments. #if defined(__x86_64__) #include <emmintrin.h> __m128d select(bool b, __m128d c, __m128d d) { return b ? c : d; } #elif defined...
cec2cd9c-a708-4474-90aa-e57c1e00fb24
{ "language": "C++" }
```c++ #include "entity.h" using namespace sf; Entity::Entity(EntityShape shape0, Engine *engine0) { shape = shape0; position.x = 0; position.y = 0; isKilledFlag = false; engine = engine0; UID = ++globalUID; } Entity::~Entity() { engine = NULL; } Uint32 Entity::globalUID = 0; Uint32 Entity::getUID(void) const ...
```c++ #include "entity.h" using namespace sf; Entity::Entity(EntityShape shape0, Engine *engine0) { shape = shape0; position.x = 0; position.y = 0; isKilledFlag = false; engine = engine0; if (globalUID & 0x80000000) { globalUID = (globalUID+1) | 0x80000000; } else { globalUID = (globalUID+1) & (~0x80000000...
7ccc2a29-2788-4631-ac1a-d2d9309ab05f
{ "language": "C++" }
```c++ // a wrapper to load netgen-dll into python #include <iostream> #ifdef NG_PYTHON #include <boost/python.hpp> #endif #ifdef WIN32 #define DLL_HEADER __declspec(dllimport) #else #define DLL_HEADER #endif void DLL_HEADER ExportNetgenMeshing(); void DLL_HEADER ExportMeshVis(); void DLL_HEADER E...
```c++ // a wrapper to load netgen-dll into python #include <iostream> #include <boost/python.hpp> #ifdef WIN32 #define DLL_HEADER __declspec(dllimport) #else #define DLL_HEADER #endif void DLL_HEADER ExportNetgenMeshing(); void DLL_HEADER ExportMeshVis(); void DLL_HEADER ExportCSG(); void DLL_HEADER...
89187119-aab6-424d-abce-1ddb39293bf7
{ "language": "C++" }
```c++ #include <QtWidgets/QApplication> #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } ``` Remove trailing whitespace from example source code
```c++ #include <QtWidgets/QApplication> #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } ```
f738bac0-74d2-462b-b9fb-723e90b886bb
{ "language": "C++" }
```c++ #include "engineBootstrap.hpp" #include <catch/catch.hpp> TEST_CASE("Test glTF Loading") { auto GameEngine = Annwvyn::bootstrapTestEngine("GlTF Test"); auto object = Annwvyn::AnnGetGameObjectManager()->createGameObject("Avocado.glb"); object->setPosition(0, 1.6, 9); REQUIRE(object != nullptr); GameEngin...
```c++ #include "engineBootstrap.hpp" #include <catch/catch.hpp> namespace Annwvyn { TEST_CASE("Test glTF Loading") { auto GameEngine = Annwvyn::bootstrapTestEngine("GlTF Test"); auto object = Annwvyn::AnnGetGameObjectManager()->createGameObject("Avocado.glb"); object->setPosition(0, 1.6, 9); object->setScale(3, ...
645ab29f-cb8a-4d47-8a37-c736e532ef6e
{ "language": "C++" }
```c++ /* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "LegacyViewManagerInteropViewProps.h" namespace facebook { namespace react { LegacyViewManagerInteropViewProps::L...
```c++ /* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "LegacyViewManagerInteropViewProps.h" namespace facebook { namespace react { static folly::dynamic recursiveMerge...
071981a4-3075-42e9-b2a7-923718dd87b0
{ "language": "C++" }
```c++ // Copyright 2012, Google 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 agree...
```c++ // Copyright 2012, Google 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 agree...
7ee6a700-9f0c-4eab-bb76-30a5056bafda
{ "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. // //===---------------------------------...
51e6dec1-7934-4e41-b1ef-370bd8fbf181
{ "language": "C++" }
```c++ #include "main.hpp" int main() { DEV::KeepConsoleOpen keepConsoleOpen; keepConsoleOpen.setKeyRequirement(DEV::KeepConsoleOpen::Escape); try { Game game; game.run(); } catch (int e) { DEV::printLine("Exception caught:\n\"" + pl::stringFrom(e) + "\""); return EXIT_FAILURE; } catch (char* e) { ...
```c++ #include "main.hpp" int main() { DEV::KeepConsoleOpen keepConsoleOpen; keepConsoleOpen.setKeyRequirement(DEV::KeepConsoleOpen::Escape); try { Game game; game.run(); } catch (int e) { DEV::printLine("Exception caught: " + pl::stringFrom(e)); return EXIT_FAILURE; } catch (char* e) { DEV::prin...
7f32c54b-6c02-46aa-8800-8109ac40d97a
{ "language": "C++" }
```c++ #include "misc_util.h" namespace dlib { void string_fmt_time(std::string& ret) { time_t now = time(NULL); struct tm *t = localtime(&now); while(!strftime((char *)ret.data(), ret.capacity(), "%Y:%m:%d %H:%M", t)) ret.reserve(ret.size() << 1); } } ``` Fix mistake of ...
```c++ #include "misc_util.h" namespace dlib { void string_fmt_time(std::string& ret) { time_t now = time(NULL); struct tm *t = localtime(&now); while(!strftime((char *)ret.data(), ret.capacity(), "%Y:%m:%d %H:%M", t)) ret.reserve(ret.capacity() ? ret.capacity() << 1: 16); ...
86c1f628-fffa-438d-b0ac-3f29768e8471
{ "language": "C++" }
```c++ /* -*- mode:linux -*- */ /** * \file timeout.cc * * * * \author Ethan Burns * \date 2008-12-16 */ #include <iostream> #include <signal.h> #include <stdlib.h> #include <unistd.h> using namespace std; void alarm_action(int sig) { cout << "No Solution" << endl << "cost: infinity" << endl << ...
```c++ /* -*- mode:linux -*- */ /** * \file timeout.cc * * * * \author Ethan Burns * \date 2008-12-16 */ #include <iostream> #include <signal.h> #include <stdlib.h> #include <unistd.h> using namespace std; void alarm_action(int sig) { cout << "No Solution" << endl << "cost: infinity" << endl << ...
9aa1e039-b3e1-459a-967f-dde203554357
{ "language": "C++" }
```c++ #include <QPushButton> #include <QHBoxLayout> #include <QApplication> int main(int argc, char *argv[]) { QApplication a{argc, argv}; QWidget w; QHBoxLayout layout{&w}; QPushButton button1{"Default"}; button1.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); layout.addWidget(&button1...
```c++ // https://github.com/KubaO/stackoverflown/tree/master/questions/styledbutton-20642553 #include <QPushButton> #include <QHBoxLayout> #include <QApplication> int main(int argc, char *argv[]) { QApplication a{argc, argv}; QWidget w; QHBoxLayout layout{&w}; QPushButton button1{"Default"}; button1.se...
d5bfe581-40aa-48a6-bd50-25d01a3dbd57
{ "language": "C++" }
```c++ #include "Arduboy.h" #include "audio.h" bool ArduboyAudio::audio_enabled = false; void ArduboyAudio::on() { audio_enabled = true; } bool ArduboyAudio::enabled() { return audio_enabled; } void ArduboyAudio::off() { audio_enabled = false; } void ArduboyAudio::saveOnOff() { EEPROM.write(EEPROM_AUDIO_ON...
```c++ #include "Arduboy.h" #include "audio.h" bool ArduboyAudio::audio_enabled = false; void ArduboyAudio::on() { audio_enabled = true; } bool ArduboyAudio::enabled() { return audio_enabled; } void ArduboyAudio::off() { audio_enabled = false; } void ArduboyAudio::saveOnOff() { EEPROM.update(EEPROM_AUDIO_O...
ff9ba0ad-befd-41bf-b69a-4e7a3610973c
{ "language": "C++" }
```c++ // Copyright 2015 Matt Heard // http://mattheard.net // matt@mattheard.net // @mattheard #include <iostream> #include <string> int main(int argc, char **argv) { const int expectedNumArgs = 2; if (argc != expectedNumArgs) { using std::string; const string cmdName = "DisplayImage"; ...
```c++ // Copyright 2015 Matt Heard // http://mattheard.net // matt@mattheard.net // @mattheard #include <opencv2/opencv.hpp> #include <iostream> #include <string> int main(int argc, char **argv) { using std::string; const int expectedNumArgs = 2; if (argc != expectedNumArgs) { const string cmdNam...
b76d555a-1984-4a65-99c9-fb2cb1cf9eac
{ "language": "C++" }
```c++ /* * Behavior.cpp * * Created on: Mar 25, 2014 * Author: user */ #include "Behavior.h" Behavior::Behavior(Robot* robot) { // TODO Auto-generated constructor stub _robot = robot; } Behavior* Behavior::addNextBehavior(Behavior* behavior) { this->_nextBehaviors.push_back(behavior); } Behavior* Beh...
```c++ /* * Behavior.cpp * * Created on: Mar 25, 2014 * Author: user */ #include "Behavior.h" Behavior::Behavior(Robot* robot) { _robot = robot; } Behavior* Behavior::addNextBehavior(Behavior* behavior) { this->_nextBehaviors.push_back(behavior); } Behavior* Behavior::getNextBehavior() { for (vector<B...
317b4809-01f1-40d3-9b30-9cdf96d7d894
{ "language": "C++" }
```c++ #include <agency/execution_policy.hpp> #include <vector> int sum(const std::vector<int>& data) { using namespace agency; return bulk_invoke(con(data.size()), [&](concurrent_agent& self, std::vector<int>& scratch) -> single_result<int> { auto i = self.index(); auto n = scratch.size(); ...
```c++ #include <agency/execution_policy.hpp> #include <vector> int sum(const std::vector<int>& data) { using namespace agency; return bulk_invoke(con(data.size()), [&](concurrent_agent& self, std::vector<int>& scratch) -> single_result<int> { auto i = self.index(); auto n = scratch.size(); ...
18b9fbfa-4667-4059-9f72-cd0e11956b35
{ "language": "C++" }
```c++ /* * Copyright (C) 2015 - Florent Revest <revestflo@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 2.1 of the * License, or (at your option) any ...
```c++ /* * Copyright (C) 2015 - Florent Revest <revestflo@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 2.1 of the * License, or (at your option) any ...
a9e6c951-2425-40ca-bb07-dda60b5ae3dc
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -std=c++11 -verify %s alignas(double) void f(); // expected-error {{'alignas' attribute only applies to variables, data members and tag types}} alignas(double) unsigned char c[sizeof(double)]; // expected-note {{previous}} extern unsigned char c[sizeof(double)]; alignas(float) extern unsigned...
```c++ // RUN: %clang_cc1 -std=c++11 -verify %s -triple x86_64-linux-gnu alignas(double) void f(); // expected-error {{'alignas' attribute only applies to variables, data members and tag types}} alignas(double) unsigned char c[sizeof(double)]; // expected-note {{previous}} extern unsigned char c[sizeof(double)]; align...
ddbff8e5-33ed-491e-bf69-0808cca6eaf1
{ "language": "C++" }
```c++ #include <iostream> //Thomas' Prototypes //Hannah's Prototypes int atomic_distance (int x, int y, int z); //Kate's Prototype: defines atomic distance as combination of x, y, z coordinates int (main) { using nedit file... create new input "hannah's test changes" } ``` Update to Kate's First Prototype
```c++ #include <iostream> //Thomas' Prototypes //Hannah's Prototypes int atomic_distance (int atom_dist_x, int atom_dist_y, int atom_dist_z); //Kate's Prototype: defines atomic distance as combination of x, y, z coordinates int (main) { using nedit file... create new input "hannah's test changes" } ```
865effff-7206-4b25-90c8-0100a9ec6977
{ "language": "C++" }
```c++ // // C++ Implementation: mailvieweventfilter // // Description: // // // Author: Aron Boström <aron dot bostrom at gmail dot com>, (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #include <QtDebug> #include <QResizeEvent> #include <QWidget> #include "mailvieweventfilter.h"...
```c++ // // C++ Implementation: mailvieweventfilter // // Description: // // // Author: Aron Boström <aron dot bostrom at gmail dot com>, (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #include <QtDebug> #include <QResizeEvent> #include <QWidget> #include "mailvieweventfilter.h"...
81ee5ba6-0a17-4920-84cb-c0f18618de34
{ "language": "C++" }
```c++ // RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t >%t.out 2>&1 // 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 && not %run %t >%t.out 2>&1 // RUN: FileCheck %s < %t.out // RUN: %clangxx_msan -m64 -O3 %s -o %t && not %run %...
```c++ // RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t >%t.out 2>&1 // RUN: %clangxx_msan -m64 -O1 %s -o %t && %run %t >%t.out 2>&1 // RUN: %clangxx_msan -m64 -O2 %s -o %t && %run %t >%t.out 2>&1 // RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t >%t.out 2>&1 // Test that (no_sanitize_memory) functions DO NOT propa...
1888c99c-a9cb-4641-bdf6-c05ed3904ae4
{ "language": "C++" }
```c++ //===-- CPlusPlusLanguage.cpp --------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===---------------------------------------------...
```c++ //===-- CPlusPlusLanguage.cpp --------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===---------------------------------------------...
6923beb4-888f-4698-b313-b2e2db69d7d4
{ "language": "C++" }
```c++ #include "environment.h" #include <webdriverxx/client.h> #include <gtest/gtest.h> namespace test { using namespace webdriverxx; class TestClient : public ::testing::Test { protected: static void SetUpTestCase() { client = new Client(GetWebDriverUrl()); } static void TearDownTestCase() { delete client;...
```c++ #include "environment.h" #include <webdriverxx/client.h> #include <gtest/gtest.h> namespace test { using namespace webdriverxx; class TestClient : public ::testing::Test { protected: static void SetUpTestCase() { client = new Client(GetWebDriverUrl()); } static void TearDownTestCase() { delete client;...
297da350-2ff4-47c9-8c9a-6ca4895eddf8
{ "language": "C++" }
```c++ /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2013 Couchbase, 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 * * ...
```c++ /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2013 Couchbase, 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 * * ...
35bbbeeb-a83f-4102-b7aa-7c4435a20e05
{ "language": "C++" }
```c++ #include "string_split.h" namespace psz { std::vector<std::string> SplitString(const std::string& str, const std::string& sep) { std::vector<std::string> results; size_t prev = 0; size_t pos = str.find(sep); while (pos != std::string::npos) { results.push_back(s...
```c++ #include "string_split.h" namespace psz { std::vector<std::string> SplitString(const std::string& str, const std::string& sep) { std::vector<std::string> results; size_t prev = 0; size_t pos = str.find(sep); while (pos != std::string::npos) { // TODO optimize! ...
e2c54c6a-c182-43e1-9f43-7b0289e91408
{ "language": "C++" }
```c++ // Copyright (C) 2015 Elviss Strazdins // This file is part of the Ouzel engine. #include <Windows.h> #include "Application.h" int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { ouzel::Application* application = new ouzel::Application(); //TODO: create main w...
```c++ // Copyright (C) 2015 Elviss Strazdins // This file is part of the Ouzel engine. #include <windows.h> #include "Application.h" int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { ouzel::Application* application = new ouzel::Application(); //TODO: create main w...
f1b8fbed-3ad5-4cd0-bf29-fa238f17ccca
{ "language": "C++" }
```c++ #include "../src/logger.h" #define CATCH_CONFIG_MAIN #include <lightstep/catch/catch.hpp> using namespace lightstep; TEST_CASE("logger") { LogLevel logged_level = LogLevel::off; std::string logged_message; Logger logger{[&](LogLevel level, opentracing::string_view message) { logged_level = level; ...
```c++ #include "../src/logger.h" #define CATCH_CONFIG_MAIN #include <lightstep/catch/catch.hpp> using namespace lightstep; TEST_CASE("logger") { LogLevel logged_level = LogLevel::off; std::string logged_message; Logger logger{[&](LogLevel level, opentracing::string_view message) { logged_level = level; ...
e68bd889-1de3-4ea7-912a-6917528680be
{ "language": "C++" }
```c++ //===--- ArgumentsAdjusters.cpp - Command line arguments adjuster ---------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===--- ArgumentsAdjusters.cpp - Command line arguments adjuster ---------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
d786e88f-48a8-46f8-8e0d-4d410830787e
{ "language": "C++" }
```c++ #include "ui/region_picker.hpp" int main() { EasyGIF::UI::RegionPicker picker(false); picker.Activate(); while(picker.IsRunning()) { picker.UpdateEvents(); picker.ProcessInput(); picker.Draw(); } return 0; } ``` Test for saving a selected region to a file
```c++ #include "img/image_frame.hpp" #include "img/image_grabber.hpp" #include "img/image_saver.hpp" #include "ui/region_picker.hpp" #include <unistd.h> int main() { EasyGIF::UI::RegionPicker picker(false); EasyGIF::ImageFrame frame; EasyGIF::ImageGrabber grabber; EasyGIF::ImageSaver saver; picker.Activate(); w...
f49d59fc-1a20-4dec-add3-738f660159d6
{ "language": "C++" }
```c++ #include <cassert> #include <iostream> #include "ColorFinder.hpp" int main() { constexpr ColorFinder::Color c{0x82, 0x12, 0x18}; constexpr auto name = getClosestColorName(c); std::cout << name << std::endl; return 0; }``` Add static_assert to check evaluated value
```c++ #include <cassert> #include <iostream> #include "ColorFinder.hpp" int main() { constexpr ColorFinder::Color c{0x82, 0x12, 0x18}; constexpr auto name = getClosestColorName(c); static_assert(name == "Falu Red", "Something went wrong"); std::cout << name << std::endl; return 0; }```
c41142d6-2d54-4b70-ac06-edcf604ccf17
{ "language": "C++" }
```c++ #include <string> #include <iostream> #include <fstream> #include <streambuf> #include <evm2wasm.h> using namespace std; int main(int argc, char **argv) { if (argc < 2) { cerr << "Usage: " << argv[0] << " <EVM file>" << endl; return 1; } ifstream input(argv[1]); if (!input.is_...
```c++ #include <string> #include <iostream> #include <fstream> #include <streambuf> #include <evm2wasm.h> using namespace std; int main(int argc, char **argv) { if (argc < 2) { cerr << "Usage: " << argv[0] << " <EVM file> [--wast]" << endl; return 1; } bool wast = false; if (argc ==...
8cba78a6-f0c5-463d-b563-6166f13f0912
{ "language": "C++" }
```c++ #include "Genes/Freedom_To_Move_Gene.h" #include <string> #include "Genes/Gene.h" #include "Game/Board.h" #include "Game/Color.h" double Freedom_To_Move_Gene::score_board(const Board& board, Piece_Color perspective, size_t) const noexcept { static auto initial_score = double(Board().legal_moves().size());...
```c++ #include "Genes/Freedom_To_Move_Gene.h" #include <string> #include "Genes/Gene.h" #include "Game/Board.h" #include "Game/Color.h" double Freedom_To_Move_Gene::score_board(const Board& board, Piece_Color perspective, size_t) const noexcept { static const auto initial_score = double(Board().legal_moves().si...
7fc13e1a-5daa-4a1c-906e-591e399f257b
{ "language": "C++" }
```c++ #include "mainwindow.h" #include <QApplication> #include <QDialog> #include <QGridLayout> #include <QLayout> #include <QDebug> #include "application.h" int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("JASP"); QCoreApplication::setOrganizationDomain("jasp-stats.org"); QCoreApplicati...
```c++ #include "mainwindow.h" #include <QApplication> #include <QDialog> #include <QGridLayout> #include <QLayout> #include <QDebug> #include "application.h" int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("JASP"); QCoreApplication::setOrganizationDomain("jasp-stats.org"); QCoreApplicati...
e16a1e55-eb5e-428a-8822-8f9c25dd99a7
{ "language": "C++" }
```c++ /* Copyright (c) 2014 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 writi...
```c++ /* Copyright (c) 2014 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 writi...
9ef53f99-c1e0-4d9c-b0ca-3e0bc8cdc122
{ "language": "C++" }
```c++ #include "PrimaryTreeIndex.h" void PrimaryTreeIndex::buildIndex(Table & table, int column) { int rowno = 0; for(auto &currentRow : table) { index.emplace(currentRow[column], rowno++); } } int PrimaryTreeIndex::size() const { return index.size(); } int PrimaryTreeIndex::exactMatch(const...
```c++ #include "PrimaryTreeIndex.h" void PrimaryTreeIndex::buildIndex(Table & table, int column) { int rowno = 0; for(auto &currentRow : table) { index.emplace(currentRow[column], rowno++); } } int PrimaryTreeIndex::size() const { return index.size(); } int PrimaryTreeIndex::exactMatch(const...
def378f3-7911-47c9-a28d-09f06de88e65
{ "language": "C++" }
```c++ #include <iostream> #include <memory> #include <windows.h> #include <chewingwrapper.hpp> int main() { SetEnvironmentVariable("CHEWING_PATH", CHEWING_PATH); SetEnvironmentVariable("CHEWING_USER_PATH", CHEWING_USER_PATH); const wchar_t EXPECT[] = { 0x6e2c, 0x8a66, 0 /* 測試 */ }; ChewingWrapper ...
```c++ #include <iostream> #include <memory> #include <windows.h> #include <chewingwrapper.hpp> int main() { // XXX: Use SetEnvironmentVariableA here will cause crash in Visual Studio. _putenv("CHEWING_PATH="CHEWING_PATH); _putenv("CHEWING_USER_PATH="CHEWING_USER_PATH); const wchar_t EXPECT[] = { 0x...
7635b0d8-e30e-4db8-b362-4475c73c6b72
{ "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<...
50039cb1-f262-49c1-bc0c-0bf4409967b1
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -std=c++17 -emit-llvm -fchar8_t -triple x86_64-linux %s -o - | FileCheck %s // CHECK: define void @_Z1fDu( void f(char8_t c) {} // CHECK: define void @_Z1gIiEvDTplplcvT__ELA4_KDuELDu114EE template<typename T> void g(decltype(T() + u8"foo" + u8'r')) {} template void g<int>(const char8_t*); ``...
```c++ // RUN: %clang_cc1 -std=c++17 -emit-llvm -fchar8_t -triple x86_64-linux %s -o - | FileCheck %s // CHECK: define void @_Z1fDu( void f(char8_t c) {} // CHECK: define weak_odr void @_Z1gIiEvDTplplcvT__ELA4_KDuELDu114EE template<typename T> void g(decltype(T() + u8"foo" + u8'r')) {} template void g<int>(const char...
d1902a51-480a-48cc-8e6e-a62f94dfd05b
{ "language": "C++" }
```c++ #include <util/maker.hpp> #include <iostream> #include <iomanip> void show_help() noexcept { std::cout << "usage: shinobi [options]\n\n"; std::cout << std::left << '\t' << std::setw(25) << "-h, --help" << "show this message and exit" << '\n'; std::cout << std::left << '\t' << std::setw(25) <<...
```c++ #include <util/maker.hpp> #include <iostream> #include <iomanip> #include <map> void show_help() noexcept { std::cout << "usage: shinobi [options] [--] [filename]\n\n"; std::cout << std::left << '\t' << std::setw(25) << "-h, --help" << "show this message and exit" << '\n'; std::cout << std::...
436a3ab7-13ae-4f23-8041-428718f162da
{ "language": "C++" }
```c++ #include <stdio.h> int main(int argc, char* argv[]) { printf("One\n"); printf("Two\n"); printf("Three\n"); printf("Four\n"); return 0; } ``` Read in the page names into a vector and hash
```c++ #include <stdio.h> #include <iostream> #include <fstream> #include <vector> #include <unordered_map> int main(int argc, char* argv[]) { if (argc != 5) { std::cerr << "Path Finder only accepts 4 arguments\n"; exit(1); } // Load in all page titles into a vector std::cout << "\033[92m==>\033[0m Reading i...
aa0a7bf0-9b7b-42c0-85bd-35d0aa83e4df
{ "language": "C++" }
```c++ #include <memory> #include "Vec2i.h" #include "IMapElement.h" #include "CActor.h" #include "CWizard.h" namespace WizardOfGalicia { CWizard::CWizard() : CActor() { emission = 20; view = '^'; team = Team::HEROES; hp = 5; attack = 4; defence = 1; magicEnergy = 20; } void CWizard...
```c++ #include <memory> #include "Vec2i.h" #include "IMapElement.h" #include "CActor.h" #include "CWizard.h" namespace WizardOfGalicia { CWizard::CWizard() : CActor() { emission = 20; view = '^'; team = Team::HEROES; hp = 5; attack = 4; defence = 1; magicEnergy = 20; } void CWizard...
c2840067-9b03-4b74-bfdc-1d2964ef5cd2
{ "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 "courgette/crc.h" #ifdef OS_CHROMEOS # include "zlib.h" #else extern "C" { # include "third_party/lzma_sdk/7zCrc.h" } #endif #incl...
```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. // Calculate Crc by calling CRC method in LZMA SDK #include "courgette/crc.h" extern "C" { #include "third_party/lzma_sdk/7zCrc.h" } namespa...
19804b1c-34fb-49eb-b7d7-1727323a402c
{ "language": "C++" }
```c++ #include "KAI/Console/Console.h" #include <iostream> #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include <Windows.h> #endif using namespace std; USING_NAMESPACE_KAI //static Color _color; int main(int argc, char **argv) { KAI_UNUSED_2(argc, argv); cout << "pyro v0.1" << endl; Console console; console....
```c++ #include <KAI/Console/Console.h> #include <iostream> using namespace std; USING_NAMESPACE_KAI int main(int argc, char **argv) { KAI_UNUSED_2(argc, argv); cout << "KAI v0.1" << endl; Console console; console.SetLanguage(Language::Pi); // the higher the number, the greater the verbosity of debug output ...
7960669f-601b-4df4-88d7-efad2fd99f5c
{ "language": "C++" }
```c++ // REQUIRES: x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -g -fno-limit-debug-info -S %s -o %t // RUN: FileCheck %s < %t // FIXME: This testcase shouldn't rely on assembly emission. //CHECK: Lpubtypes_begin1: //CHECK: .asciz "G" //CHECK-NEXT: .long 0 //CHECK-NEXT: Lp...
```c++ // REQUIRES: x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -g -fno-limit-debug-info -S %s -o %t // RUN: FileCheck %s < %t // FIXME: This testcase shouldn't rely on assembly emission. //CHECK: Lpubtypes_begin[[SECNUM:[0-9]:]] //CHECK: .asciz "G" //CHECK-NEXT: .long 0 /...
a8f28a63-c869-4eee-854b-a091b7506994
{ "language": "C++" }
```c++ /* * Copyright (C) 2004-2009 See the AUTHORS file for details. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. */ #include "Server.h" CServer::CServer(const CString& ...
```c++ /* * Copyright (C) 2004-2009 See the AUTHORS file for details. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. */ #include "Server.h" CServer::CServer(const CString& ...
8d09f557-2175-4789-bbd8-0420515098a5
{ "language": "C++" }
```c++ // Copyright (c) 2016, Herman Bergwerf. All rights reserved. // Use of this source code is governed by a MIT-style license // that can be found in the LICENSE file. // Based on: http://seriss.com/people/erco/fltk/#FltkX #include <FL/Fl.H> #include <FL/fl_draw.H> #include <FL/Fl_Box.H> #include <FL/Fl_Double_Wi...
```c++ // Copyright (c) 2016, Herman Bergwerf. All rights reserved. // Use of this source code is governed by a MIT-style license // that can be found in the LICENSE file. // Based on: http://seriss.com/people/erco/fltk/#FltkX #include <FL/Fl.H> #include <FL/fl_draw.H> #include <FL/Fl_Box.H> #include <FL/Fl_Double_Wi...
f3348ffc-8ea9-4bed-9b38-e88eec5aea79
{ "language": "C++" }
```c++ #include <stdio.h> #include <fcntl.h> #include <chrono> #include <thread> void *start(void *data) { int i; size_t idx = (size_t)data; for (i=0; i<30; i++) { if ( idx == 0 ) std::this_thread::sleep_for(std::chrono::microseconds(1)); std::this_thread::sleep_for(std::ch...
```c++ #include <stdio.h> #include <fcntl.h> #include <chrono> #include <thread> #if defined(__linux__) #include <sys/prctl.h> #endif void *start(void *data) { int i; size_t idx = (size_t)data; for (i=0; i<30; i++) { if ( idx == 0 ) std::this_thread::sleep_for(std::chrono::microse...
fd0d2097-42f6-4225-a49e-27e9dc0949f6
{ "language": "C++" }
```c++ #include <inttypes.h> #include <stdlib.h> #include <config/config_type_int.h> ConfigTypeInt config_type_int; bool ConfigTypeInt::set(ConfigValue *cv, const std::string& vstr) { if (ints_.find(cv) != ints_.end()) return (false); const char *str = vstr.c_str(); char *endp; intmax_t imax; imax = strtoim...
```c++ #if !defined(__OPENNT) #include <inttypes.h> #endif #include <stdlib.h> #include <config/config_type_int.h> ConfigTypeInt config_type_int; bool ConfigTypeInt::set(ConfigValue *cv, const std::string& vstr) { if (ints_.find(cv) != ints_.end()) return (false); const char *str = vstr.c_str(); char *endp; i...
d6ee4c37-0f67-4e3b-a873-ed22ad2a7b71
{ "language": "C++" }
```c++ /* This file is part of cpp-ethereum. cpp-ethereum is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. cpp-ethereum is distributed...
```c++ /* This file is part of cpp-ethereum. cpp-ethereum is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. cpp-ethereum is distributed...
07d39997-d45d-44ef-a1a9-862ebeb02564
{ "language": "C++" }
```c++ /* * Copyright (C) 2016 Google, 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 ...
```c++ /* * Copyright (C) 2016 Google, 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 ...
e0d16114-c840-4288-a4cc-d2df52ff858e
{ "language": "C++" }
```c++ #include "daemon.h" #include <err.h> #include <iostream> #include <string.h> #include <unistd.h> int main(int argc, char **argv) { int separator = 0; char** compile_argv; for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "--") == 0) { separator = i; break; } } compile_argv = ...
```c++ #include "daemon.h" #include <cstring> #include <err.h> #include <iostream> #include <unistd.h> int main(int argc, char **argv) { int separator = 0; char** compile_argv; for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], "--") == 0) { separator = i; break; } } compile_arg...
b1813dd6-da59-4333-82ad-f714add60914
{ "language": "C++" }
```c++ #include <cstdio> #include <string> #include <vector> using std::vector; using std::string; int main(int argc, char *argv[]) { vector<string> args(argv + 1, argv + argc); for (const auto &arg : args) { printf("%s\n", arg.c_str()); } return 0; } ``` Make script download and print a web page.
```c++ #include <cstdio> #include <string> #include <vector> #include <curl/curl.h> using std::vector; using std::string; struct LinkTestData { string in_source_url; string in_href_url; string out_source_page; }; size_t WriteData(void *buffer, size_t size, size_t nmemb, void *userp) { LinkTestData *link_te...
959e5173-1be5-491c-a654-e6a0704f939b
{ "language": "C++" }
```c++ /* * Copyright (c) 2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #inc...
```c++ /* * Copyright (c) 2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #inc...
17930ba6-bd92-42b8-a807-952cd0ba57a7
{ "language": "C++" }
```c++ #include "readfile.h" #include <stdexcept> #include <sstream> #include <cstdio> #include <cerrno> #include <cstring> using namespace std; /* read_file: read the entire contents of a file into a C++ string. */ string read_file(const string& filename) { // Open the file int errno_; FILE* fd; if ...
```c++ #include "readfile.h" #include <stdexcept> #include <sstream> #include <cstdio> #include <cerrno> #include <cstring> using namespace std; /* read_file: read the entire contents of a file into a C++ string. */ string read_file(const string& filename) { // Open the file int errno_; FILE* fd; if ...
38c9453b-dbb2-4f14-908f-5b0de4c82c42
{ "language": "C++" }
```c++ #include <core.h> #include "thermostat.h" #include "keyboard.h" #define BUTTONS 4 uint8_t keyPins[BUTTONS] = {KEY_MODE_PIN, KEY_UP_PIN, KEY_DOWN_PIN, KEY_SETUP_PIN}; uint32_t lastKeyChangeMillis[BUTTONS] = {0, 0, 0, 0}; using namespace core; idType keyIds[BUTTONS]; idType idKeyMode, idKeyUp, idKeyDown, idKeySe...
```c++ #include <core.h> #include "thermostat.h" #include "keyboard.h" #define BUTTONS 4 uint8_t keyPins[BUTTONS] = {KEY_MODE_PIN, KEY_UP_PIN, KEY_DOWN_PIN, KEY_SETUP_PIN}; uint32_t lastKeyChangeMillis[BUTTONS] = {0, 0, 0, 0}; using namespace core; idType keyIds[BUTTONS]; idType idKeyMode, idKeyUp, idKeyDown, idKeySe...
784c5620-3f8d-45a7-a8c7-acdb0104728b
{ "language": "C++" }
```c++ //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--------------------...
```c++ //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--------------------...
28549156-a15b-4fef-b4f6-94b617499aff
{ "language": "C++" }
```c++ #include "common/application_info.h" namespace brightray { std::string GetApplicationName() { return std::string(); } std::string GetApplicationVersion() { return std::string(); } } ``` Set the user agent string correctly on Windows
```c++ #include "common/application_info.h" #include "base/file_version_info.h" #include "base/memory/scoped_ptr.h" #include "base/utf_string_conversions.h" namespace brightray { std::string GetApplicationName() { auto info = make_scoped_ptr(FileVersionInfo::CreateFileVersionInfoForModule(GetModuleHandle(nullptr))...
ef3dfd2a-4a93-4062-b03c-5ac135c6bda6
{ "language": "C++" }
```c++ /* This file is part of fus. * * fus 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 version 3 of the License, or * (at your option) any later version. * * fus is distri...
```c++ /* This file is part of fus. * * fus 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 version 3 of the License, or * (at your option) any later version. * * fus is distri...
a6524b84-5a8e-466c-a060-4f0ce139a250
{ "language": "C++" }
```c++ #include "rdb_protocol/configured_limits.hpp" #include <limits> #include "rdb_protocol/wire_func.hpp" #include "rdb_protocol/func.hpp" namespace ql { configured_limits_t from_optargs(rdb_context_t *ctx, signal_t *interruptor, global_optargs_t *arguments) { if (arguments->has_optarg("array_limit")) { ...
```c++ #include "rdb_protocol/configured_limits.hpp" #include <limits> #include "rdb_protocol/wire_func.hpp" #include "rdb_protocol/func.hpp" namespace ql { configured_limits_t from_optargs(rdb_context_t *ctx, signal_t *interruptor, global_optargs_t *arguments) { if (arguments->has_optarg("array_limit")) { ...
2a0ae9ba-aa1d-4d95-927e-55897cc66362
{ "language": "C++" }
```c++ #include "LevelState.h" LevelState::LevelState() { } LevelState::~LevelState() { } int LevelState::ShutDown() { int result = 1; return result; } int LevelState::Initialize(GameStateHandler * gsh, ComponentHandler* cHandler) { int result = 0; result = GameState::InitializeBase(gsh, cHandler); //Read ...
```c++ #include "LevelState.h" LevelState::LevelState() { } LevelState::~LevelState() { } int LevelState::ShutDown() { int result = 1; return result; } int LevelState::Initialize(GameStateHandler * gsh, ComponentHandler* cHandler) { int result = 0; result = GameState::InitializeBase(gsh, cHandler); //Read ...
671d0076-22d2-4c97-b8b9-305a42d49c02
{ "language": "C++" }
```c++ // Includes #include "App/Factories/TextFileNFDelegate.h" #include "App/Nodes/TextFileNode.h" #include "App/Logger.h" // STD. #include <fstream> TextFileNFDelegate::TextFileNFDelegate() { } TextFileNFDelegate::~TextFileNFDelegate() { } std::string TextFileNFDelegate::nodeType() const { return "TextFile...
```c++ // Includes #include "App/Factories/TextFileNFDelegate.h" #include "App/Nodes/TextFileNode.h" #include "App/Logger.h" // STD. #include <fstream> TextFileNFDelegate::TextFileNFDelegate() { } TextFileNFDelegate::~TextFileNFDelegate() { } std::string TextFileNFDelegate::nodeType() const { return "TextFile...
21748913-a0b4-4494-8258-2a7d0ce716d6
{ "language": "C++" }
```c++ /* * SchemeAdHoc.c * * Scheme adhoc callback into opencog * * Copyright (c) 2008 Linas Vepstas <linas@linas.org> */ #ifdef HAVE_GUILE #include <libguile.h> #include <opencog/server/CogServer.h> #include <opencog/nlp/wsd/WordSenseProcessor.h> #include "SchemeSmob.h" using namespace opencog; /* =======...
```c++ /* * SchemeAdHoc.c * * Scheme adhoc callback into opencog * * Copyright (c) 2008 Linas Vepstas <linas@linas.org> */ #ifdef HAVE_GUILE #include <libguile.h> #include <opencog/server/CogServer.h> #include <opencog/nlp/wsd/WordSenseProcessor.h> #include "SchemeSmob.h" using namespace opencog; /* =======...
cc76814b-5590-4d34-af5d-7386ab692451
{ "language": "C++" }
```c++ #include <iostream> #include "cons.h" #include "error.h" #include "eval.h" #include "init.h" #include "reader.h" namespace { class Repl { std::istream& in_; std::ostream& out_; std::string prompt_ = "mclisp> "; mclisp::Reader reader_; public: explicit Repl(std::istream& in=std::cin, std::ostrea...
```c++ #include <iostream> #include "cons.h" #include "error.h" #include "eval.h" #include "init.h" #include "reader.h" namespace { bool ShouldQuit(mclisp::ConsCell *exp) { std::ostringstream oss; oss << *exp; return EQ(exp, EOF) || oss.str() == "QUIT" || oss.str() == "(QUIT)"; } class Repl { std::istream& ...
737fed60-7ba4-46bd-b3de-5ee2244d3060
{ "language": "C++" }
```c++ #include "mbed.h" #include "MicroBit.h" void RefCounted::init() { // Initialize to one reference (lowest bit set to 1) refCount = 3; } static inline bool isReadOnlyInline(RefCounted *t) { uint32_t refCount = t->refCount; if (refCount == 0xffff) return true; // object in flash // D...
```c++ #include "mbed.h" #include "MicroBit.h" void RefCounted::init() { // Initialize to one reference (lowest bit set to 1) refCount = 3; } static inline bool isReadOnlyInline(RefCounted *t) { uint32_t refCount = t->refCount; if (refCount == 0xffff) return true; // object in flash // D...
37e4d379-f87c-4f31-95b3-c1029ec96c10
{ "language": "C++" }
```c++ #include <SFML/Graphics.hpp> int main(int argc, char const *argv[]) { sf::RenderWindow window(sf::VideoMode(800, 600), "Lord of the Orb", sf::Style::Titlebar | sf::Style::Close); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event...
```c++ #include <SFML/Graphics.hpp> int main(int argc, char const *argv[]) { sf::RenderWindow window(sf::VideoMode(1280, 720), "Lord of the Orb", sf::Style::Close); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (...
bc770ccb-53d3-439a-b736-5848621d0868
{ "language": "C++" }
```c++ #include <node.h> #include <node_internals.h> using namespace v8; #include "runas.h" namespace { Handle<Value> Runas(const Arguments& args) { HandleScope scope; if (!args[0]->IsString() || !args[1]->IsArray() || !args[2]->IsObject()) return node::ThrowError("Bad argument"); std::string command(*St...
```c++ #include "nan.h" using namespace v8; #include "runas.h" namespace { NAN_METHOD(Runas) { NanScope(); if (!args[0]->IsString() || !args[1]->IsArray() || !args[2]->IsObject()) return NanThrowTypeError("Bad argument"); std::string command(*String::Utf8Value(args[0])); std::vector<std::string> c_args...