doc_id stringlengths 36 36 | metadata dict | input stringlengths 28 4.3k | output stringlengths 11 5.45k |
|---|---|---|---|
66b6b227-bf0d-4d2b-af0f-0d7b10902f9d | {
"language": "C++"
} | ```c++
#include "Arduino.h"
#include "LightModel.h"
const byte LightModel::RED_ON = 0x1;
const byte LightModel::AMBER_ON = 0x2;
const byte LightModel::GREEN_ON = 0x4;
LightModel::LightModel()
: state(0)
{
}
// typical AMBER light is 5 seconds
void LightModel::setup()
{
// Set digital pins 3, 4, and 5 to be out... | ```c++
#include "Arduino.h"
#include "LightModel.h"
const byte LightModel::RED_ON = 0x1;
const byte LightModel::AMBER_ON = 0x2;
const byte LightModel::GREEN_ON = 0x4;
LightModel::LightModel()
: state(0)
{
}
// typical AMBER light is 5 seconds
void LightModel::setup()
{
// Set digital pins 4, 5, 6, and 7 to be ... |
70f2de25-cfac-4e24-8dc7-e0a6579d9cd0 | {
"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 "base/test/test_suite.h"
#include "media/base/media.h"
int main(int argc, char** argv) {
base::TestSuite suite(argc, argv);
medi... | ```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/at_exit.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/test/test_suite.h"
#include "media/base/media... |
814f37e5-f542-4693-b040-89f84492bc97 | {
"language": "C++"
} | ```c++
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//These things are used by QSettings to set up setting storage
a.setOrganizationName("EVTV");
a.setApplicationName("SavvyCAN");
a.setOrganizationDomain("evtv.me");
QSettings::s... | ```c++
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//Add a local path for Qt extensions, to allow for per-application extensions.
a.addLibraryPath("plugins");
//These things are used by QSettings to set up setting storage
a.setOrg... |
623b0844-d41b-497e-822f-5b32f71b2b65 | {
"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"
#if defined(OS_LINUX)
// See http://crbug.com/42943.
#define MAYBE_Storage FLAKY_Stor... |
1e0387e6-46e2-4a1e-bfff-292109c96fa8 | {
"language": "C++"
} | ```c++
/*
* opencog/atoms/core/Checkers.cc
*
* Copyright (C) 2017 Linas Vepstas
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License v3 as
* published by the Free Software Foundation and including the excepti... | ```c++
/*
* opencog/atoms/core/Checkers.cc
*
* Copyright (C) 2017 Linas Vepstas
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License v3 as
* published by the Free Software Foundation and including the excepti... |
8c8ee07d-2664-43fc-9a81-677740ede2eb | {
"language": "C++"
} | ```c++
#pragma once
#include "CylindersWrapperCodec.h"
namespace spotify
{
namespace json
{
using CylindersWrapper = noise::module::Wrapper<noise::module::Cylinders>;
codec::object_t<CylindersWrapper> default_codec_t<CylindersWrapper>::codec()
{
auto codec = codec::object<CylindersWrapper>();
co... | ```c++
#pragma once
#include "CylindersWrapperCodec.h"
namespace spotify
{
namespace json
{
using CylindersWrapper = noise::module::Wrapper<noise::module::Cylinders>;
codec::object_t<CylindersWrapper> default_codec_t<CylindersWrapper>::codec()
{
auto codec = codec::object<CylindersWrapper>();
co... |
bef7d2c9-743f-4e2e-bca7-086349ef736e | {
"language": "C++"
} | ```c++
//=======================================================================
// Copyright Baptiste Wicht 2011.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//==============================================... | ```c++
//=======================================================================
// Copyright Baptiste Wicht 2011.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//==============================================... |
6d102cc2-e74f-4996-9188-d513dface0b4 | {
"language": "C++"
} | ```c++
//===-- llvm/CodeGen/DwarfWriter.cpp - Dwarf Framework ----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===-----------... | ```c++
//===-- llvm/CodeGen/DwarfWriter.cpp - Dwarf Framework ----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===-----------... |
910eff96-43c7-479c-8541-0b261288b129 | {
"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
//
//===--------------------... |
571dff11-a716-49aa-bb45-c8a54a70823a | {
"language": "C++"
} | ```c++
#include "./video_recorder_controller.h"
#include <QDateTime>
#include "./video_recorder.h"
VideoRecorderController::VideoRecorderController(
std::shared_ptr<VideoRecorder> videoRecorder)
: videoRecorder(videoRecorder)
{
connect(this, SIGNAL(toggleRecording()), this,
SLOT(toggleRecordingInMain... | ```c++
#include "./video_recorder_controller.h"
#include <QDateTime>
#include "./video_recorder.h"
VideoRecorderController::VideoRecorderController(
std::shared_ptr<VideoRecorder> videoRecorder)
: videoRecorder(videoRecorder)
{
connect(this, SIGNAL(toggleRecording()), this,
SLOT(toggleRecordingInMain... |
a59c3473-0429-4b52-a20f-9eda020b37fd | {
"language": "C++"
} | ```c++
/*
* Copyright 2011 Intel Corporation.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*/
#include <glib-object.h>
#include <QDir>
#include "components.h"
#include "la... | ```c++
/*
* Copyright 2011 Intel Corporation.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*/
#include <glib-object.h>
#include <QDir>
#include "components.h"
#include "la... |
80a6fdfe-99d6-4e14-88cb-42310d7264fc | {
"language": "C++"
} | ```c++
#include <QApplication>
#include "gtest/gtest.h"
int main(int argc, char** argv)
{
QApplication app(argc, argv);
::testing::InitGoogleTest(&argc, argv);
int returnValue = RUN_ALL_TESTS();
return returnValue;
}
```
Use QCoreApplication for unit tests as it should not depend on GUI stuff. | ```c++
#include <QCoreApplication>
#include "gtest/gtest.h"
int main(int argc, char** argv)
{
QCoreApplication app(argc, argv);
::testing::InitGoogleTest(&argc, argv);
int returnValue = RUN_ALL_TESTS();
return returnValue;
}
``` |
2d3585b3-2e70-415f-973d-6053999d2521 | {
"language": "C++"
} | ```c++
#include<iostream>
using namespace std;
int removeElement(int A[], int n, int elem) {
int length = n-1;
for(int i = 0; i <= length; ++i) {
if(A[i] == elem) {
while (A[length] != elem) {
length--;
}
A[i] = A[length--];
}
}
retu... | ```c++
#include<iostream>
using namespace std;
int removeElement(int A[], int n, int elem) {
if (n == 0) {
return n;
}
if (n == 1 && A[0] == elem) {
return 0;
}
if (n == 1 && A[0] != elem) {
return n;
}
int tail = n - 1;
int i = 0;
while (i <= tail) {
... |
d4191638-ea44-40a9-b65a-e225db3295a6 | {
"language": "C++"
} | ```c++
// Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... | ```c++
// Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... |
2a479894-b5e9-46be-ad87-d6300e02462e | {
"language": "C++"
} | ```c++
#include <unistd.h>
#include <gtest/gtest.h>
#include "getusername.h"
TEST(GetUserName,simple)
{
// allocate a WCHAR_T buffer to receive username
DWORD lpnSize = 64;
WCHAR_T lpBuffer[lpnSize];
BOOL result = GetUserName(lpBuffer, &lpnSize);
// GetUserName returns 1 on success
ASSERT_EQ(1, result);
// g... | ```c++
#include <string>
#include <vector>
#include <unistd.h>
#include <gtest/gtest.h>
#include <scxcorelib/scxstrencodingconv.h>
#include "getusername.h"
using std::string;
using std::vector;
using SCXCoreLib::Utf16leToUtf8;
TEST(GetUserName,simple)
{
// allocate a WCHAR_T buffer to receive username
DWORD lpnSize... |
eeb3cac6-f274-4542-9ca0-0d76260589d1 | {
"language": "C++"
} | ```c++
/**
* \file bs_log_scribers.cpp
* \brief
* \author Sergey Miryanov
* \date 07.07.2009
* */
#include "bs_log_scribers.h"
using namespace std;
namespace blue_sky {
namespace log {
namespace detail {
void cout_scriber::write(const std::string &str) const {
//#ifdef _DEBUG
// TODO: miryanov
static b... | ```c++
/**
* \file bs_log_scribers.cpp
* \brief
* \author Sergey Miryanov
* \date 07.07.2009
* */
#include "bs_log_scribers.h"
using namespace std;
namespace blue_sky {
namespace log {
namespace detail {
void cout_scriber::write(const std::string &str) const {
#ifndef _DEBUG
static bool is_buffer_installed... |
625392ee-39bf-4b75-b602-08185fb12e87 | {
"language": "C++"
} | ```c++
#include "prng_user.hpp"
PrngUser::PrngUser(std::shared_ptr<std::mt19937> generator)
: generator_{generator}
{
}
std::shared_ptr<std::mt19937> PrngUser::getGenerator() const
{
return generator_;
}
void PrngUser::setGenerator(std::shared_ptr<std::mt19937> generator)
{
generator_ = generator;
}
```
Add a m... | ```c++
/* Copyright 2014 Juhani Numminen
*
* 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 agr... |
59b3e76f-3165-480e-92a6-a785ea7fd508 | {
"language": "C++"
} | ```c++
#include "net/resolver.h"
#include <string>
#include <gtest/gtest.h>
using namespace net;
TEST(LookupAddress, Localhost) {
{
std::string addr;
error err = LookupAddress("localhost", &addr);
EXPECT_EQ(error::nil, err);
EXPECT_EQ("127.0.0.1", addr);
}
{
std::st... | ```c++
#include "net/resolver.h"
#include <string>
#include <gtest/gtest.h>
using namespace net;
TEST(LookupAddress, Localhost) {
std::string addr;
error err = LookupAddress("localhost", &addr);
EXPECT_EQ(error::nil, err);
EXPECT_EQ("127.0.0.1", addr);
}
TEST(LookupAddress, LocalIPv4) {
std::str... |
5bf1a729-7286-4e73-8df3-a1bd90270ead | {
"language": "C++"
} | ```c++
#include <string>
#include <vector>
#include <map>
#include <iostream>
#include <qitype/signature.hpp>
//sample foo function to take the signature from
int foo(int a, int b)
{
return a + b + 42;
}
int main()
{
typedef std::map<std::string , std::string> StringMap;
typedef std::vector<int> ... | ```c++
#include <string>
#include <vector>
#include <map>
#include <iostream>
#include <qitype/signature.hpp>
//sample foo function to take the signature from
int foo(int a, int b)
{
return a + b + 42;
}
int main()
{
typedef std::map<std::string , std::string> StringMap;
typedef std::vector<int> ... |
41913701-321b-4b79-a5b0-89c04bfda8a0 | {
"language": "C++"
} | ```c++
/*
* Copyright (C) 2015 Cloudius Systems, Ltd.
*/
#include <unordered_map>
#include "unimplemented.hh"
#include "core/sstring.hh"
#include "core/enum.hh"
namespace unimplemented {
static std::unordered_map<cause, bool> _warnings;
std::ostream& operator<<(std::ostream& out, cause c) {
switch(c) {
... | ```c++
/*
* Copyright (C) 2015 Cloudius Systems, Ltd.
*/
#include <unordered_map>
#include "unimplemented.hh"
#include "core/sstring.hh"
#include "core/enum.hh"
namespace unimplemented {
static thread_local std::unordered_map<cause, bool> _warnings;
std::ostream& operator<<(std::ostream& out, cause c) {
switc... |
6b7cfa67-88a4-4d69-8619-2eccb2f1d9e9 | {
"language": "C++"
} | ```c++
/* localsearch.cpp
Ian Westrope
Evolutionary Computation
Spring 2015
*/
#include <iostream>
#include <cstdlib>
#include "bitHelpers.h"
#include "rand.h"
using namespace std;
int main() {
cout << "Test makefile" << endl;
}
```
Add command line argument support | ```c++
/* localsearch.cpp
Ian Westrope
Evolutionary Computation
Spring 2015
*/
#include <iostream>
#include <cstdlib>
#include "bitHelpers.h"
#include "rand.h"
using namespace std;
int main( int argc, char* argv[] ) {
// variables for command line arguments
int grayFlag = 0; // Gray code
int b... |
e2cb7d89-0470-4f6a-8429-e5bf31d00298 | {
"language": "C++"
} | ```c++
#include "zg01_fsm.h"
// max time between ZG01 bits, until a new frame is assumed to have started
#define ZG01_MAX_MS 3
// all of the state of the FSM
typedef struct {
uint8_t *buffer;
int num_bits;
int prev_ms;
} fsm_t;
static fsm_t fsm;
static fsm_t *s = &fsm;
// resets the FSM
static void fsm... | ```c++
#include "zg01_fsm.h"
// max time between ZG01 bits, until a new frame is assumed to have started
#define ZG01_MAX_MS 3
// all of the state of the FSM
typedef struct {
uint8_t *buffer;
int num_bits;
unsigned long prev_ms;
} fsm_t;
static fsm_t fsm;
static fsm_t *s = &fsm;
// resets the FSM
stati... |
ae4bdb22-e8b9-4c47-9030-9dc0bccd327b | {
"language": "C++"
} | ```c++
// ===============================
// Slots for long running Library Tasks
// Available under the 3-clause BSD License
// Written by: Kris Moore <kris@pcbsd.org> FEB 2016
// =================================
#include <WebSocket.h>
#define DEBUG 0
// Iohyve Fetch is done
void WebSocket::slotIohyveFetchDone(QStr... | ```c++
// ===============================
// Slots for long running Library Tasks
// Available under the 3-clause BSD License
// Written by: Kris Moore <kris@pcbsd.org> FEB 2016
// =================================
#include <WebSocket.h>
#define DEBUG 0
// Iohyve Fetch is done
void WebSocket::slotIohyveFetchDone(QStr... |
28338675-69a8-4b60-819f-83fc90cb6c24 | {
"language": "C++"
} | ```c++
#include <string>
#include "grcrestarter.h"
// Old VB based NeuralNet.
double qtPushGridcoinDiagnosticData(std::string data);
int RestartClient();
bool CheckForUpgrade();
void UpgradeClient();
int DownloadBlocks();
int ReindexWallet();
int CreateRestorePoint();
// While transitioning to dotnet the NeuralNet imp... | ```c++
#include <string>
#include "grcrestarter.h"
// Old VB based NeuralNet.
double qtPushGridcoinDiagnosticData(std::string data);
int RestartClient();
bool CheckForUpgrade();
void UpgradeClient();
int DownloadBlocks();
int ReindexWallet();
int CreateRestorePoint();
// While transitioning to dotnet the NeuralNet imp... |
ac1ea857-eeec-4ff9-92df-eb3c49da4244 | {
"language": "C++"
} | ```c++
/*
This file is part of VROOM.
Copyright (c) 2015-2022, Julien Coupey.
All rights reserved (see LICENSE).
*/
#include "structures/vroom/break.h"
#include "utils/helpers.h"
namespace vroom {
Break::Break(Id id,
const std::vector<TimeWindow>& tws,
Duration service,
cons... | ```c++
/*
This file is part of VROOM.
Copyright (c) 2015-2022, Julien Coupey.
All rights reserved (see LICENSE).
*/
#include "structures/vroom/break.h"
#include "utils/helpers.h"
namespace vroom {
Break::Break(Id id,
const std::vector<TimeWindow>& tws,
Duration service,
cons... |
24152723-68c2-457d-b5f0-a4cd3be123a0 | {
"language": "C++"
} | ```c++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- vim:set ts=4 sw=4 sts=4 noet: */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include "csv/export.h"
using namespace flint;
namespace {
void usage()
{
s... | ```c++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- vim:set ts=4 sw=4 sts=4 noet: */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include "csv/export.h"
using namespace flint;
namespace {
void usage()
{
s... |
d62ef314-374e-4160-ac64-9bce3dff7e7f | {
"language": "C++"
} | ```c++
/*
This file is part of Groho, a simulator for inter-planetary travel and warfare.
Copyright (c) 2020 by Kaushik Ghose. Some rights reserved, see LICENSE
*/
#include <exception>
#include <string>
#include "serialize.hpp"
namespace groho {
Serialize::Serialize(
double dt, const std::vector<NAIFbody>& obje... | ```c++
/*
This file is part of Groho, a simulator for inter-planetary travel and warfare.
Copyright (c) 2020 by Kaushik Ghose. Some rights reserved, see LICENSE
*/
#include <exception>
#include <string>
#include "serialize.hpp"
namespace groho {
Serialize::Serialize(
double dt, const std::vector<NAIFbody>& obje... |
3a81555a-d4c3-42fa-ab81-50153d6e0196 | {
"language": "C++"
} | ```c++
#include <system/Locale.h>
#if defined(HX_WINDOWS)
#include <windows.h>
#elif defined(HX_LINUX)
#include <stdlib.h>
#include <string.h>
#include <clocale>
#endif
namespace lime {
std::string* Locale::GetSystemLocale () {
#if defined(HX_WINDOWS)
char locale[8];
int length = GetLocaleInfo (GetS... | ```c++
#include <system/Locale.h>
#if defined(HX_WINDOWS)
#include <windows.h>
#elif defined(HX_LINUX)
#include <stdlib.h>
#include <string.h>
#include <clocale>
#endif
namespace lime {
std::string* Locale::GetSystemLocale () {
#if defined(HX_WINDOWS)
char language[5] = {0};
char country[5] = {0};
... |
9ad85a0b-ef51-43e9-9d8b-34f4849fac2e | {
"language": "C++"
} | ```c++
// Copyright 2010-2014 RethinkDB, all rights reserved.
#include "unittest/gtest.hpp"
#include "arch/timing.hpp"
#include "concurrency/pmap.hpp"
#include "unittest/unittest_utils.hpp"
#include "utils.hpp"
namespace unittest {
int wait_array[2][10] = { { 1, 1, 2, 3, 5, 13, 20, 30, 40, 8 },
... | ```c++
// Copyright 2010-2014 RethinkDB, all rights reserved.
#include "unittest/gtest.hpp"
#include "arch/timing.hpp"
#include "concurrency/pmap.hpp"
#include "unittest/unittest_utils.hpp"
#include "utils.hpp"
namespace unittest {
int wait_array[2][10] = { { 1, 1, 2, 3, 5, 13, 20, 30, 40, 8 },
... |
f26cbf09-213c-46b3-b342-1ce4afea3e74 | {
"language": "C++"
} | ```c++
#include <QTest>
#include <QObject>
#include "uritests.h"
// This is all you need to run all the tests
int main(int argc, char *argv[])
{
URITests test1;
QTest::qExec(&test1);
}
```
Return !0 when qt tests fail. | ```c++
#include <QTest>
#include <QObject>
#include "uritests.h"
// This is all you need to run all the tests
int main(int argc, char *argv[])
{
bool fInvalid = false;
URITests test1;
if (QTest::qExec(&test1) != 0)
fInvalid = true;
return fInvalid;
}
``` |
a29a8284-5dab-49fa-a7f1-4f271ea6f862 | {
"language": "C++"
} | ```c++
#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <windows.h>
#include <vector>
#include "flutter_window.h"
#include "run_loop.h"
#include "window_configuration.h"
int APIENTRY wWinMain(_In_ HINSTANCE instance,
_In_opt_ HINSTANCE prev,
... | ```c++
#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <windows.h>
#include <vector>
#include "flutter_window.h"
#include "run_loop.h"
#include "window_configuration.h"
int APIENTRY wWinMain(_In_ HINSTANCE instance,
_In_opt_ HINSTANCE prev,
... |
0fb4948a-beae-4348-9e59-c67a0b7e7a87 | {
"language": "C++"
} | ```c++
#ifdef _WINDOWS
/*
* NOTE: Some macros must be defined in project options of Visual Studio.
* - _CRT_SECURE_NO_WARNINGS
* To use strncpy().
* - NOMINMAX
* To use std::min(), std::max().
*/
#include <windows.h>
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, L... | ```c++
#ifdef _WINDOWS
/*
* NOTE: Some macros must be defined in project options of Visual Studio.
* - _CRT_SECURE_NO_WARNINGS
* To use strncpy().
* - NOMINMAX
* To use std::min(), std::max().
* NOTE: Suppress some warnings of Visual Studio.
* - C4251
*/
#include <windows.h>
... |
6edfe87f-c14f-40b0-ae5e-169f38c2f918 | {
"language": "C++"
} | ```c++
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/shell/shell_content_client.h"
#include "base/string_piece.h"
namespace content {
ShellContentClient::~ShellContentClient()... | ```c++
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/shell/shell_content_client.h"
#include "base/string_piece.h"
#include "webkit/glue/user_agent.h"
namespace content {
Shell... |
6240d281-3874-435d-85a3-24b3f065ff44 | {
"language": "C++"
} | ```c++
#include "pdfium_ruby.h"
void Init_pdfium_ruby (void) {
VALUE rb_PDFium = rb_define_module("PDFium");
// Define `Document` and `Page` classes
Define_Document();
Define_Page();
Define_PageSet();
}
```
Fix main file's init function for C++, and comment out unimplemented functions. | ```c++
#include "pdfium_ruby.h"
extern "C"
void Init_pdfium_ruby (void) {
// Define `PDFium` module as a namespace for all of our other objects
VALUE rb_PDFium = rb_define_module("PDFium");
// Define `Document` and `Page` classes
Define_Document();
//Define_Page();
//Define_PageSet();
}
``` |
ad132e42-141f-4268-ab28-2bfc1a00fe44 | {
"language": "C++"
} | ```c++
// Copyright (c) 2016-2020 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <bench/data.h>
#include <rpc/blockchain.h>
#include <streams.h>
#include <test/util... | ```c++
// Copyright (c) 2016-2020 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <bench/data.h>
#include <rpc/blockchain.h>
#include <streams.h>
#include <test/util... |
21068f5f-2a9f-425e-b72a-c682e16d24fa | {
"language": "C++"
} | ```c++
#include "theme-loader.h"
#include <QApplication>
#include <QDir>
#include <QFile>
ThemeLoader::ThemeLoader(QString path, QObject *parent)
: QObject(parent), m_path(std::move(path))
{
connect(&m_watcher, &QFileSystemWatcher::fileChanged, this, &ThemeLoader::themeFileChanged);
}
QStringList ThemeLoader::getA... | ```c++
#include "theme-loader.h"
#include <QApplication>
#include <QDir>
#include <QFile>
ThemeLoader::ThemeLoader(QString path, QObject *parent)
: QObject(parent), m_path(std::move(path))
{
connect(&m_watcher, &QFileSystemWatcher::fileChanged, this, &ThemeLoader::themeFileChanged);
}
QStringList ThemeLoader::getA... |
a44cb449-8a5d-49f2-bfc2-a639659d5937 | {
"language": "C++"
} | ```c++
#include "Rndm.h"
using namespace std;
Rndm::Rndm() : _mt(_rd())
{
}
Rndm & Rndm::rndm()
{
static Rndm rndm;
return rndm;
}
std::mt19937 & Rndm::mt()
{
return Rndm::rndm()._mt;
}
int Rndm::number(int from, int to)
{
uniform_int_distribution<int> num(from, to);
return num(Rndm::mt());
}
```
Remove use... | ```c++
#include "Rndm.h"
Rndm::Rndm() : _mt(_rd())
{
}
Rndm & Rndm::rndm()
{
static Rndm rndm;
return rndm;
}
std::mt19937 & Rndm::mt()
{
return Rndm::rndm()._mt;
}
int Rndm::number(int from, int to)
{
std::uniform_int_distribution<int> num(from, to);
return num(Rndm::mt());
}
``` |
6ef258c9-bd4b-4ff4-8fd1-7097dab75183 | {
"language": "C++"
} | ```c++
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/node_debugger.h"
#include "base/command_line.h"
#include "libplatform/libplatform.h"
namespace atom {
NodeDebugger::NodeDebugger(node::Environment* env... | ```c++
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/node_debugger.h"
#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
#include "libplatform/libplatform.h"
namespace atom {
... |
34dd9482-f718-47fd-b9d4-37433d4e4317 | {
"language": "C++"
} | ```c++
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); y... | ```c++
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); y... |
47f95130-aa36-44b0-8f61-a8b20910e119 | {
"language": "C++"
} | ```c++
#include "threadpool.h"
ThreadPool::ThreadPool(size_t size)
{
for (auto i=0; i<size; ++i) {
workers.emplace_back([this] {
for (;;) {
std::unique_lock<std::mutex> lock(this->queue_mutex);
while (!this->m_stop && this->tasks.empty())
this... | ```c++
#include "threadpool.h"
ThreadPool::ThreadPool(size_t size)
{
for (size_t i=0; i<size; ++i) {
workers.emplace_back([this] {
for (;;) {
std::unique_lock<std::mutex> lock(this->queue_mutex);
while (!this->m_stop && this->tasks.empty())
th... |
b2ba4d79-d674-4948-93a8-4387bd522a58 | {
"language": "C++"
} | ```c++
#include "Sensor/UltrasoundSensor.h"
#include "Data/UltrasoundData.h"
UltrasoundSensor::UltrasoundSensor(string port, int baudrate) : Sensor("Ultrasound Sensor"), conn(std::make_shared<SerialPort>(port, baudrate)) {
}
UltrasoundSensor::~UltrasoundSensor() {
}
bool UltrasoundSensor::ping() {
return conn->isCo... | ```c++
#include "Sensor/UltrasoundSensor.h"
#include "Data/UltrasoundData.h"
UltrasoundSensor::UltrasoundSensor(string port, int baudrate) : Sensor("Ultrasound Sensor"), conn(std::make_shared<SerialPort>(port, baudrate)) {
}
UltrasoundSensor::~UltrasoundSensor() {
}
bool UltrasoundSensor::ping() {
return conn->isCo... |
5702e604-9687-4d1e-9217-0b2c0c02c83f | {
"language": "C++"
} | ```c++
/*
* File.cpp
*
* Created on: Jun 24, 2015
* Author: gatanasov
*/
#include "File.h"
#include <sstream>
using namespace std;
namespace tns
{
string File::ReadText(const string& filePath)
{
int len;
bool isNew;
const char *content = ReadText(filePath, len, isNew);
string s(content, len);
... | ```c++
/*
* File.cpp
*
* Created on: Jun 24, 2015
* Author: gatanasov
*/
#include "File.h"
#include <sstream>
using namespace std;
namespace tns
{
string File::ReadText(const string& filePath)
{
int len;
bool isNew;
const char *content = ReadText(filePath, len, isNew);
string s(content, len);
... |
a11ed57e-4a18-4705-9a98-d82a07d24ded | {
"language": "C++"
} | ```c++
#include <memory>
#include <miniMAT/checker/Checker.hpp>
#include <iostream>
namespace miniMAT {
namespace checker {
Checker::Checker(std::shared_ptr<std::map<std::string, Matrix>> vars,
std::shared_ptr<reporter::ErrorReporter> reporter) {
this->vars = vars;
... | ```c++
#include <memory>
#include <miniMAT/checker/Checker.hpp>
#include <iostream>
namespace miniMAT {
namespace checker {
Checker::Checker(std::shared_ptr<std::map<std::string, Matrix>> vars,
std::shared_ptr<reporter::ErrorReporter> reporter) {
this->vars = vars;
... |
bd12e8ce-8845-42c9-a6f5-91fe079cde2b | {
"language": "C++"
} | ```c++
#include <iostream>
#include "server.h"
Server::Server(unsigned short port) {
// logging settings
bottleserve.set_access_channels(websocketpp::log::alevel::all);
bottleserve.clear_access_channels(websocketpp::log::alevel::frame_payload);
bottleserve.init_asio();
bottleserve.set_message_handler([this] (w... | ```c++
#include <iostream>
#include <sstream>
#include "server.h"
using namespace std;
/*
* Splits a string based on a delimiter character
*
* Won't split into more than 'max' strings. Returns the number of strings that were added
*/
template<typename Iter>
size_t split(const string& str, char val, size_t max, I... |
c397b240-c53c-48e4-933f-5b9b6a7aa26e | {
"language": "C++"
} | ```c++
// RUN: %clang_cc1 -fsyntax-only -std=c++0x -Wc++98-compat -verify %s
template<typename ...T> // expected-warning {{variadic templates are incompatible with C++98}}
class Variadic1 {};
template<template<typename> class ...T> // expected-warning {{variadic templates are incompatible with C++98}}
class Variadi... | ```c++
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat -verify %s
template<typename ...T> // expected-warning {{variadic templates are incompatible with C++98}}
class Variadic1 {};
template<template<typename> class ...T> // expected-warning {{variadic templates are incompatible with C++98}}
class Variadi... |
31a66fa5-b7ea-4295-9f7d-cba404cabe5d | {
"language": "C++"
} | ```c++
#include "libbbn-ni-r.h"
//global to hold on to session handle
NiFpga_Session session;
bool isOpen = false;
//Initialize FPGA on loading the library -- constructor hook in header
void init() {
NiFpga_Status status = NiFpga_Initialize();
}
//Cleanup NI library -- destructor hook in header
void cleanup(){
i... | ```c++
#include "libbbn-ni-r.h"
//global to hold on to session handle
NiFpga_Session session;
bool isOpen = false;
//Initialize FPGA on loading the library -- constructor hook in header
void init() {
NiFpga_Status status = NiFpga_Initialize();
}
//Cleanup NI library -- destructor hook in header
void cleanup(){
i... |
1a426781-0f02-4b61-bc9f-d10dc58bf630 | {
"language": "C++"
} | ```c++
#include "PlainPrinter.h"
PlainPrinterAction::PlainPrinterAction(const llvm::StringRef &filename) :
ASTAction<PlainPrinterAction>() {
OutputFile = std::make_shared<std::fstream>();
OutputFile->open(filename, std::fstream::out);
}
PlainPrinterAction::~PlainPrinterAction() {
OutputFile->close();
}
std::... | ```c++
#include "PlainPrinter.h"
PlainPrinterAction::PlainPrinterAction(const llvm::StringRef &filename) :
ASTAction<PlainPrinterAction>(),
OutputFile(std::make_shared<std::fstream>()) {
OutputFile->open(filename, std::fstream::out);
}
PlainPrinterAction::~PlainPrinterAction() {
OutputFile->close();
}
std::f... |
c4c97fa4-0f4b-488e-8784-6052e2af1e3c | {
"language": "C++"
} | ```c++
#include <ncurses.h>
#include "../../../src/contents.hh"
#include "../../../src/key_aliases.hh"
#include "../../vick-move/src/move.hh"
void enter_insert_mode(contents& contents, boost::optional<int>) {
char ch;
while((ch = getch()) != _escape) {
contents.cont[contents.y].insert(contents.x, 1, c... | ```c++
#include <ncurses.h>
#include "../../../src/contents.hh"
#include "../../../src/key_aliases.hh"
#include "../../vick-move/src/move.hh"
void enter_insert_mode(contents& contents, boost::optional<int>) {
char ch;
contents.is_inserting = true;
while((ch = getch()) != _escape) {
contents.cont[c... |
687896b7-ac33-49ef-a1f1-5c9142662b29 | {
"language": "C++"
} | ```c++
#include "wvtftps.h"
int main()
{
WvTFTPs tftps("/tftpboot", 30*1000);
while (tftps.isok())
{
if (tftps.select(0))
tftps.callback();
}
wvcon->print("TFTPs is not okay; aborting.\n");
}
```
Support for blksize option (RFC 2348). | ```c++
#include "wvtftps.h"
int main()
{
WvTFTPs tftps("/tftpboot", 30, 30);
while (tftps.isok())
{
if (tftps.select(0))
tftps.callback();
}
wvcon->print("TFTPs is not okay; aborting.\n");
}
``` |
f37220b9-2c91-4113-bb52-0fc7a44ae3d9 | {
"language": "C++"
} | ```c++
//===-- ManagedStatic.cpp - Static Global wrapper -------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by Chris Lattner and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===-------------... | ```c++
//===-- ManagedStatic.cpp - Static Global wrapper -------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by Chris Lattner and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===-------------... |
df16b961-d3f6-4189-a527-9080ce7faeb8 | {
"language": "C++"
} | ```c++
// Formatting library for C++ - Grisu tests
//
// Copyright (c) 2012 - present, Victor Zverovich
// All rights reserved.
//
// For the license information refer to format.h.
#define FMT_USE_GRISU std::numeric_limits<double>::is_iec559
#include "fmt/format.h"
#include "gtest.h"
bool reported_skipped;
#undef TE... | ```c++
// Formatting library for C++ - Grisu tests
//
// Copyright (c) 2012 - present, Victor Zverovich
// All rights reserved.
//
// For the license information refer to format.h.
#define FMT_USE_GRISU std::numeric_limits<double>::is_iec559
#include "fmt/format.h"
#include "gtest.h"
bool reported_skipped;
#undef TE... |
db0e6fe9-862e-4252-8907-bd9041a38040 | {
"language": "C++"
} | ```c++
//===-- main.c --------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===------------------------------------------------... | ```c++
//===-- main.c --------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===------------------------------------------------... |
60e3fb28-4834-4125-a9ec-0cfdfdffeb01 | {
"language": "C++"
} | ```c++
#include "Runtime.h"
#include <llvm/IR/GlobalVariable.h>
#include <llvm/IR/Function.h>
#include <llvm/IR/IntrinsicInst.h>
namespace dev
{
namespace eth
{
namespace jit
{
Runtime::Runtime(RuntimeData* _data, Env* _env) :
m_data(*_data),
m_env(*_env),
m_currJmpBuf(m_jmpBuf)
{}
bytes Runtime::getReturnData(... | ```c++
#include "Runtime.h"
#include <llvm/IR/GlobalVariable.h>
#include <llvm/IR/Function.h>
#include <llvm/IR/IntrinsicInst.h>
namespace dev
{
namespace eth
{
namespace jit
{
Runtime::Runtime(RuntimeData* _data, Env* _env) :
m_data(*_data),
m_env(*_env),
m_currJmpBuf(m_jmpBuf)
{}
bytes Runtime::getReturnData(... |
f69d5269-5983-445f-af80-cd7d9946e2a4 | {
"language": "C++"
} | ```c++
// Test the handle_abort option.
// clang-format off
// RUN: %clangxx %s -o %t
// RUN: not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
// RUN: %env_tool_opts=handle_abort=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
// RUN: %env_tool_opts=handle_abor... | ```c++
// Test the handle_abort option.
// clang-format off
// RUN: %clangxx %s -o %t
// RUN: not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
// RUN: %env_tool_opts=handle_abort=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
// RUN: %env_tool_opts=handle_abor... |
f2d471c1-6d09-4eac-b589-35e3ddd26b4f | {
"language": "C++"
} | ```c++
#include <im_str/im_str.hpp>
#include <cstring>
#include <string>
#include <iostream>
int c_api_func(const char* str) {
return std::strlen( str );
}
int main() {
using namespace std::string_literals;
mba::im_str str1 = "Hello ";
auto greeting = mba::concat( str1, "World"s, "!" );
std::cout << greeting... | ```c++
#include <im_str/im_str.hpp>
#include <cstring>
#include <string>
#include <iostream>
std::size_t c_api_func(const char* str) {
return std::strlen( str );
}
int main() {
using namespace std::string_literals;
mba::im_str str1 = "Hello ";
auto greeting = mba::concat( str1, "World"s, "!" );
std::cout << ... |
2a00993f-48a4-4dc4-b958-0b51d6ac9b04 | {
"language": "C++"
} | ```c++
#include "dukbind_validation.h"
#include <regex>
namespace dukbind
{
namespace validation
{
static std::regex identifer_regex( "[a-zA-Z$_][a-zA-Z0-9$_]*" );
bool IsValidIdentifier( const char * identifier )
{
return std::regex_match( identifier, identifer_regex );
... | ```c++
#include "dukbind_validation.h"
#include <regex>
namespace dukbind
{
namespace validation
{
const std::regex & getIndentifierRegex()
{
static std::regex identifer_regex( "[a-zA-Z$_][a-zA-Z0-9$_]*" );
return identifer_regex;
}
bool IsValidIdentifi... |
f0b16509-4948-4eba-9f76-10736fb8e387 | {
"language": "C++"
} | ```c++
#include "session.h"
#include <ncurses.h>
namespace ncurses
{
std::shared_ptr < Panel > Session::panel;
void Session::init ()
{
// Standard ncurses init methods
initscr ();
cbreak ();
noecho ();
start_color ();
use_default_colors ();
refresh ... | ```c++
#include "session.h"
#include <ncurses.h>
namespace ncurses
{
std::shared_ptr < Panel > Session::panel;
void Session::init ()
{
// Standard ncurses init methods
initscr ();
// Update every 2.5 seconds
halfdelay ( 25 );
noecho ();
start_color ();
... |
7ae3204f-a605-4015-a97d-7b57f6a89941 | {
"language": "C++"
} | ```c++
#include "variant/usart_platform.hpp"
#include "hal.h"
// USART1 configuration
static const SerialConfig usart1_config = {
115200,
0,
USART_CR2_STOP1_BITS | USART_CR2_LINEN,
0
};
// USART3 configuration
static const SerialConfig usart3_config = {
115200,
0,
USART_CR2_STOP1_BITS | USART_CR2_LINEN... | ```c++
#include "variant/usart_platform.hpp"
#include "hal.h"
// USART1 configuration
static const SerialConfig usart1_config = {
38400,
0,
USART_CR2_STOP1_BITS | USART_CR2_LINEN,
0
};
// USART3 configuration
static const SerialConfig usart3_config = {
38400,
0,
USART_CR2_STOP1_BITS | USART_CR2_LINEN,
... |
f502f587-9b45-4dfc-8a16-2cb24c4b7ad3 | {
"language": "C++"
} | ```c++
// This code is based on Sabberstone project.
// Copyright (c) 2017-2019 SabberStone Team, darkfriend77 & rnilva
// RosettaStone is hearthstone simulator using C++ with reinforcement learning.
// Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon
#include <Rosetta/Enchants/Aura.hpp>
#include <Rosetta/... | ```c++
// This code is based on Sabberstone project.
// Copyright (c) 2017-2019 SabberStone Team, darkfriend77 & rnilva
// RosettaStone is hearthstone simulator using C++ with reinforcement learning.
// Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon
#include <Rosetta/Enchants/Aura.hpp>
#include <Rosetta/... |
c208ff0e-950d-48b5-acb4-301c8b8a59f1 | {
"language": "C++"
} | ```c++
#include <regex>
#include <string>
int main() {
const std::string str = "test0159";
const std::regex re(
"^[a-z]+[0-9]+$",
std::regex_constants::extended | std::regex_constants::nosubs);
return std::regex_search(str, re) ? 0 : -1;
}
```
Change std::regex detection test to detect bug in libstd... | ```c++
#include <regex>
#include <string>
int main() {
const std::string str = "test0159";
std::regex re;
re = std::regex("^[a-z]+[0-9]+$",
std::regex_constants::extended | std::regex_constants::nosubs);
return std::regex_search(str, re) ? 0 : -1;
}
``` |
9be8f61d-0e89-410c-adf6-314c9ba1cf16 | {
"language": "C++"
} | ```c++
#include "vm.hpp"
#include "vm/object_utils.hpp"
#include "capi/capi.hpp"
#include "capi/include/ruby.h"
using namespace rubinius;
using namespace rubinius::capi;
extern "C" {
VALUE rb_file_open(const char* name, const char* mode) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
VALU... | ```c++
#include "vm.hpp"
#include "vm/object_utils.hpp"
#include "capi/capi.hpp"
#include "capi/18/include/ruby.h"
using namespace rubinius;
using namespace rubinius::capi;
extern "C" {
VALUE rb_file_open(const char* name, const char* mode) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
V... |
11732c09-3c4b-4363-95f3-f7ac94d7631c | {
"language": "C++"
} | ```c++
#include "../Swarm.h"
#include <Eigen/Core>
#include <pybind11/eigen.h>
#include <pybind11/functional.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
namespace MetaOpt
{
namespace Python {
namespace py = pybind11;
void init_swarm(py::module &m) {
py::class_<Swarm>(m, "Swarm")
.def(py::ini... | ```c++
#include "../Swarm.h"
#include <Eigen/Core>
#include <pybind11/eigen.h>
#include <pybind11/functional.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
namespace MetaOpt {
namespace Python {
namespace py = pybind11;
void init_swarm(py::module &m) {
auto constructor = py::init<const ParameterSpace... |
7002cd3e-2c91-4be5-90a7-ed83318b81bb | {
"language": "C++"
} | ```c++
#include <algorithm>
#include <set>
using namespace std;
typedef set<int> si;
/* Get the divisors of a number */
si divisores(int n) {
vi d;
int r = sqrt(n);
for(int i = 1; i <= r; i++) {
if(n % i == 0) {
d.insert(i);
d.insert(n / i);
}
}
return d;
}
... | ```c++
#include <algorithm>
#include <math.h>
#include <set>
#include <stdio.h>
using namespace std;
typedef set<int> si;
/* Get the divisors of a number */
si divisores(int n) {
si d;
int r = sqrt(n);
for(int i = 1; i <= r; i++) {
if(n % i == 0) {
d.insert(i);
d.insert(n /... |
078a5889-b3e0-4bcc-ae45-269e3b05c6ee | {
"language": "C++"
} | ```c++
#include "dependency_tree.hpp"
#include "osal.hpp"
#include "file_exist.hpp"
#include "resolver.hpp"
#include <algorithm>
Resolver *DependencyTree::addTarget(const std::string &fileName)
{
auto &&res = tree.insert(std::make_pair(fileName, std::make_unique<Resolver>()));
if (!res.second)
throw std::runt... | ```c++
#include "dependency_tree.hpp"
#include "osal.hpp"
#include "file_exist.hpp"
#include "resolver.hpp"
#include <algorithm>
Resolver *DependencyTree::addTarget(const std::string &fileName)
{
auto &&res = tree.insert(std::make_pair(fileName, std::make_unique<Resolver>()));
if (!res.second)
throw std::runt... |
37d29d09-3441-43f1-9f6f-c9ac8537cf18 | {
"language": "C++"
} | ```c++
#ifndef PIPED_PROCESS_CPP
#define PIPED_PROCESS_CPP
#include<iostream>
class child_process_streambuf: public std::streambuf
{
public:
virtual int underflow()
{
}
virtual std::streamsize xsgetn(char* bufout,std::streamsize n)
{
}
virtual std::streamsize xsputn(const char* bufin,std::st... | ```c++
#include<iostream>
#include<streambuf>
#include<unistd.h>
#include<cstdio>
#include<cerrno>
#include<stdexcept>
#include<system_error>
class process_streambuf_base: public std::streambuf
{
protected:
FILE* pipefile;
public:
enum ReadWriteType
{
READ_ONLY=0,
WRITE_ONLY
};
process_s... |
afd2ccd8-6e99-4ab9-a936-88819090dee6 | {
"language": "C++"
} | ```c++
//=======================================================================
// Copyright (c) 2017 Adrian Schneider
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
// http://opensource.org/licenses/MIT)
//==============================================================... | ```c++
//=======================================================================
// Copyright (c) 2017 Adrian Schneider
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
// http://opensource.org/licenses/MIT)
//==============================================================... |
6a88364b-4834-4d57-a55a-3024bc0e7675 | {
"language": "C++"
} | ```c++
#include <HX711.h>
#include "TimerDisplay.h"
#include "GramsDisplay.h"
#include "SmoothingFilter.h"
#define DISP_TIMER_CLK 2
#define DISP_TIMER_DIO 3
#define DISP_SCALE_CLK 8
#define DISP_SCALE_DIO 9
#define FILTER_SIZE 10
#define HYSTERESIS_SIZE 0.1
#define LOAD_CELL_DT A2
#define LOAD_CELL_SCK A1
#define SC... | ```c++
#include <HX711.h>
#include "TimerDisplay.h"
#include "GramsDisplay.h"
#include "SmoothingFilter.h"
#define DISP_TIMER_CLK 2
#define DISP_TIMER_DIO 3
#define DISP_SCALE_CLK 8
#define DISP_SCALE_DIO 9
#define FILTER_SIZE 10
#define HYSTERESIS_SIZE 0.1
#define LOAD_CELL_DT A2
#define LOAD_CELL_SCK A1
#define SC... |
9446ad89-990d-4f3c-ba73-2a1d573b35b0 | {
"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 "chrome/browser/extensions/extension_apitest.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
class WebrtcCastAp... | ```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 "chrome/browser/extensions/extension_apitest.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
class WebrtcCastAp... |
d43f3b19-5c4a-45a0-b4b6-917140c1f7bb | {
"language": "C++"
} | ```c++
/**
* C++ algorithm to get the sum of all prime numbers between a range of 2 and the number desired.
*/
#include <iostream>
#include <cstdlib>
bool is_prime(unsigned int number);
int main(int argc, char* argv[])
{
const char *num = "2000000";
if(argv[1])
num = argv[1];
else if (argv[1] == "--help"... | ```c++
/**
* C++ algorithm to get the sum of all prime numbers between a range of 2 and the number desired.
*/
#include <iostream>
#include <cstdlib>
#include <string.h>
bool is_prime(unsigned int number);
int main(int argc, char* argv[])
{
const char *num = "2000000";
if (strcmp(argv[1],"--help") == 0){
... |
35c1454a-5e41-4440-99e9-fa6650177d87 | {
"language": "C++"
} | ```c++
#include <iostream>
// Entry point for Dinit.
int dinit_main(int argc, char **argv);
int main(int argc, char **argv)
{
try {
return dinit_main(argc, argv);
}
catch (std::bad_alloc &badalloc) {
std::cout << "dinit: Out-of-memory during initialisation" << std::endl;
return 1;... | ```c++
#include <iostream>
#include <system_error>
#include <new>
// Entry point for Dinit.
int dinit_main(int argc, char **argv);
int main(int argc, char **argv)
{
try {
return dinit_main(argc, argv);
}
catch (std::bad_alloc &badalloc) {
std::cout << "dinit: Out-of-memory during initiali... |
5351ce92-a867-4730-98f7-632e16c9d272 | {
"language": "C++"
} | ```c++
// Standard Dependencies
#include <cmath>
#include <random>
// Module Dependencies
#include "../include/math.h"
namespace native
{
static std::default_random_engine engine;
double Math::sqrt(double value)
{
return (double)std::sqrt((long double)value);
}
long double Math::random(long double min, long ... | ```c++
#ifdef __ANDROID__
double nan(const char*);
float nanf(const char*);
long double nanl(const char*);
#endif // __ANDROID__
// Standard Dependencies
#include <cmath>
#include <random>
// Module Dependencies
#include "../include/math.h"
namespace native
{
static std::default_random_engine engine;
double Mat... |
d7425072-955e-4a37-b8d1-fb39cfdf56ca | {
"language": "C++"
} | ```c++
#include <QCoreApplication>
#include <QDebug>
#include "ganalytics.h"
class Watcher : public QObject
{
Q_OBJECT
public slots:
void onIsSendingChanged(bool sending)
{
if (sending)
return;
QCoreApplication::instance()->quit();
}
};
int main(int argc, char* argv[])
{... | ```c++
#include <QCoreApplication>
#include <QDebug>
#include "ganalytics.h"
class Watcher : public QObject
{
Q_OBJECT
public slots:
void onIsSendingChanged(bool sending)
{
if (sending)
return;
QCoreApplication::instance()->quit();
}
};
int main(int argc, char* argv[])
{... |
e6959ca5-ddea-4e9b-bfb9-f35ef4a64640 | {
"language": "C++"
} | ```c++
#include "test_common.h"
#include <evpp/exp.h>
#include <evpp/libevent_headers.h>
#include <evpp/libevent_watcher.h>
#include <thread>
namespace {
static bool g_event_handler_called = false;
static void Handle(struct event_base* base) {
g_event_handler_called = true;
event_base_loopexit(base, 0);
}
s... | ```c++
#include "test_common.h"
#include <evpp/exp.h>
#include <evpp/libevent_headers.h>
#include <evpp/libevent_watcher.h>
#include <thread>
namespace {
static bool g_event_handler_called = false;
static void Handle(struct event_base* base) {
g_event_handler_called = true;
event_base_loopexit(base, 0);
}
s... |
8601ceac-0048-4096-96c7-c94a5ca96f9f | {
"language": "C++"
} | ```c++
#include "SketchItemEllipse.h"
#include <QGraphicsEllipseItem>
SketchItemEllipse::SketchItemEllipse(qreal x, qreal y)
: SketchItemBezier(x, y)
{
addPath(QPointF(30, 0), QPointF(50, 20), QPointF(50, 50));
addPath(QPointF(50, 80), QPointF(30, 100), QPointF(0, 100));
addPath(QPointF(-30, 100), QPo... | ```c++
#include "SketchItemEllipse.h"
#include <QGraphicsEllipseItem>
// Constants
static const uint TOP_INDEX = 12;
static const uint RIGHT_INDEX = 3;
static const uint BOTTOM_INDEX = 6;
static const uint LEFT_INDEX = 9;
SketchItemEllipse::SketchItemEllipse(qreal x, qreal y)
: SketchItemBezier(x, y)
{... |
8e0de74d-12d2-46e5-ac96-14c856ed3108 | {
"language": "C++"
} | ```c++
#include "CacheJsonToArticleConverter.h"
ArticleCollection& CacheJsonToArticleConverter::convertToArticle(std::string json, ArticleCollection& articleCache)
{
return articleCache;
}
```
Add implementation to cache reader | ```c++
#include "CacheJsonToArticleConverter.h"
#include <json/json.h>
#include "WalkerException.h"
#include "Article.h"
ArticleCollection& CacheJsonToArticleConverter::convertToArticle(std::string json, ArticleCollection& articleCache)
{
Json::Reader reader;
Json::Value document;
bool success = reader.p... |
bbd3914b-3d98-4cdc-9167-d2c7798c90d7 | {
"language": "C++"
} | ```c++
/*
* Copyright 2015 - 2017 gtalent2@gmail.com
*
* 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 <iostream>
#include <map>
#include <functional>
... | ```c++
/*
* Copyright 2015 - 2017 gtalent2@gmail.com
*
* 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 <map>
#include <ox/std/std.hpp>
using namespace... |
70f7c0e5-dfea-4da4-986a-4add1a99f0b6 | {
"language": "C++"
} | ```c++
#include <QTest>
#include <QObject>
#include "uritests.h"
// This is all you need to run all the tests
int main(int argc, char *argv[])
{
URITests test1;
QTest::qExec(&test1);
}
```
Return !0 when qt tests fail. | ```c++
#include <QTest>
#include <QObject>
#include "uritests.h"
// This is all you need to run all the tests
int main(int argc, char *argv[])
{
bool fInvalid = false;
URITests test1;
if (QTest::qExec(&test1) != 0)
fInvalid = true;
return fInvalid;
}
``` |
1a63a691-9321-4afd-9566-8bad417ca50f | {
"language": "C++"
} | ```c++
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <stdlib.h>
#include <QtGlobal>
#include <QtWidgets>
#include <QtSingleApplication>
int main(int argc, char *argv[])
{
// Only allow a single instance running.
QtSingleApplication app(argc, argv);
if (app.sendMes... | ```c++
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <stdlib.h>
#include <QtGlobal>
#include <QtWidgets>
#include <QtSingleApplication>
int main(int argc, char *argv[])
{
// Only allow a single instance running.
QtSingleApplication app(argc, argv);
if (app.sendMes... |
c4881223-d507-4805-b8d7-0e98f4e3731a | {
"language": "C++"
} | ```c++
#include <algorithm>
#include <cctype>
#include <sstream>
#include "cons.h"
#include "utils.h"
namespace mclisp
{
template<typename T>
std::string ContainerToString(T items)
{
std::ostringstream oss;
for(auto item : items)
oss << item;
return oss.str();
}
template std::string ContainerToString<>(st... | ```c++
#include <algorithm>
#include <cctype>
#include <sstream>
#include "cons.h"
#include "utils.h"
namespace mclisp
{
template<typename T>
std::string ContainerToString(T items)
{
std::ostringstream oss;
for(auto item : items)
oss << item;
return oss.str();
}
template std::string ContainerToString<>(st... |
902a0b97-8281-4906-9694-3a8c43b3c3bc | {
"language": "C++"
} | ```c++
#include "polyChecksum.h"
PolyChecksum::PolyChecksum()
{
// for all possible byte values
for (unsigned i = 0; i < 256; ++i)
{
unsigned long reg = i << 24;
// for all bits in a byte
for (int j = 0; j < 8; ++j)
{
bool topBit = (reg & 0x80000000) != 0;
reg <<= 1;
if (topBit)
reg ^= _key;
... | ```c++
#include "polyChecksum.h"
PolyChecksum::PolyChecksum()
{
// for all possible byte values
for (unsigned i = 0; i < 256; ++i)
{
unsigned long reg = i << 24;
// for all bits in a byte
for (int j = 0; j < 8; ++j)
{
bool topBit = (reg & 0x80000000) != 0;
reg <<= 1;
if (topBit)
reg ^= _key;
... |
104e3374-bfc6-4adf-a164-f05679f329f4 | {
"language": "C++"
} | ```c++
#include <MinConsole.hpp>
#include <Windows.h>
#include <mutex>
namespace MinConsole
{
void* GetOutputHandle()
{
static void* Handle = nullptr;
std::once_flag HandleCached;
std::call_once(HandleCached, [=]()
{
Handle = GetStdHandle(STD_OUTPUT_HANDLE);
});
return Handle;
}
void SetTextColor(Color New... | ```c++
#include <MinConsole.hpp>
#include <Windows.h>
#include <mutex>
namespace MinConsole
{
void* GetOutputHandle()
{
static void* Handle = nullptr;
std::once_flag HandleCached;
std::call_once(HandleCached, []()
{
Handle = GetStdHandle(STD_OUTPUT_HANDLE);
});
return Handle;
}
void SetTextColor(Color NewC... |
caa10088-47e0-4083-ac0c-c9c8c3bb168d | {
"language": "C++"
} | ```c++
//dummy file, so Android Studio will 'see' these folders
```
Add copyright notice required for open-sourcing | ```c++
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required... |
29ea290d-06b9-43a6-a26e-56a0de4f0015 | {
"language": "C++"
} | ```c++
#include "logic.cpp"
#include <iostream>
#include <cstdlib>
int main( void );
void printCoords( block* b );
int rotationTest( void );
int main( void )
{
std::cout << "Rotation Test : " << (rotationTest())? "PASSED\n" : "FAILED\n";
exit( EXIT_SUCCESS );
}
void printCoords( block *b )
{
for( int i = 0; i ... | ```c++
#include "logic.cpp"
#include <iostream>
#include <cstdlib>
int main( void );
void printCoords( block* b );
int rotationTest( void );
int main( void )
{
std::cout << "Rotation Test : " << (rotationTest())? "PASSED\n" : "FAILED\n";
exit( EXIT_SUCCESS );
}
void printCoords( block *b )
{
for( int i = 0; i ... |
2ddb9e37-61e1-4c84-99b5-a93d9615ae76 | {
"language": "C++"
} | ```c++
#include "unicode-utils.h"
#include <clocale>
#include <stdlib.h>
#include <string>
int UnicodeUtils::characters_in_bytes(const char* string, int bytes) {
if (bytes == 0)
return 0;
mblen(NULL, 0);
setlocale(LC_CTYPE, "en_US.UTF-8");
int characters = 0;
while (bytes > 0) {
int characterLength... | ```c++
#include "unicode-utils.h"
#include <clocale>
#include <stdlib.h>
#include <string.h>
int UnicodeUtils::characters_in_bytes(const char* string, int bytes) {
if (bytes == 0)
return 0;
mblen(NULL, 0);
setlocale(LC_CTYPE, "en_US.UTF-8");
int characters = 0;
while (bytes > 0) {
int characterLeng... |
2bb94ab7-849e-4b65-9b42-fe96e5b06f25 | {
"language": "C++"
} | ```c++
#include "create/types.h"
namespace create {
RobotModel::RobotModel(const ProtocolVersion version, const float axleLength, const unsigned int baud, const float maxVelocity, const float wheelDiameter):
id(nextId),
version(version),
axleLength(axleLength),
baud(baud),
maxVelocity(maxVelocit... | ```c++
#include "create/types.h"
namespace create {
RobotModel::RobotModel(const ProtocolVersion version, const float axleLength, const unsigned int baud, const float maxVelocity, const float wheelDiameter):
id(nextId),
version(version),
axleLength(axleLength),
baud(baud),
maxVelocity(maxVelocit... |
253a7a7d-727c-4f31-b57a-1ddbb1645b7c | {
"language": "C++"
} | ```c++
#include "test.h"
#include "test-job.h"
#include "test-machine.h"
#include <iostream>
int main()
{
Test::TestSuite tests(std::cout);
{ // Job
std::shared_ptr<Test::Test> jt1(new Test::JobID);
tests.register_test(jt1);
std::shared_ptr<Test::Test> jt2(new Test::JobMachineName... | ```c++
#include "test.h"
#include "test-job.h"
#include "test-machine.h"
#include <iostream>
#include <memory>
int main()
{
Test::TestSuite tests(std::cout);
// Set up tests - class Job
tests.register_test(std::make_shared<Test::JobID>());
tests.register_test(std::make_shared<Test::JobMachineName... |
8eba2344-2897-4048-81b7-7ec689caf12a | {
"language": "C++"
} | ```c++
// Copyright 2015-2018 Elviss Strazdins. All rights reserved.
#include "AudioDeviceWASAPI.hpp"
namespace ouzel
{
namespace audio
{
AudioDeviceWASAPI::AudioDeviceWASAPI(Mixer& initMixer):
AudioDevice(Driver::WASAPI, initMixer)
{
}
} // namespace audio
} // namespa... | ```c++
// Copyright 2015-2018 Elviss Strazdins. All rights reserved.
#include <string>
#include <Audioclient.h>
#include <mmdeviceapi.h>
#include "AudioDeviceWASAPI.hpp"
namespace ouzel
{
namespace audio
{
class WASAPIErrorCategory : public std::error_category
{
public:
con... |
238b5773-e63a-43a5-8b71-dfcd2ee8620e | {
"language": "C++"
} | ```c++
/*
* Copyright (c) 2017-2018 Tuukka Norri
* This code is licensed under MIT license (see LICENSE for details).
*/
#include <vcf2multialign/graph_writer.hh>
namespace vcf2multialign
{
// Dummy implementation.
void graph_writer_impl::init(std::size_t n_rows)
{
graph.Init(n_rows);
}
void graph_write... | ```c++
/*
* Copyright (c) 2017-2018 Tuukka Norri
* This code is licensed under MIT license (see LICENSE for details).
*/
#include <vcf2multialign/graph_writer.hh>
namespace vcf2multialign
{
// Dummy implementation.
void graph_writer_impl::init(std::size_t n_rows)
{
graph.Init(n_rows);
}
void graph_write... |
3249e185-f37b-4416-a264-9887845641e3 | {
"language": "C++"
} | ```c++
#include "CoverReader.h"
#include <fstream>
NetworKit::Cover NetworKit::CoverReader::read(std::string path, NetworKit::Graph &G)
{
std::ifstream file;
file.open(path);
if (!file.good()) {
throw std::runtime_error("unable to read from file");
}
Cover communities(G.upperNodeIdBound());
std::string line;
... | ```c++
#include "CoverReader.h"
#include <fstream>
NetworKit::Cover NetworKit::CoverReader::read(std::string path, NetworKit::Graph &G)
{
std::ifstream file;
file.open(path);
if (!file.good()) {
throw std::runtime_error("unable to read from file");
}
Cover communities(G.upperNodeIdBound());
std::string line;
... |
88de55f5-3a41-45a9-8c07-7e8aac588885 | {
"language": "C++"
} | ```c++
#include <stdio.h>
#include "../excercise04/make_random_data/make_random_data.hpp"
#include "../excercise04/sort/quick.hpp"
int get_index_smallest(const int k, int *data, const int start, const int end)
{
if(k < 0 || k > end) return -1; /* Base case */
int p = partition(data, start, end);
if(k == ... | ```c++
#include <stdio.h>
#include "../excercise04/make_random_data/make_random_data.hpp"
#include "../excercise04/sort/quicksort.hpp"
int get_index_smallest(const int k, int *data, const int start, const int end)
{
if(k < 0 || k > end) return -1; /* Base case */
int p = partition(data, start, end);
if(k... |
2f3a62c9-6cfb-4381-ba62-48272c95fcfa | {
"language": "C++"
} | ```c++
/* * This file is part of Maliit framework *
*
* Copyright (C) 2014 Dinesh Manajipet <saidinesh5@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* an... | ```c++
/* * This file is part of Maliit framework *
*
* Copyright (C) 2014 Dinesh Manajipet <saidinesh5@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* an... |
928eabfe-0fa6-4a65-8550-264235f2c676 | {
"language": "C++"
} | ```c++
#define SOL_ALL_SAFETIES_ON 1
#include <sol/sol.hpp>
#include <iostream>
inline void my_panic(sol::optional<std::string> maybe_msg) {
std::cerr << "Lua is in a panic state and will now abort() the application" << std::endl;
if (maybe_msg) {
const std::string& msg = maybe_msg.value();
std::cerr << "\terror... | ```c++
#define SOL_ALL_SAFETIES_ON 1
#include <sol/sol.hpp>
#include <iostream>
inline void my_panic(sol::optional<std::string> maybe_msg) {
std::cerr << "Lua is in a panic state and will now abort() the application" << std::endl;
if (maybe_msg) {
const std::string& msg = maybe_msg.value();
std::cerr << "\terror... |
5822a38e-b7e3-49c3-ab40-cf730736b26f | {
"language": "C++"
} | ```c++
#include <Magick++/ResourceLimits.h>
#include <Magick++/SecurityPolicy.h>
#ifndef FUZZ_MAX_SIZE
#define FUZZ_MAX_SIZE 2048
#endif
class FuzzingLimits {
public:
FuzzingLimits() {
Magick::SecurityPolicy::maxMemoryRequest(256000000);
Magick::ResourceLimits::memory(1000000000);
Magick::ResourceLimits... | ```c++
#include <Magick++/Functions.h>
#include <Magick++/ResourceLimits.h>
#include <Magick++/SecurityPolicy.h>
#ifndef FUZZ_MAX_SIZE
#define FUZZ_MAX_SIZE 2048
#endif
class FuzzingInitializer {
public:
FuzzingInitializer() {
Magick::InitializeMagick((const char *) NULL);
Magick::SecurityPolicy::maxMemoryR... |
85112b7f-4246-4b33-a274-f079205b2c44 | {
"language": "C++"
} | ```c++
//===-- asan_preinit.cc ---------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===------------------------------------------------... | ```c++
//===-- asan_preinit.cc ---------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===------------------------------------------------... |
95140b15-d534-4481-ad5a-1dbba715ba44 | {
"language": "C++"
} | ```c++
#define NO_EXTERN
#include"variables.hpp"
#include"processes.hpp"
#include<iostream>
int main(int argc, const char* argv[]){
globals.reset(new Globals());
NILATOM = globals->lookup("nil");
TATOM = globals->lookup("t");
/*tests!*/
Process proc;
/*allocate stuff*/
//(cons t ...)
proc.stack.push(new(proc)... | ```c++
#include"variables.hpp"
#include"processes.hpp"
#include<iostream>
int main(int argc, const char* argv[]){
variables_init();
/*tests!*/
Process proc;
/*allocate stuff*/
//(cons t ...)
proc.stack.push(new(proc) Sym(TATOM));//t
//(cons t nil)
proc.stack.push(new(proc) Sym(TATOM)); //t
proc.stack.push(ne... |
dde0b270-b4f2-420c-b9dd-71aa99df3732 | {
"language": "C++"
} | ```c++
#include<cmath>
#include<iostream>
using namespace std;
bool isPrimeBruteForce(double x)
{
if (x < 2)
return false;
double sqroot_x = sqrt(x);
for(int i=0; i <= sqroot_x; i++) { /* If there were only factors above the square root of x, they would be bigger than x itself. */
if (x%i==0)
return false;
... | ```c++
#include<math.h>
#include<stdio.h>
/*#include<iostream>
using namespace std;*/
int isPrimeBruteForce(int x)
{
if (x < 2)
return false;
double sqroot_x;
sqroot_x = sqrt (x);
for(int i=0; i <= sqroot_x; i++) { /* If there were only factors above the square root of x, they would be bigger than x itself. */
... |
c3a6a557-0580-4bcd-a5d3-cecfca163406 | {
"language": "C++"
} | ```c++
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
// PR7490
int main() {
// CHECK: {{for.cond:|:4}}
// CHECK: %{{.*}} = icmp ult i64 %{{.*}}, 1133
// CHECK: {{for.body:|:6}}
// CHECK: store i8 0
// CHECK: br label %{{for.inc|7}}
// CHECK: {{for.inc:|:7}}
// CHECK: ... | ```c++
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -O3 -emit-llvm -o - %s | FileCheck %s
// PR7490
// CHECK: define signext i8 @_Z2f0v
// CHECK: ret i8 0
// CHECK: }
inline void* operator new[](unsigned long, void* __p) { return __p; }
static void f0_a(char *a) {
new (a) char[4]();
}
char f0() {
char a[4];
... |
50ac07c3-01bb-4941-a0a0-21a738dd593e | {
"language": "C++"
} | ```c++
#include "common.th"
#include "vga.th"
_start:
prologue
b <- 0 // indicate non-completion to testbench
call(init_display)
restart:
c <- 0
j <- @VGA_BASE
k <- (ROWS * COLS)
k <- k + j
top:
c -> [j]
c <- c + 1
c <- c & 0xff
j <- j + 1
n <- j < k
... | ```c++
#include "common.th"
#include "vga.th"
_start:
prologue
b <- 0 // indicate non-completion to testbench
call(init_display)
restart:
c <- 0
j <- @VGA_BASE
k <- (ROWS * COLS)
k <- k + j
top:
c -> [j]
c <- c + 1
c <- c & 0xff
j <- j + 1
n <- j < k
... |
ea350e0a-ba87-4afe-ae62-3a57e95a68f7 | {
"language": "C++"
} | ```c++
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/modules.cache \
// RUN: -I %S/Inputs/odr_hash-Friend \
// RUN: -emit-obj -o /dev/null \
// RUN: -fmodules \
// RUN: -fimplicit-module-maps \
// RUN: -fmodules-cache-path=%t/modules.cache \
// RUN: -std=c++11 -x c++ %s -verify
// UNSUP... | ```c++
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/modules.cache \
// RUN: -I %S/Inputs/odr_hash-Friend \
// RUN: -emit-obj -o /dev/null \
// RUN: -fmodules \
// RUN: -fimplicit-module-maps \
// RUN: -fmodules-cache-path=%t/modules.cache \
// RUN: -std=c++11 -x c++ %s -verify
// PR359... |
93692ae5-fa21-46f4-b802-77cb711cbe9d | {
"language": "C++"
} | ```c++
int main(int argc, char **argv)
{
return 0;
}
```
Add test for allocation/freeing heap. | ```c++
#include "heap.h"
#include <ctime>
#include <cstdlib>
#include <iostream>
#include <glibmm/error.h>
int main(int argc, char **argv)
{
VM::Heap heap;
const size_t ARR_SIZE = 128;
const size_t TEST_SIZE = 50;
size_t ptrs[ARR_SIZE] = { 0 };
srand(0);
try
{
for(size_t i = 0; i < TEST_SIZE; i ++)
{
si... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.