doc_id stringlengths 36 36 | metadata dict | input stringlengths 28 4.3k | output stringlengths 11 5.45k |
|---|---|---|---|
0ca82411-6b3c-4ec1-8225-510d4cc28d45 | {
"language": "C++"
} | ```c++
// Written by : Chirantan Mitra
#include <matrix.h>
#include <cmath>
class testFunctionoid
{
public:
double operator() (double x, double y)
{
return (sin(x * y) + 1.0) / 2.0;
}
};
using namespace CMatrix;
int main()
{
int size = 5;
Matrix<double> matrix(si... | ```c++
// Written by : Chirantan Mitra
#include <matrix.h>
#include <cmath>
class testFunctionoid
{
public:
double operator() (double x, double y)
{
return (sin(x * y) + 1.0) / 2.0;
}
};
using namespace CMatrix;
int main()
{
int size = 5;
Matrix<double> matrix(si... |
d46c1ae4-0267-4ab6-8eaf-fc9a7adf6854 | {
"language": "C++"
} | ```c++
// Copyright 2015 Alessio Sclocco <alessio@sclocco.eu>
//
// 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... | ```c++
// Copyright 2015 Alessio Sclocco <alessio@sclocco.eu>
//
// 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... |
ac4f33af-0807-4d71-a2d9-463859ba0862 | {
"language": "C++"
} | ```c++
// RUN: %clang_cc1 -fmodules -std=c++14 -emit-llvm %s -o - -triple %itanium_abi_triple | FileCheck %s
#pragma clang module build A
module A {}
#pragma clang module contents
#pragma clang module begin A
template<int> int n = 42;
decltype(n<0>) f();
#pragma clang module end
#pragma clang module endbuild
#pragma ... | ```c++
// RUN: %clang_cc1 -fmodules -std=c++14 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
#pragma clang module build A
module A {}
#pragma clang module contents
#pragma clang module begin A
template<int> int n = 42;
decltype(n<0>) f();
#pragma clang module end
#pragma clang module endbuild
#pragma cla... |
a31ba6bc-2eda-4362-9473-72230df2fe9d | {
"language": "C++"
} | ```c++
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
==========... | ```c++
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
==========... |
d1c176ac-31a6-4b55-ab14-42e90504aefb | {
"language": "C++"
} | ```c++
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <unistd.h>
static const char *const RETVAL_PREFIX = "retval:";
static const char *const SLEEP_PREFIX = "sleep:";
static const char *const STDERR_PREFIX = "stderr:";
int main (int argc, char **argv)
{
int return_value = 0;
for (int i =... | ```c++
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <unistd.h>
static const char *const RETVAL_PREFIX = "retval:";
static const char *const SLEEP_PREFIX = "sleep:";
static const char *const STDERR_PREFIX = "stderr:";
int main (int argc, char **argv)
{
int return_value = 0;
for (int i =... |
e9716391-c088-473e-86da-8ee39a845744 | {
"language": "C++"
} | ```c++
#include "xchainer/native_device.h"
#include <gtest/gtest.h>
#include "xchainer/native_backend.h"
namespace xchainer {
namespace {
TEST(NativeDeviceTest, Ctor) {
NativeBackend backend;
{
NativeDevice device{backend, 0};
EXPECT_EQ(&backend, &deivce.backend());
EXPECT_EQ(0, dev... | ```c++
#include "xchainer/native_device.h"
#include <gtest/gtest.h>
#include "xchainer/native_backend.h"
namespace xchainer {
namespace {
TEST(NativeDeviceTest, Ctor) {
NativeBackend backend;
{
NativeDevice device{backend, 0};
EXPECT_EQ(&backend, &deivce.backend());
EXPECT_EQ(0, dev... |
80f9a05f-b222-42a4-a71e-796cbf1a57f5 | {
"language": "C++"
} | ```c++
// Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon
// We are making my contributions/submissions to this project solely in our
// personal capacity and are not conveying any rights to any intellectual
// property of any third parties.
#include <Rosetta/Cards/Cards.hpp>
#include <Rosetta/Enchants/E... | ```c++
// Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon
// We are making my contributions/submissions to this project solely in our
// personal capacity and are not conveying any rights to any intellectual
// property of any third parties.
#include <Rosetta/Cards/Cards.hpp>
#include <Rosetta/Enchants/E... |
4cf26fbc-97a1-4ca5-b14d-7c3a97d8ac83 | {
"language": "C++"
} | ```c++
#include <iostream>
#include <Magick++/Blob.h>
#include <Magick++/Image.h>
extern "C" int main() {
size_t nFormats;
Magick::ExceptionInfo ex;
const Magick::MagickInfo **formats = GetMagickInfoList("*", &nFormats, &ex);
for (size_t i = 0; i < nFormats; i++) {
const Magick::MagickInfo *format = form... | ```c++
#include <iostream>
#include <list>
#include <Magick++/Image.h>
#include <Magick++/STL.h>
int main() {
std::list<Magick::CoderInfo> coderList;
coderInfoList(&coderList, Magick::CoderInfo::TrueMatch, Magick::CoderInfo::AnyMatch, Magick::CoderInfo::AnyMatch);
for (std::list<Magick::CoderInfo>::iterator it... |
2d3a671a-d473-4893-bd38-2eaf76f1630c | {
"language": "C++"
} | ```c++
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h"
#include "chrome/browser/ui/browser_list.h"
namespace chrome {
Browser* GetLa... | ```c++
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h"
#include "chrome/browser/ui/browser_finder.h"
namespace chrome {
Browser* Get... |
0198ed6e-2a4f-465a-baba-82967427aaa6 | {
"language": "C++"
} | ```c++
#include "keytar.h"
#include <Security/Security.h>
namespace keytar {
bool AddPassword(const std::string& service,
const std::string& account,
const std::string& password) {
OSStatus status = SecKeychainAddGenericPassword(NULL,
... | ```c++
#include "keytar.h"
#include <Security/Security.h>
namespace keytar {
bool AddPassword(const std::string& service,
const std::string& account,
const std::string& password) {
OSStatus status = SecKeychainAddGenericPassword(NULL,
... |
de49a668-01e6-4471-a6ca-a5daf85a0c08 | {
"language": "C++"
} | ```c++
#include "bubble.hpp"
#include "swap.hpp"
void bubble(int *data, const int size_of_data)
{
if(size_of_data <= 0) return;
for(int i = 0; i < size_of_data; ++i)
if(data[i] > data[i + 1]) swap(data[i], data[i + 1]);
return bubble(data, size_of_data - 1);
}
```
Fix the loop expr of Bubble so... | ```c++
#include "bubble.hpp"
#include "swap.hpp"
void bubble(int *data, const int size_of_data)
{
if(size_of_data <= 0) return;
for(int i = 0; i + 1 < size_of_data; ++i)
if(data[i] > data[i + 1]) swap(data[i], data[i + 1]);
return bubble(data, size_of_data - 1);
}
``` |
6ed16ba5-d50c-46ed-a682-46c55f6924d0 | {
"language": "C++"
} | ```c++
// This tests compilation of EMPTY_CLASS_EXPR's
struct empty {};
void foo(empty E);
void bar() { foo(empty()); }
```
Remove name, add body. Causes llvmg++ segfault! | ```c++
// This tests compilation of EMPTY_CLASS_EXPR's
struct empty {};
void foo(empty) {}
void bar() { foo(empty()); }
``` |
1b7811db-521a-407b-8da3-c81ecc63db75 | {
"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
#include <execinfo.h>
#include <unistd.h>
#endif
// FreeBSD uses size_t for the return type of backtrace()
#if defined(__FreeBSD__) && (_... | ```c++
// StackTrace.cpp
// Implements the functions to print current stack traces
#include "Globals.h"
#include "StackTrace.h"
#ifdef _WIN32
#include "../StackWalker.h"
#else
#include <execinfo.h>
#include <unistd.h>
#endif
// FreeBSD uses size_t for the return type of backtrace()
#if defined(__FreeBSD__) && (_... |
e67254fc-4b23-4367-8580-7c59cc78cf13 | {
"language": "C++"
} | ```c++
/**
* Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
#include "stdafx.h"
#ifndef __cplusplus_cli
int main (int argc, char **argv) {
CAbstractTest::Main (argc, argv);
return 0;
}
#endif /* ifndef __cplusplus_cli */
```
Verif... | ```c++
/**
* Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
#include "stdafx.h"
#include "Service/Service.h"
#ifndef __cplusplus_cli
int main (int argc, char **argv) {
if ((argc == 3) && !strcmp (argv[1], "jvm")) {
return ServiceT... |
fa03f63f-fb18-42a7-b487-e8fd71328cfc | {
"language": "C++"
} | ```c++
#include <occa/defines.hpp>
#include <occa/modes/metal/registration.hpp>
namespace occa {
namespace metal {
modeInfo::modeInfo() {}
bool modeInfo::init() {
return OCCA_METAL_ENABLED;
}
styling::section& modeInfo::getDescription() {
static styling::section section("Metal");
... | ```c++
#include <occa/defines.hpp>
#include <occa/modes/metal/registration.hpp>
namespace occa {
namespace metal {
modeInfo::modeInfo() {}
bool modeInfo::init() {
#if OCCA_METAL_ENABLED
// Only consider metal enabled if there is a device
return api::metal::getDeviceCount();
#else
return fa... |
464dccbe-2953-42b5-ab83-6bd0e64030b2 | {
"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")) {
... |
ce2c869a-b55c-424f-903c-ad95b11be1a9 | {
"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 "testing/gtest/include/gtest/gtest.h"
#include "base/basictypes.h"
#include "net/http/http_auth_handler_basic.h"
namespace net ... | ```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 "testing/gtest/include/gtest/gtest.h"
#include "base/basictypes.h"
#include "net/http/http_auth_handler_basic.h"
namespace net ... |
96fba4d5-2359-4ed9-bad4-51d32ad24090 | {
"language": "C++"
} | ```c++
#include <stdint.h>
#include <ncurses.h>
#include "display/Screen.h"
Screen::Screen()
{
//Initialized the screen
initscr();
//Start with a clean slate
clear();
//Don't echo entered characters on the screen
noecho();
//Hide the cursor
curs_set(false);
//Refresh the screen (to our blank state)
/// @t... | ```c++
#include <stdint.h>
#include <ncurses.h>
#include "display/Screen.h"
Screen::Screen()
{
//Initialized the screen
initscr();
//Start with a clean slate
clear();
//Don't echo entered characters on the screen
noecho();
//Enable getting function keys
keypad(stdscr, true);
//Hide the cursor
curs_set(fals... |
6d2c9824-8499-42b8-b442-33adafd88b56 | {
"language": "C++"
} | ```c++
// Copyright (C) 2009, 2010 by Florent Lamiraux, Thomas Moulard, JRL.
//
// This file is part of the hpp-corbaserver.
//
// This software is provided "as is" without warranty of any kind,
// either expressed or implied, including but not limited to the
// implied warranties of fitness for a particular purpose.
/... | ```c++
// Copyright (C) 2009, 2010 by Florent Lamiraux, Thomas Moulard, JRL.
//
// This file is part of the hpp-corbaserver.
//
// This software is provided "as is" without warranty of any kind,
// either expressed or implied, including but not limited to the
// implied warranties of fitness for a particular purpose.
/... |
9e15f24f-2dd0-4f45-b280-2c38f4b7a41a | {
"language": "C++"
} | ```c++
/**
* Dynamically Loaded Engine
* (C) 2010 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#include <botan/dyn_engine.h>
#include <botan/internal/dyn_load.h>
namespace Botan {
namespace {
extern "C" {
typedef Engine* (*creator_function)(void);
typedef void (*destructor_function)(Engi... | ```c++
/**
* Dynamically Loaded Engine
* (C) 2010 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#include <botan/dyn_engine.h>
#include <botan/internal/dyn_load.h>
namespace Botan {
namespace {
extern "C" {
typedef Engine* (*creator_function)(void);
typedef void (*destructor_function)(Engi... |
1ed23247-9dd9-4990-bcc5-c9ec5244027e | {
"language": "C++"
} | ```c++
/*
* Copyright 2017 Facebook, 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 ag... | ```c++
/*
* Copyright 2017-present Facebook, 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 l... |
1669eb47-f0bb-4b5d-885c-afb45b301c23 | {
"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, Storage) {
ASSERT_TRUE(RunExtensionTest("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"
// Started failing with r29947. WebKit merge 49961:49992.
IN_PROC_BROWSER_TEST_F(DISA... |
37ba4e40-f13e-4e72-8370-e4fefa895424 | {
"language": "C++"
} | ```c++
#include "VolumeSlider.h"
#include "..\Controllers\Volume\CoreAudio.h"
#include "..\Error.h"
#include "..\Settings.h"
#include "..\Skin.h"
#include "SliderKnob.h"
VolumeSlider::VolumeSlider(CoreAudio &volumeCtrl) :
SliderWnd(L"3RVX-VolumeSlider", L"3RVX Volume Slider"),
_settings(*Settings::Instance()),
_volum... | ```c++
#include "VolumeSlider.h"
#include "..\Controllers\Volume\CoreAudio.h"
#include "..\Error.h"
#include "..\Settings.h"
#include "..\Skin.h"
#include "SliderKnob.h"
VolumeSlider::VolumeSlider(CoreAudio &volumeCtrl) :
SliderWnd(L"3RVX-VolumeSlider", L"3RVX Volume Slider"),
_settings(*Settings::Instance()),
_volum... |
5e838236-4cf5-46b6-84cd-0c7d73566939 | {
"language": "C++"
} | ```c++
#include <gtest/gtest.h>
/**
* A test case that leaks memory, to check that we can spot this in valgrind
*/
TEST(Leak, ThisTestLeaks) { EXPECT_TRUE(new int[45]); }
#ifndef __NO_MAIN__
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
#endif```
Fix the le... | ```c++
#include <gtest/gtest.h>
/**
* A test case that leaks memory, to check that we can spot this in valgrind
*/
TEST(Leak, ThisTestLeaks) {
int* temp = new int[45];
int temp2 = *temp++;
std::cout << temp2;
}
#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
r... |
0717a4c3-04a9-4cd2-ab02-412b01a601db | {
"language": "C++"
} | ```c++
#include <avahi-client/client.h>
#include <dns_sd.h>
int main(int argc, char** argv) {
}
```
Fix inclusion path as suggested by @ruslo. | ```c++
#include <avahi-client/client.h>
#include <avahi-compat-libdns_sd/dns_sd.h>
int main(int argc, char** argv) {
}
``` |
a9c7a15b-5e34-4dd2-b2c3-b2171c51bcb4 | {
"language": "C++"
} | ```c++
// RUN: %llvmgcc %s -fasm-blocks -S -o - | FileCheck %s
// Complicated expression as jump target
// XFAIL: *
// XTARGET: x86,i386,i686
void Method3()
{
// CHECK: Method3
// CHECK-NOT: msasm
asm("foo:");
// CHECK: return
}
void Method4()
{
// CHECK: Method4
// CHECK: msasm
asm {
bar:
}
// CHECK: ret... | ```c++
// RUN: %llvmgxx %s -fasm-blocks -S -o - | FileCheck %s
// Complicated expression as jump target
// XFAIL: *
// XTARGET: x86,i386,i686
void Method3()
{
// CHECK: Method3
// CHECK-NOT: msasm
asm("foo:");
// CHECK: return
}
void Method4()
{
// CHECK: Method4
// CHECK: msasm
asm {
bar:
}
// CHECK: ret... |
eb2862be-9a42-4d66-8860-abfaaa20f184 | {
"language": "C++"
} | ```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++
// -*- 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.
//
//===------------------... |
1701c63e-4c78-4b39-b3f9-80353048eaf9 | {
"language": "C++"
} | ```c++
//===- StackSlots.cpp - Specialize LLVM code for target machine ---------===//
//
// This pass adds 2 empty slots at the top of function stack. These two slots
// are later used during code reoptimization for spilling the register values
// when rewriting branches.
//
//===-------------------------------------... | ```c++
//===- StackSlots.cpp - Specialize LLVM code for target machine ---------===//
//
// This pass adds 2 empty slots at the top of function stack. These two slots
// are later used during code reoptimization for spilling the register values
// when rewriting branches.
//
//===-------------------------------------... |
b18d2791-85a6-4721-9a42-6249cebe5d96 | {
"language": "C++"
} | ```c++
#include "aboutwindow.h"
#include "ui_aboutwindow.h"
AboutWindow::AboutWindow(const QString &version, QWidget *parent)
: QDialog(parent), ui(new Ui::AboutWindow)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
ui->labelCurrent->setText(version);
ui->labelCreator->setText(ui->labelCreator->text()... | ```c++
#include "aboutwindow.h"
#include "ui_aboutwindow.h"
AboutWindow::AboutWindow(const QString &version, QWidget *parent)
: QDialog(parent), ui(new Ui::AboutWindow)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
// Set window title according to the current build
QString labelVersion = version;
#i... |
c1bf64e8-b95d-4537-812a-521bd27cfeb9 | {
"language": "C++"
} | ```c++
#import <iostream>
class Room {
private:
const int width;
const int height;
public:
Room(){}
Room(int w, int h) {
width = w;
height = h;
}
void print_dimensions();
};
void Room::print_dimensions() {
std::cout << width << "x" << height << std::endl;
}
int main() {
Room... | ```c++
#import <iostream>
class Room {
private:
const int width;
const int height;
public:
Room(){}
Room(int w, int h) {
width = w;
height = h;
}
void print_dimensions();
bool loadFromXMLFile();
};
void Room::print_dimensions() {
std::cout << width << "x" << height << std::endl;... |
140349d8-ea7c-424f-b43c-c2c4b7c6e08d | {
"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.
//
//===---------------------------------... |
19da7adc-d0b9-4bf7-b9d0-96bbb4897236 | {
"language": "C++"
} | ```c++
// RUN: %clang -flimit-debug-info -emit-llvm -g -S %s -o - | FileCheck %s
// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A"
// CHECK-NOT: DIFlagFwdDecl
// CHECK-SAME: ){{$}}
class A {
public:
int z;
};
A *foo (A* x) {
A *a = new A(*x);
return a;
}
// CHECK: !DIComposi... | ```c++
// RUN: %clang -flimit-debug-info -emit-llvm -g -S %s -o - | FileCheck %s
// RUN: %clang -flimit-debug-info -emit-llvm -g -S %s -o - | FileCheck --check-prefix=CHECK-C %s
// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A"
// CHECK-NOT: DIFlagFwdDecl
// CHECK-SAME: ){{$}}
class... |
94102f31-7b46-475e-8ad8-d659ebac505b | {
"language": "C++"
} | ```c++
//===-- ColorSettings.cpp - Stylistic Setup for Colors ------------- c++ --===//
//
// UWH Timer
//
// This file is distributed under the BSD 3-Clause License.
// See LICENSE.TXT for details.
//
//===----------------------------------------------------... | ```c++
//===-- ColorSettings.cpp - Stylistic Setup for Colors ------------- c++ --===//
//
// UWH Timer
//
// This file is distributed under the BSD 3-Clause License.
// See LICENSE.TXT for details.
//
//===----------------------------------------------------... |
d0881702-3fb0-4a41-a066-3a828e82d8c0 | {
"language": "C++"
} | ```c++
#include <iostream>
void dummy();
int main()
{
dummy();
}
void dummy() {
std::cout<<"Welcome to the yield calculator \n";
}
```
Add code to calculate yield for cash instruments | ```c++
#include <iostream>
#include <map>
using namespace std;
double timeInYears(const string period);
double cashDiscountValue(const string period, double rate);
int main()
{
map<string, double> yields;
// 1) Assignment using array index notation
yields["1W"] = 0.445060000;
yields["1M"] = 0.52689... |
9a3850f2-760b-4851-81c3-fea78c27a729 | {
"language": "C++"
} | ```c++
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/self-referencing-lambda %s -verify -emit-obj -o %t2.o
// expected-no-diagnostics
#include "a.h"
```
Update test to mention it requires C++14. | ```c++
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/self-referencing-lambda %s -verify -emit-obj -std=c++14 -o %t2.o
// expected-no-diagnostics
#include "a.h"
``` |
427111f2-4eca-4cae-a9e0-c079e18d9ae2 | {
"language": "C++"
} | ```c++
#include "./labels.h"
#include <vector>
std::function<void()>
Labels::subscribe(std::function<void(Action action, const Label &)> subscriber)
{
int erasePosition = subscribers.size();
subscribers.push_back(subscriber);
return [this, erasePosition]()
{
subscribers.erase(subscribers.begin() + erasePo... | ```c++
#include "./labels.h"
#include <vector>
std::function<void()>
Labels::subscribe(std::function<void(Action action, const Label &)> subscriber)
{
int erasePosition = subscribers.size();
subscribers.push_back(subscriber);
return [this, erasePosition]()
{
subscribers.erase(subscribers.begin() + erasePo... |
0c3d8962-46de-4193-9fdd-062c6eda13be | {
"language": "C++"
} | ```c++
#include "SetOutputPacket.h"
IPOCS::SetOutputPacket::SetOutputPacket()
{
this->RNID_PACKET = 13;
}
IPOCS::Packet* IPOCS::SetOutputPacket::create()
{
return new IPOCS::SetOutputPacket();
}
uint8_t IPOCS::SetOutputPacket::parseSpecific(uint8_t buffer[])
{
this->RQ_OUTPUT_COMMAND = (SetOutputPacket::E_RQ_O... | ```c++
#include "SetOutputPacket.h"
IPOCS::SetOutputPacket::SetOutputPacket()
{
this->RNID_PACKET = 13;
}
IPOCS::Packet* IPOCS::SetOutputPacket::create()
{
return new IPOCS::SetOutputPacket();
}
uint8_t IPOCS::SetOutputPacket::parseSpecific(uint8_t buffer[])
{
this->RQ_OUTPUT_COMMAND = (SetOutputPacket::E_RQ_O... |
64e8ca90-0cf9-4760-a28a-656ff98f36e8 | {
"language": "C++"
} | ```c++
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or library is free software; you can redistribute it
* and/or modify it under... | ```c++
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or library is free software; you can redistribute it
* and/or modify it under... |
b22b1665-029e-48ba-bb65-ced69c174323 | {
"language": "C++"
} | ```c++
/* Copyright (c) 2013-2019 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RotatedHeaderView.h"
#include <QPainter>
using namesp... | ```c++
/* Copyright (c) 2013-2019 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RotatedHeaderView.h"
#include <QPainter>
using namesp... |
59687daa-8718-4a5f-a55c-008b52110ae5 | {
"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 "chromeos/system/devicetype.h"
#include <string>
#include "base/sys_info.h"
namespace chromeos {
namespace {
const char kDeviceType[] ... | ```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 "chromeos/system/devicetype.h"
#include <string>
#include "base/sys_info.h"
namespace chromeos {
namespace {
const char kDeviceType[] ... |
40623aa6-117b-4f85-94c3-998e92376cbf | {
"language": "C++"
} | ```c++
#include "Mocks.hpp"
namespace testing {
enum level : std::uint8_t { debug, info, warn, error };
} // namespace testing
namespace blackhole { namespace sink {
template<>
struct priority_traits<testing::level> {
static inline
priority_t map(testing::level lvl) {
switch (lvl) {
case te... | ```c++
#include "Mocks.hpp"
namespace testing {
enum level : std::uint8_t { debug, info, warn, error };
} // namespace testing
namespace blackhole { namespace sink {
template<>
struct priority_traits<testing::level> {
static inline
priority_t map(testing::level lvl) {
switch (lvl) {
case te... |
08bd2c64-e09d-45e9-b2d1-8823edc34094 | {
"language": "C++"
} | ```c++
#include "devicethread.h"
DeviceThread::DeviceThread()
{
exit = false;
}
void DeviceThread::finish()
{
exit = true;
}
DeviceThread::run()
{
int ret;
while(!exit)
{
if(!board.isConnected())
{
ret = board.attachDevice();
if(ret < 0)
{
//Failed to attach
wait(3... | ```c++
#include "devicethread.h"
DeviceThread::DeviceThread()
{
exit = false;
}
void DeviceThread::finish()
{
exit = true;
}
DeviceThread::run()
{
int ret;
while(!exit)
{
if(!board.isConnected())
{
ret = board.attachDevice();
if(ret < 0)
{
//Failed to attach
wait(3... |
27492533-0578-4c84-9094-e9ecdd0a0e1d | {
"language": "C++"
} | ```c++
// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <sys/mman.h>
#if defined(__FreeBSD__)
// The MAP_NORESERVE define has been removed in FreeBSD 11.x, and even before
// that, it was never implemented. So just define it to zero.
#u... | ```c++
// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <sys/mman.h>
#if defined(__FreeBSD__)
// The MAP_NORESERVE define has been removed in FreeBSD 11.x, and even before
// that, it was never implemented. So just define it to zero.
#u... |
af007733-c1e1-4827-b73d-b5af8ca6a0c5 | {
"language": "C++"
} | ```c++
#include <hal.h>
#include <pwm_config.hpp>
PWMDriver *pwmPlatformInit(void) {
pwmStart(&PWMD8, &motor_pwm_config);
palSetPadMode(GPIOC, 6, PAL_MODE_ALTERNATE(4));
palSetPadMode(GPIOC, 7, PAL_MODE_ALTERNATE(4));
palSetPadMode(GPIOC, 8, PAL_MODE_ALTERNATE(4));
palSetPadMode(GPIOC, 9, PAL_MODE_ALTERNATE... | ```c++
#include <hal.h>
#include <pwm_config.hpp>
PWMDriver *pwmPlatformInit(void) {
pwmStart(&PWMD8, &motor_pwm_config);
palSetPadMode(GPIOC, 6, PAL_MODE_ALTERNATE(4));
palSetPadMode(GPIOC, 7, PAL_MODE_ALTERNATE(4));
palSetPadMode(GPIOC, 8, PAL_MODE_ALTERNATE(4));
palSetPadMode(GPIOC, 9, PAL_MODE_ALTERNATE... |
acab5c87-08c9-4653-b284-4807c717d98b | {
"language": "C++"
} | ```c++
// Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved.
#include "stdafx.h"
#include <autowiring/auto_tuple.h>
#include <string>
class TupleTest:
public testing::Test
{};
TEST_F(TupleTest, CallTest) {
autowiring::tuple<int, int, std::string> t(101, 102, "Hello world!");
ASSERT_EQ(101, autowiri... | ```c++
// Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved.
#include "stdafx.h"
#include <autowiring/auto_tuple.h>
#include <string>
class TupleTest:
public testing::Test
{};
TEST_F(TupleTest, CallTest) {
autowiring::tuple<int, int, std::string> t(101, 102, "Hello world!");
ASSERT_EQ(101, autowiri... |
34945657-42a0-4e40-b252-98e628ad3228 | {
"language": "C++"
} | ```c++
// Tests -fsanitize-coverage=inline-8bit-counters
//
// REQUIRES: has_sancovcc,stable-runtime
// UNSUPPORTED: i386-darwin, x86_64-darwin, x86_64h-darwin
//
// RUN: %clangxx -O0 %s -fsanitize-coverage=inline-8bit-counters 2>&1
#include <stdio.h>
#include <assert.h>
const char *first_counter;
extern "C"
void __... | ```c++
// Tests -fsanitize-coverage=inline-8bit-counters
//
// REQUIRES: has_sancovcc,stable-runtime
// UNSUPPORTED: i386-darwin
//
// RUN: %clangxx -O0 %s -fsanitize-coverage=inline-8bit-counters 2>&1
#include <stdio.h>
#include <assert.h>
const char *first_counter;
extern "C"
void __sanitizer_cov_8bit_counters_ini... |
a26a32be-96d1-4957-9073-41c2148a48c6 | {
"language": "C++"
} | ```c++
// Native C++ Libraries
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
// C++ Interpreter Libraries
#include <Console.h>
#include <Varible.h>
#include <Include.h>
using namespace std;
int main()
{
RESTART:
string input = "";
ConsoleOutCheck(input);
CheckForInt(input);
CheckFor... | ```c++
// Native C++ Libraries
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
// C++ Interpreter Libraries
#include <Console.h>
#include <Varible.h>
#include <Include.h>
using namespace std;
int main()
{
cout << "CPP Interpreter v0.1. Here you can type C++ code in the terminal and get in... |
cc21a053-b0ed-4c92-8ed7-7ed5dc9cd6ba | {
"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.
//
//===---------------------------------... |
17a6d8e7-f3f6-4804-8b7d-02ec9fb6ff80 | {
"language": "C++"
} | ```c++
```
Add tests on sizeof lambdas | ```c++
// Copyright 2017, Dawid Kurek, <dawikur@gmail.com>
#include "lel.hpp"
#include "gtest/gtest.h"
class sizeof_lambdas_test : public ::testing::Test {
protected:
LeL::Placeholder<'x'> _x;
LeL::Placeholder<'y'> _y;
};
TEST_F(sizeof_lambdas_test, base_placeholder_is_1) {
ASSERT_EQ(1, sizeof(_x));
}
TEST_... |
f1f08f87-37d4-4574-84e5-b291b712f88a | {
"language": "C++"
} | ```c++
// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
struct D;
struct B {
virtual D& operator = (const D&);
};
struct D : B { D(); virtual void a(); };
void D::a() {}
// CHECK: @_ZTV1D = {{.*}} @_ZN1DaSERKS_
```
Tweak test to check for a bit more. | ```c++
// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
struct D;
struct B {
virtual D& operator = (const D&);
};
struct D : B { D(); virtual void a(); };
void D::a() {}
// CHECK: @_ZTV1D = {{.*}} @_ZN1DaSERKS_
// CHECK: define linkonce_odr {{.*}} @_ZN1DaSERKS_
``` |
e8538cfe-3b3e-4f0b-98f8-9591748ff215 | {
"language": "C++"
} | ```c++
// RUN: %clang_cl_asan -O0 %s -Fe%t
// RUN: not %run %t 2>&1 | FileCheck %s
#include <stdio.h>
char bigchunk[1 << 30];
int main() {
printf("Hello, world!\n");
scanf("%s", bigchunk);
// CHECK-NOT: Hello, world!
// CHECK: Shadow memory range interleaves with an existing memory mapping.
// CHECK: ASan shadow... | ```c++
// RUN: %clang_cl_asan -O0 %s -Fe%t
// RUN: not %run %t 2>&1 | FileCheck %s
// REQUIRES: asan-32-bits
#include <stdio.h>
char bigchunk[1 << 30];
int main() {
printf("Hello, world!\n");
scanf("%s", bigchunk);
// CHECK-NOT: Hello, world!
// CHECK: Shadow memory range interleaves with an existing memory mapp... |
76af49d9-2859-4dcd-af54-21f79335228c | {
"language": "C++"
} | ```c++
#include <UnitTest++.h>
#include "../src/ToJsonWriter.h"
SUITE(ArticleToJsonWriterTests)
{
TEST(WriteArticleWithoutLinks)
{
ToJsonWriter atj;
Article a("Farm");
CHECK_EQUAL("{\"Farm\":[]}", atj.convertToJson(&a));
}
TEST(WriteArticleWithOneLink)
{
ToJsonWrit... | ```c++
#include <UnitTest++.h>
#include "../src/ToJsonWriter.h"
SUITE(ArticleToJsonWriterTests)
{
TEST(WriteArticleWithoutLinks)
{
ToJsonWriter atj;
Article a("Farm");
CHECK_EQUAL("{\"Farm\":{\"forward_links\":[]}}", atj.convertToJson(&a));
}
TEST(WriteArticleWithOneLink)
... |
a8323dff-522d-4726-8142-101ae3465c1b | {
"language": "C++"
} | ```c++
// Chapter 23, Try This 1: replace 333 in example with 10
#include<iostream>
#include<iomanip>
int main()
{
float x = 1.0/10;
float sum = 0;
for (int i = 0; i<10; ++i) sum += x;
std::cout << std::setprecision(15) << sum << '\n';
}```
Correct typo (23 to 24) | ```c++
// Chapter 24, Try This 1: replace 333 in example with 10
#include<iostream>
#include<iomanip>
int main()
{
float x = 1.0/10;
float sum = 0;
for (int i = 0; i<10; ++i) sum += x;
std::cout << std::setprecision(15) << sum << '\n';
}``` |
2caeac0d-0cf9-45c7-9b83-f6339967df06 | {
"language": "C++"
} | ```c++
/*
* auxiliary.cpp - Auxiliary public functions
*
* Copyright 2010 Jesús Torres <jmtorres@ull.es>
*
* 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.o... | ```c++
/*
* auxiliary.cpp - Auxiliary public functions
*
* Copyright 2010 Jesús Torres <jmtorres@ull.es>
*
* 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.o... |
2408be74-e49f-435b-aa94-b26249fbc496 | {
"language": "C++"
} | ```c++
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkTypes.h"
#if !defined(__has_feature)
#define __has_feature(x) 0
#endif
#if __has_feature(address_sanitizer)
extern "C" {
const char* __lsan_defa... | ```c++
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkTypes.h"
#if !defined(__has_feature)
#define __has_feature(x) 0
#endif
#if __has_feature(address_sanitizer)
extern "C" {
const char* __lsan_defa... |
0885deb9-c858-4af9-b6dc-92b385f94774 | {
"language": "C++"
} | ```c++
Matrix2f M = Matrix2f::Random();
Matrix2f m;
m = M;
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Now we want to replace m by its own transpose." << endl;
cout << "If we do m = m.transpose(), then m becomes:" << endl;
m = m.transpose() * 1;
cout << m << endl << "which is wrong!" << endl;
cout <<... | ```c++
Matrix2f M = Matrix2f::Random();
Matrix2f m;
m = M;
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Now we want to copy a column into a row." << endl;
cout << "If we do m.col(1) = m.row(0), then m becomes:" << endl;
m.col(1) = m.row(0);
cout << m << endl << "which is wrong!" << endl;
cout << "Now ... |
584dc5ab-0cf6-4d31-ab39-6cd1bd426cbb | {
"language": "C++"
} | ```c++
#include "mainwindow.hpp"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setApplicationName("KShare");
a.setOrganizationName("ArsenArsen");
a.setApplicationVersion("1.0");
MainWindow w;
w.show();
return a.exec();
}
```
Add command line opti... | ```c++
#include "mainwindow.hpp"
#include <QApplication>
#include <QCommandLineParser>
#include <QDebug>
#include <stdio.h>
bool verbose = false;
void handler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
QByteArray localMsg = msg.toLocal8Bit();
switch (type)
{
case QtDebugM... |
006a6b3a-e1c7-4d00-acf7-20893bc1c655 | {
"language": "C++"
} | ```c++
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"
#if defined... | ```c++
// Copyright (c) 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 "base/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"
IN_PROC_BRO... |
b99305cf-31c3-4b08-b7a1-8594495a95bb | {
"language": "C++"
} | ```c++
/* Copyright (c) 2013-2014 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "GBAApp.h"
#include "Window.h"
#ifdef QT_STATIC
#includ... | ```c++
/* Copyright (c) 2013-2014 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "GBAApp.h"
#include "Window.h"
#ifdef QT_STATIC
#includ... |
e00f87ed-1cf4-421e-bcb7-f3d4551c1527 | {
"language": "C++"
} | ```c++
#include "OI.h"
#include "Commands/DefaultDrive.h"
#include "Subsystems/Chassis.h"
#include "Misc/ToggleClass.h"
/// Default constructor of the class.
DefaultDrive::DefaultDrive()
{
Requires(Chassis::GetInstance());
shifterToggle = new Toggle<bool>(false, true);
}
/// Called just before this Command runs th... | ```c++
#include "OI.h"
#include "Commands/DefaultDrive.h"
#include "Subsystems/Chassis.h"
#include "Misc/ToggleClass.h"
/// Default constructor of the class.
DefaultDrive::DefaultDrive()
{
Requires(Chassis::GetInstance());
shifterToggle = new Toggle<bool>(false, true);
}
/// Called just before this Command runs th... |
7b41c217-65ea-4811-a3f6-d4bc2b2021f4 | {
"language": "C++"
} | ```c++
//===========================================
// Lumina-DE source code
// Copyright (c) 2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
#include "LHomeButton.h"
#include "../../LSession.h"
#include <LuminaX11.... | ```c++
//===========================================
// Lumina-DE source code
// Copyright (c) 2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
#include "LHomeButton.h"
#include "../../LSession.h"
#include <LuminaX11.... |
aa2a305b-63b3-4047-be4a-f58782cc2ab5 | {
"language": "C++"
} | ```c++
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2013 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#include "BasicListItem.h"
using namespace bb::cascades;
BasicListItem::Basic... | ```c++
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2013 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#include "BasicListItem.h"
using namespace bb::cascades;
BasicListItem::Basic... |
d4d24a8c-8401-4dff-ae66-5df43b526a3a | {
"language": "C++"
} | ```c++
/**
* @file
* sum_two_sales_data.cpp
* @author
* Henrik Samuelsson
*/
#include <iostream>
#include "Sales_item.h"
/**
* @brief
* Reads two sales_item's objects prints the sum.
* @note
* The exercise instructions in the book state that the two objects have
* the same ISBN. It ... | ```c++
/**
* @file
* sum_two_sales_data.cpp
* @author
* Henrik Samuelsson
*/
#include <iostream>
#include "Sales_item.h"
/**
* @brief
* Reads two sales_item's objects and prints the sum.
* @note
* The exercise instructions in the book state that the two objects have
* the same ISBN.... |
8a3be0a0-1143-4804-9369-af7c06387971 | {
"language": "C++"
} | ```c++
#include "../common_includes.h"
#include "blend.h"
using namespace ogles_gpgpu;
const char *BlendProc::fshaderBlendSrc = OG_TO_STR
(
#if defined(OGLES_GPGPU_OPENGLES)
precision highp float;
#endif
varying vec2 textureCoordinate;
varying vec2 textureCoordinate2;
uniform sampler2D inputImageTexture;
unifo... | ```c++
#include "../common_includes.h"
#include "blend.h"
using namespace ogles_gpgpu;
const char *BlendProc::fshaderBlendSrc = OG_TO_STR
(
#if defined(OGLES_GPGPU_OPENGLES)
precision highp float;
#endif
varying vec2 textureCoordinate;
varying vec2 textureCoordinate2;
uniform sampler2D inputImageTexture;
unifo... |
2ffa74e2-d554-4029-81a8-85f678eb816e | {
"language": "C++"
} | ```c++
#include "signal_handlers.h"
#include <cstring>
#include <iostream>
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
namespace keron {
namespace server {
std::atomic_int stop(0);
static BOOL handler(DWORD fdwCtrlType)
{
switch (fdwCtrlType) {
case CTRL_C_EVENT:
case CTRL_CLOSE_EVENT:
std::cout <... | ```c++
#include "signal_handlers.h"
#include <cstring>
#include <iostream>
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
namespace keron {
namespace server {
std::atomic_int stop(0);
static BOOL handler(DWORD fdwCtrlType)
{
switch (fdwCtrlType) {
case CTRL_C_EVENT:
case CTRL_CLOSE_EVENT:
std::cout <... |
05a7ea60-d804-44c3-9c29-ef78923d9259 | {
"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... |
5da458df-835e-4249-8b57-c50b1d4008f0 | {
"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 "ppapi/shared_impl/instance_impl.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_input_event.h"
namespace ppapi {
InstanceI... | ```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 "ppapi/shared_impl/instance_impl.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_input_event.h"
namespace ppapi {
InstanceI... |
7b58547d-ec81-4416-98df-35a26f0b8284 | {
"language": "C++"
} | ```c++
/**
* Appcelerator Titanium - licensed under the Apache Public License 2
* see LICENSE in the root folder for details on the license.
* Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
*/
#include "gst_media_binding.h"
namespace ti
{
GstMediaBinding::GstMediaBinding(SharedKObject global) : MediaB... | ```c++
/**
* Appcelerator Titanium - licensed under the Apache Public License 2
* see LICENSE in the root folder for details on the license.
* Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
*/
#include "gst_media_binding.h"
namespace ti
{
GstMediaBinding::GstMediaBinding(SharedKObject global) : MediaB... |
acaf8642-d7ac-4c24-8851-9212f4a1430f | {
"language": "C++"
} | ```c++
#include "llvm/Testing/Support/SupportHelpers.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "gtest/gtest.h"
using namespace llvm;
using namesp... | ```c++
#include "llvm/Testing/Support/SupportHelpers.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "gtest/gtest.h"
using namespace llvm;
using namesp... |
bf94c4ba-ce4e-46d2-a053-8a39cca1fb38 | {
"language": "C++"
} | ```c++
#include <emscripten/bind.h>
#include "libcellml/parentedentity.h"
using namespace emscripten;
EMSCRIPTEN_BINDINGS(libcellml_parentedentity)
{
class_<libcellml::ParentedEntity, base<libcellml::Entity>>("ParentedEntity")
.smart_ptr<std::shared_ptr<libcellml::ParentedEntity>>("ParentedEntity")
... | ```c++
#include <emscripten/bind.h>
#include "libcellml/parentedentity.h"
using namespace emscripten;
EMSCRIPTEN_BINDINGS(libcellml_parentedentity)
{
class_<libcellml::ParentedEntity, base<libcellml::Entity>>("ParentedEntity")
.smart_ptr<std::shared_ptr<libcellml::ParentedEntity>>("ParentedEntity")
... |
41238986-d408-4ed0-8f11-b6f94825b3e3 | {
"language": "C++"
} | ```c++
// Copyright (c) 2006-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 "views/focus/focus_manager.h"
#include "base/logging.h"
namespace views {
void FocusManager::ClearNativeFocus() {
NOTIMPLEME... | ```c++
// Copyright (c) 2006-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 "views/focus/focus_manager.h"
#include "base/logging.h"
namespace views {
void FocusManager::ClearNativeFocus() {
NOTIMPLEME... |
52eea297-a893-4d40-96ed-247d8e8700e8 | {
"language": "C++"
} | ```c++
```
Add the solution to "Potentate Permutation". | ```c++
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef map< string, vector<string> > Graph;
typedef struct
{
int finish_time;
int visited;
}State;
void dfs(Graph &g, string v, map<string, State*> &state, int &dfs_time)
{
state[v]->visited =... |
5ee2cdb9-d331-4a87-9894-09efc99258ed | {
"language": "C++"
} | ```c++
```
Add test for concurrent groups | ```c++
#include <iostream>
#include <execution_policy>
int main()
{
std::async(std::con(10), [](std::concurrent_group &g)
{
std::cout << "agent " << g.child().index() << " arriving at barrier" << std::endl;
g.wait();
std::cout << "departing barrier" << std::endl;
}).wait();
return 0;
}
``` |
774abf6c-ed6f-4dec-8684-5a11d0c65c33 | {
"language": "C++"
} | ```c++
```
Test explicit specializations of static data members that are declarations, not definitions | ```c++
// RUN: clang-cc -fsyntax-only -verify %s
struct NonDefaultConstructible {
NonDefaultConstructible(const NonDefaultConstructible&);
};
template<typename T, typename U>
struct X {
static T member;
};
template<typename T, typename U>
T X<T, U>::member; // expected-error{{no matching constructor}}
// Okay; ... |
be26015a-5314-4ee7-8ea1-36fc5bcebf21 | {
"language": "C++"
} | ```c++
```
Add huge coroutine test program | ```c++
/*
g++ huge-threads.cpp ../../objs/st/libst.a -g -O0 -DLINUX -o huge-threads && ./huge-threads 32756
*/
#include <stdio.h>
#include <stdlib.h>
#include "../../objs/st/st.h"
void* pfn(void* arg) {
char v[32*1024]; // 32KB in stack.
for (;;) {
v[0] = v[sizeof(v) - 1] = 0xf;
st_usleep(1000 ... |
0bc3978d-3af4-41d7-8df3-fb1bdeebf9e7 | {
"language": "C++"
} | ```c++
/*
* Copyright (c) 2008, Thomas Jaeger <ThJaeger@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED... | ```c++
/*
* Copyright (c) 2008, Thomas Jaeger <ThJaeger@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED... |
7d46f862-fedf-45a9-a2ce-77b3e3ecb1a6 | {
"language": "C++"
} | ```c++
```
Add solution to the second problem | ```c++
#include <iostream>
using namespace std;
struct Destination {
char city[32];
int kilometers;
};
int main() {
Destination plovdiv = { "Plovdiv", 165 }, varna = { "Varna", 469 };
cout << plovdiv.city << " " << plovdiv.kilometers << endl;
cout << varna.city << " " << varna.kilometers << endl;... |
0a94ce0d-9447-4234-a08a-f6a2cbf29ead | {
"language": "C++"
} | ```c++
```
Convert Sorted List to Binary Search Tree | ```c++
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val... |
e214c811-2274-4478-8a17-74d9161eccc2 | {
"language": "C++"
} | ```c++
```
Update to version 0.1.0 Add millisecond resolution | ```c++
#include "ntp-time.h"
NtpTime* ntpTime;
String hhmmss(unsigned long int now) //format value as "hh:mm:ss"
{
String hour = String(Time.hourFormat12(now));
String minute = String::format("%02i",Time.minute(now));
String second = String::format("%02i",Time.second(now));
return hour + ":" + minute + "... |
fa431967-7a53-4799-b760-5f0d36a6d811 | {
"language": "C++"
} | ```c++
```
Add sample for section: Done States | ```c++
// done_states.cpp
#include "hsm/statemachine.h"
using namespace hsm;
class Character
{
public:
Character();
void Update();
// Public to simplify sample
bool mOpenDoor;
private:
friend struct CharacterStates;
StateMachine mStateMachine;
};
struct CharacterStates
{
struct BaseState : StateWithOwner<C... |
af3b22f7-2282-41a4-9c51-7a7c5fc12a1e | {
"language": "C++"
} | ```c++
```
Add more testing for -Wc++0x-compat warnings. | ```c++
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wc++0x-compat -verify %s
namespace N {
template<typename T> void f(T) {} // expected-note {{here}}
namespace M {
template void f<int>(int); // expected-warning {{explicit instantiation of 'N::f' must occur in namespace 'N'}}
}
}
template<typename T> void f... |
64a6a5d2-1110-4cbd-903a-911ca0b3f6de | {
"language": "C++"
} | ```c++
```
Add a test for the TLE -> WA behavior | ```c++
#include <cstdio>
using namespace std;
// Test that if the validator says WA, that's the verdict given even if we
// TLE afterwards (realistically because we tried to read from stdin and didn't
// get a response we expected).
int main(void) {
printf("-1\n");
fflush(stdout);
for (;;);
}
``` |
af6137db-d85f-439e-a5fd-678b3eed311c | {
"language": "C++"
} | ```c++
```
Test for the force platform Type-4. | ```c++
#include <cxxtest/TestDrive.h>
#include "forceplateTest_def.h"
#include <openma/instrument/forceplatetype4.h>
CXXTEST_SUITE(ForcePlateType4Test)
{
CXXTEST_TEST(wrench)
{
ma::instrument::ForcePlateType4 fp("FP");
forceplatetest_fill_sample10_type4(&fp);
forceplatetest_compare_wrench_at_origin(&... |
46c17205-54a1-4235-82c7-ad6aee077ad1 | {
"language": "C++"
} | ```c++
```
Add missing code snippet file | ```c++
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the... |
2a81db44-ba04-46e9-bc03-3ae4d9f99751 | {
"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 "base/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "net/base/mock_host_resolver.h"
// Sometimes ... | ```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 "base/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "net/base/mock_host_resolver.h"
// This test ... |
6a8b915c-f574-4578-b54e-38caed9f6e3c | {
"language": "C++"
} | ```c++
```
Add answer for ITP 1-11 D | ```c++
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
void calcMinkowskiDistance(const int& p, const int& numberOfData, const int* x, const int* y);
void calcChebyshevDistance(const int& numberOfData, const int* x, const int* y);
int main() {
int numberOfData(0);
cin >> numberOfData... |
02c44cf5-6811-4891-be91-43934ec85f10 | {
"language": "C++"
} | ```c++
```
Add a test for NtUserSystemParametersInfo syscall to app_suite | ```c++
/* **********************************************************
* Copyright (c) 2011 Google, Inc. All rights reserved.
* **********************************************************/
/* Dr. Memory: the memory debugger
*
* This library is free software; you can redistribute it and/or
* modify it under t... |
1f451089-36a7-469f-8732-d698e45695fa | {
"language": "C++"
} | ```c++
```
Add solution for chapter 18 test 20 | ```c++
#include <iostream>
using namespace std;
namespace primerLib {
void compute() {
cout << "primerLib::compute()" << endl;
}
// void compute(const void *p) {
// cout << "primerLib::compute(const void *)" << endl;
// }
}
void compute(int i) {
cout << "::compute... |
4de1447d-bdc4-47cc-8b51-6a3e5e44bf7c | {
"language": "C++"
} | ```c++
```
Add solution for chapter 17 test 23 | ```c++
#include <iostream>
#include <regex>
#include <string>
using namespace std;
int main() {
string zipcode("(\\d{5})([-]?\\d{4})?");
regex r(zipcode);
string s;
smatch m;
while(getline(cin, s)) {
if(regex_match(s, m, r)) {
cout << "valid: " << m.str() << endl;
... |
bbee5ff2-db51-400e-ba32-f3da3469c4d8 | {
"language": "C++"
} | ```c++
```
Add the solution to "Preorder perusal". | ```c++
#include <iostream>
#include <string>
using namespace std;
struct Node
{
string s;
Node *left;
Node *right;
};
Node *new_node(string s)
{
Node *temp = new Node();
temp->s = s;
temp->left = NULL;
temp->right = NULL;
return temp;
}
bool add_edge(Node *root, Node *father, Node *child)
{
if (root == NULL... |
241ea42d-aa0b-47b4-84a6-66ff643180b9 | {
"language": "C++"
} | ```c++
```
Add solution to the Person with a dog problem | ```c++
#include <iostream>
#include <string>
using namespace std;
class Dog {
string name;
public:
Dog(string _name = "") {
name = _name;
}
void greet() {
cout << "Bark, bark! I am " << name << ", a talking dog." << endl;
}
};
class Person {
string name;
int age;
Dog d... |
9b984016-e2b0-4e8e-89cc-f1c671da2de0 | {
"language": "C++"
} | ```c++
```
Add an Fibonacci example to show the usage of AddTask. | ```c++
#include "FixedThreadPool.h"
#include <iostream>
using namespace std;
using namespace tpool;
void InputPrompt(const unsigned int cnt)
{
cout << "[" << cnt << "] In: ";
}
unsigned int GetFibonacciNumber(const unsigned int i)
{
if (i < 2)
{
return i;
}
else
{
return GetFibonacciNum... |
0a1cdabe-8bec-4a86-a6e8-9964d9af87f9 | {
"language": "C++"
} | ```c++
```
Add prim test for mdivide_left_tri_low | ```c++
#include <stan/math/prim.hpp>
#include <test/unit/math/prim/fun/expect_matrix_eq.hpp>
#include <gtest/gtest.h>
#define EXPECT_MATRIX_NEAR(A, B, DELTA) \
for (int i = 0; i < A.size(); i++) \
EXPECT_NEAR(A(i), B(i), DELTA);
TEST(MathMatrixPrim, mdivide_left_tri_low_val) {
using stan::math::mdivide_lef... |
665d90f9-f4e6-4ad9-8f56-77179ac49c6e | {
"language": "C++"
} | ```c++
// Copyright 2014 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/renderer/media/media_stream_audio_source.h"
namespace content {
MediaStreamAudioSource::MediaStreamAudioSource(
int render_... | ```c++
// Copyright 2014 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/renderer/media/media_stream_audio_source.h"
namespace content {
MediaStreamAudioSource::MediaStreamAudioSource(
int render_... |
7c046fd9-9b59-4b98-addc-b7aa94cf7ade | {
"language": "C++"
} | ```c++
```
Add Sound unit testing source. | ```c++
#include "catch.hpp"
#include <iostream>
#include <string>
#include "audio/Sound.h"
const std::string sound_file = "sound.wav";
TEST_CASE("Initial value(s) in Sound", "[Sound]")
{
Sound* sound = new Sound();
// volume should be at max
CHECK(sound->get_volume() == 100);
delete sound;
}
TEST_CASE("Openin... |
15f85893-6ed6-496c-94a0-a5bba1b7d4ad | {
"language": "C++"
} | ```c++
```
Implement Graph using Adjacency Matrix | ```c++
#include <iostream>
#include<stdlib.h>
#include <string.h>
using namespace std;
struct Graph {
int V,E;
int **adj;
};
Graph* createGraph(int V, int E) {
Graph *G = new Graph();
if (!G) return NULL;
G->V = V;
G->E = E;
G->adj = new int*[G->V]; //row count
for (int i = 0; i < G-... |
2036973e-d8ed-4cc5-9a5c-a8da84a332b1 | {
"language": "C++"
} | ```c++
```
Add testing file to check output for declaration scopes. | ```c++
class global {
};
namespace n {
void external_func() {
class floating_func {
};
}
enum normal_enum {};
enum class class_enum{};
struct str_test {};
namespace m {
class in_namespace {
class in_class {
};
void main() {
... |
82cbb39f-c66d-4c55-893b-d454b6c01e05 | {
"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 "content/renderer/gpu/delegated_compositor_output_surface.h"
namespace content {
DelegatedCompositorOutputSurface::DelegatedCompositorOu... | ```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 "content/renderer/gpu/delegated_compositor_output_surface.h"
namespace content {
DelegatedCompositorOutputSurface::DelegatedCompositorOu... |
cc1732ea-18e1-4369-b838-a6519b425817 | {
"language": "C++"
} | ```c++
```
Add a trivial test for EventHandler | ```c++
#include "mbed.h"
#include "EventHandler.h"
class VTest {
public:
int vprint(void *arg) {
if (arg) {
int* i = static_cast<int *>(arg);
printf("Class Print Integer: %d from %p\r\n", *i, arg);
} else {
printf("Class Null Arg\r\n");
}
return (... |
c8b8fa63-65e5-42f3-9bb3-35b84d22bf39 | {
"language": "C++"
} | ```c++
```
Add code for regular expresions in c++. | ```c++
#include <iostream>
#include <iterator>
#include <regex>
#include <string>
using namespace std;
int main(){
string s = "123daniel , jajaja, lol, 234234534, I am from Earth";
regex tel("\\d{8},\\sI");
auto words_begin = sregex_iterator(s.begin(), s.end(), tel);
auto words_end = sregex_iterator... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.