doc_id stringlengths 36 36 | metadata dict | input stringlengths 28 4.3k | output stringlengths 11 5.45k |
|---|---|---|---|
17a442b5-5393-45e5-9cfa-58967f24aa8c | {
"language": "C++"
} | ```c++
{{{header}}}
{{#includes}}
#include <{{{.}}}>
{{/includes}}
{{{precontent}}}
#include <boost/python.hpp>
#include <cmath>
/* postinclude */
void {{function.mangled_name}}()
{
::boost::python::object parent_object(::boost::python::scope(){{!
}}{{#function.scope}}{{#name}}.attr("{{name}}"){{/name}}{{/functio... | ```c++
{{{header}}}
{{#includes}}
#include <{{{.}}}>
{{/includes}}
{{{precontent}}}
#include <boost/python.hpp>
#include <cmath>
/* postinclude */
void {{function.mangled_name}}()
{
::boost::python::object parent_object(::boost::python::scope(){{!
}}{{#function.scope}}{{#name}}.attr("{{name}}"){{/name}}{{/functio... |
591c1754-e8bd-4e4e-a631-637e26befed3 | {
"language": "C++"
} | ```c++
#include "removeNamedParameters.h"
#include "expr.h"
#include "stmt.h"
void RemoveNamedParameters::postProcessExpr(Expr* expr) {
if (NamedExpr* named_expr = dynamic_cast<NamedExpr*>(expr)) {
named_expr->replace(named_expr->actual->copy());
}
if (VarInitExpr* var_init = dynamic_cast<VarInitExpr*>(expr... | ```c++
#include "removeNamedParameters.h"
#include "expr.h"
#include "stmt.h"
void RemoveNamedParameters::postProcessExpr(Expr* expr) {
if (NamedExpr* named_expr = dynamic_cast<NamedExpr*>(expr)) {
named_expr->replace(named_expr->actual->copy());
}
if (VarInitExpr* var_init = dynamic_cast<VarInitExpr*>(expr... |
11806631-2db6-4632-833c-a3e038c014b0 | {
"language": "C++"
} | ```c++
#include "details.hpp"
#include "json/json.h"
dota2::DetailsRequest &dota2::DetailsRequest::id(MatchID id)
{
query.insert({"match_id", std::to_string(id)});
return *this;
}
dota2::Details::Details(const Json::Value &json)
{
const auto& result = json["result"];
matchID = result["match_id"].asIn... | ```c++
#include "details.hpp"
#include "json/json.h"
dota2::DetailsRequest &dota2::DetailsRequest::id(MatchID id)
{
query.insert({"match_id", std::to_string(id)});
return *this;
}
dota2::Details::Details(const Json::Value &json)
{
const auto& result = json["result"];
matchID = result["match_id"].asIn... |
ce7e3fd0-e8a8-4c2b-96cc-cddcceafe7e4 | {
"language": "C++"
} | ```c++
#include "Button.hpp"
#include <Engine/Geometry/Rectangle.hpp>
#include <Engine/Util/Input.hpp>
using namespace GUI;
Button::Button(Widget* parent) : Widget(parent) {
mouseHover = false;
hasClickedCallback = false;
size = glm::vec2(64.f, 64.f);
}
Button::~Button() {
}
void Button::Update() ... | ```c++
#include "Button.hpp"
#include <Engine/Geometry/Rectangle.hpp>
#include <Engine/Util/Input.hpp>
#include <Engine/Physics/Rectangle.hpp>
using namespace GUI;
Button::Button(Widget* parent) : Widget(parent) {
mouseHover = false;
hasClickedCallback = false;
size = glm::vec2(64.f, 64.f);
}
Button::~B... |
dda05fbb-00b7-4f30-a79a-a23d2df7841c | {
"language": "C++"
} | ```c++
#include "StorageDeleteFileChunkJob.h"
#include "System/Stopwatch.h"
#include "System/FileSystem.h"
#include "StorageFileChunk.h"
StorageDeleteFileChunkJob::StorageDeleteFileChunkJob(StorageFileChunk* chunk_)
{
chunk = chunk_;
}
void StorageDeleteFileChunkJob::Execute()
{
Stopwatch sw;
Buffer ... | ```c++
#include "StorageDeleteFileChunkJob.h"
#include "System/Stopwatch.h"
#include "System/FileSystem.h"
#include "StorageFileChunk.h"
StorageDeleteFileChunkJob::StorageDeleteFileChunkJob(StorageFileChunk* chunk_)
{
chunk = chunk_;
}
void StorageDeleteFileChunkJob::Execute()
{
Stopwatch sw;
Buffer ... |
7326f27f-0686-49ea-87e4-dd21f75f8ff5 | {
"language": "C++"
} | ```c++
#include <miniMAT/ast/WhoStmt.hpp>
#include <iostream>
namespace miniMAT {
namespace ast {
std::string WhoStmt::GetClassName() const {
return "WhoStmt";
}
void WhoStmt::VisitDisplay(const std::string& prefix) const {
using namespace miniMAT::visit::display;
... | ```c++
#include <miniMAT/ast/WhoStmt.hpp>
#include <iostream>
namespace miniMAT {
namespace ast {
std::string WhoStmt::GetClassName() const {
return "WhoStmt";
}
void WhoStmt::VisitDisplay(const std::string& prefix) const {
using namespace miniMAT::visit::display;
... |
ab30319f-39c6-4610-abd4-d6c917bb0bfd | {
"language": "C++"
} | ```c++
// Copyright (c) 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 "net/ftp/ftp_network_layer.h"
#include "net/ftp/ftp_network_session.h"
#include "net/ftp/ftp_network_transaction.h"
#include "net/soc... | ```c++
// Copyright (c) 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 "net/ftp/ftp_network_layer.h"
#include "net/ftp/ftp_network_session.h"
#include "net/ftp/ftp_network_transaction.h"
#include "net/soc... |
bf7456c1-94eb-4332-ac60-907f23ad74ac | {
"language": "C++"
} | ```c++
#include <catch.hpp>
#include "WordDecoder.hpp"
namespace {
using namespace Core8;
TEST_CASE("Decode X from pattern vXvv", "[decoder]") {
REQUIRE(WordDecoder::readX(0x0F00) == 0XF);
REQUIRE(WordDecoder::readX(0xF0FF) == 0X0);
}
TEST_CASE("Decode Y from pattern vvYv", "[decoder]") {
REQUIRE(WordDecoder... | ```c++
#include <catch.hpp>
#include "WordDecoder.hpp"
namespace {
using namespace Core8;
TEST_CASE("Decode X from pattern vXvv", "[decoder]") {
REQUIRE(WordDecoder::readX(0x0F00) == 0XF);
REQUIRE(WordDecoder::readX(0xF0FF) == 0X0);
}
TEST_CASE("Decode Y from pattern vvYv", "[decoder]") {
REQUIRE(WordDecoder... |
eecf28b4-a933-4226-becb-359db4d3ec3e | {
"language": "C++"
} | ```c++
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2011 Daniel Marth <danielmarth@gmx.at>
//
#include "RelatedActivities.h"
n... | ```c++
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2011 Daniel Marth <danielmarth@gmx.at>
//
#include "RelatedActivities.h"
n... |
234dc899-8e15-47d0-bb04-0a3b45a17684 | {
"language": "C++"
} | ```c++
#include "../kontsevich_graph_series.hpp"
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
if (argc != 2)
{
cout << "Usage: " << argv[0] << " [order]\n";
return 1;
}
size_t order = stoi(argv[1]);
set<KontsevichGraph> relevants = KontsevichGraph::grap... | ```c++
#include "../kontsevich_graph_series.hpp"
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
if (argc != 2)
{
cout << "Usage: " << argv[0] << " [order]\n";
return 1;
}
size_t order = stoi(argv[1]);
set<KontsevichGraph> relevants = KontsevichGraph::grap... |
cd9a742b-2969-4052-83a1-e89b65894c7e | {
"language": "C++"
} | ```c++
#include "compiler/build_tables/item_set_closure.h"
#include <algorithm>
#include <set>
#include "tree_sitter/compiler.h"
#include "compiler/build_tables/follow_sets.h"
#include "compiler/build_tables/item.h"
#include "compiler/prepared_grammar.h"
namespace tree_sitter {
using std::set;
using rules::Sym... | ```c++
#include "compiler/build_tables/item_set_closure.h"
#include <algorithm>
#include <set>
#include "tree_sitter/compiler.h"
#include "compiler/build_tables/follow_sets.h"
#include "compiler/build_tables/item.h"
#include "compiler/prepared_grammar.h"
namespace tree_sitter {
using std::set;
using rules::Sym... |
4e1571ff-3a74-49ef-a4a0-e5fb91a38b47 | {
"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.
//
//===---------------------------------... |
0a89e6de-c335-4a19-afc0-b1ce5ca2cf1d | {
"language": "C++"
} | ```c++
// RUN: %llvmgxx %s -S -emit-llvm -O2 -o - | grep -c {handle\\|_Unwind_Resume} | grep {\[14\]}
struct One { };
struct Two { };
void handle_unexpected () {
try
{
throw;
}
catch (One &)
{
throw Two ();
}
}
```
Use "ignore" rather than grep tricks. | ```c++
// RUN: %llvmgxx %s -S -emit-llvm -O2 -o - | ignore grep _Unwind_Resume | \
// RUN: wc -l | grep {\[03\]}
struct One { };
struct Two { };
void handle_unexpected () {
try
{
throw;
}
catch (One &)
{
throw Two ();
}
}
``` |
178e6dec-69a6-4d67-806b-e3e528492f4a | {
"language": "C++"
} | ```c++
/******************************************************************************
* Copyright (C) 2011 Frank Osterfeld <frank.osterfeld@gmail.com> *
* *
* This program is distributed in the hope that it will be useful, but ... | ```c++
/******************************************************************************
* Copyright (C) 2011 Frank Osterfeld <frank.osterfeld@gmail.com> *
* *
* This program is distributed in the hope that it will be useful, but ... |
d9b8b55c-1743-4324-8d86-c201b120f5ab | {
"language": "C++"
} | ```c++
// RUN: %clangxx_asan -O0 %s -o %t && %t
// Regression test for PR17138.
#include <assert.h>
#include <string.h>
int main() {
char buf[1024];
char *res = (char *)strerror_r(300, buf, sizeof(buf));
assert(res != 0);
return 0;
}
```
Remove a check from strerror_r test. | ```c++
// RUN: %clangxx_asan -O0 %s -o %t && %t
// Regression test for PR17138.
#include <assert.h>
#include <string.h>
#include <stdio.h>
int main() {
char buf[1024];
char *res = (char *)strerror_r(300, buf, sizeof(buf));
printf("%p\n", res);
return 0;
}
``` |
465620c5-74a1-48a0-9093-a49c31d3e83f | {
"language": "C++"
} | ```c++
//===- MRegisterInfo.cpp - Target Register Information Implementation -----===//
//
// This file implements the MRegisterInfo interface.
//
//===----------------------------------------------------------------------===//
#include "llvm/Target/MRegisterInfo.h"
MRegisterInfo::MRegisterInfo(const MRegisterDesc *D... | ```c++
//===- MRegisterInfo.cpp - Target Register Information Implementation -----===//
//
// This file implements the MRegisterInfo interface.
//
//===----------------------------------------------------------------------===//
#include "llvm/Target/MRegisterInfo.h"
MRegisterInfo::MRegisterInfo(const MRegisterDesc *D... |
6e7dc8b6-dbc9-43fe-ab28-e661954d0d2b | {
"language": "C++"
} | ```c++
#include "FileSystem.h"
#include "android/AndroidServices.h"
#include <stdexcept>
#include <fstream>
#include <sstream>
#include <android/log.h>
namespace yarrar {
namespace filesystem {
void readFile(const std::string& relativePath, std::string& toBuffer)
{
auto assetManager = yarrar::android::getAssetM... | ```c++
#include "FileSystem.h"
#include "android/AndroidServices.h"
#include <stdexcept>
#include <fstream>
#include <sstream>
namespace {
class AndroidFile
{
public:
AndroidFile(const std::string& path):
m_path(path),
m_file(nullptr)
{
m_file = AAssetManager_open(yarrar::android::ge... |
9cba49cb-c299-4829-97ed-8ebc59534acc | {
"language": "C++"
} | ```c++
#include "pch.h"
#include "MidiNrpnParameterValueChangeMessage.h"
using namespace PeteBrown::Devices::Midi;
MidiNrpnParameterValueChangeMessage::MidiNrpnParameterValueChangeMessage()
{
_rawData = ref new Windows::Storage::Streams::Buffer(TOTAL_BYTES_IN_MESSAGE);
_rawData->Length = TOTAL_BYTES_IN_MESSAGE;
... | ```c++
#include "pch.h"
#include "MidiNrpnParameterValueChangeMessage.h"
using namespace PeteBrown::Devices::Midi;
MidiNrpnParameterValueChangeMessage::MidiNrpnParameterValueChangeMessage()
{
_rawData = ref new Windows::Storage::Streams::Buffer(TOTAL_BYTES_IN_MESSAGE);
_rawData->Length = TOTAL_BYTES_IN_MESSAGE;
... |
12f55e46-db95-45c1-9100-e77a09cb1ae9 | {
"language": "C++"
} | ```c++
#include "robot_name.h"
#include <sstream>
#include <stdexcept>
using namespace std;
namespace robot_name
{
namespace
{
string next_prefix(string prefix)
{
string next{prefix};
const string letters{"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"};
if (prefix[1] == letters.back()) {
... | ```c++
#include "robot_name.h"
#include <iomanip>
#include <sstream>
#include <stdexcept>
using namespace std;
namespace robot_name
{
namespace
{
string next_prefix(string prefix)
{
string next{prefix};
const string letters{"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"};
if (prefix[1] == letter... |
fc33f2d1-ff42-49ac-809e-67e810b8677b | {
"language": "C++"
} | ```c++
#define __STDC_CONSTANT_MACROS
#include <stdlib.h>
extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
}
#define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
static void test()
{
AVFormatContext* c = 0;
AVCodec* avcodec = 0;
AVFrame* frame =... | ```c++
#define __STDC_CONSTANT_MACROS
#include <stdlib.h>
extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
}
#define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
static void test()
{
AVFormatContext* c = 0;
AVCodec* avcodec = 0;
AVFrame* frame =... |
9c7ed15f-e639-46cc-b2b9-a0b09783885c | {
"language": "C++"
} | ```c++
#include <iostream>
#include <string>
using std::string;
using std::cout;
using std::endl;
int main()
{
string str("a simple string");
// while
decltype(str.size()) i = 0;
while (i < str.size()) str[i++] = 'X';
cout << str << endl;
// for
for (i = 0; i<str.size(); ++i) str[i] =... | ```c++
#include <iostream>
#include <string>
using std::string;
using std::cout;
using std::endl;
int main()
{
string str("a simple string");
// while
decltype(str.size()) i = 0;
while (i < str.size()) str[i++] = 'X';
cout << str << endl;
// for
for (i = 0; i < str.size(); str[i++] = ... |
4484ef65-89e0-4a9f-b8a2-421620842939 | {
"language": "C++"
} | ```c++
//
// shaderImageMask.cpp
// shaderExample
//
// Created by Alex Olivier on 6/6/14.
//
// This example shows how to pass multiple textures
// to a shader. It uses one texture as a mask.
// Based on openFrameworks shader tutorials
#include "shaderImageMask.h"
shaderImageMask::shaderImageMask(string iFil... | ```c++
//
// shaderImageMask.cpp
// shaderExample
//
// Created by Alex Olivier on 6/6/14.
//
// This example shows how to pass multiple textures
// to a shader. It uses one texture as a mask.
// Based on openFrameworks shader tutorials
#include "shaderImageMask.h"
shaderImageMask::shaderImageMask(string iFil... |
894b12ef-88bc-43ff-a63e-534f14c1d4ba | {
"language": "C++"
} | ```c++
#include <thread>
#include <renderer.hpp>
#include <fensterchen.hpp>
int main(int argc, char* argv[])
{
unsigned const width = 800;
unsigned const height = 600;
std::string const filename = "./checkerboard.ppm";
Renderer app(width, height, filename);
std::thread thr([&app]() { app.render(); });
W... | ```c++
#include <thread>
#include <renderer.hpp>
#include <fensterchen.hpp>
int main(int argc, char* argv[])
{
unsigned const width = 600;
unsigned const height = 600;
std::string const filename = "./checkerboard.ppm";
Renderer app(width, height, filename);
std::thread thr([&app]() { app.render(); });
W... |
a1a89c6d-a256-417e-bc20-2b38d4e47b26 | {
"language": "C++"
} | ```c++
// ThermoFun includes
#include <Thermofun/ThermoFun.hpp>
using namespace ThermoFun;
int main()
{
Database db("aq17.json");
}
```
Fix include header statement of test | ```c++
// ThermoFun includes
#include <ThermoFun/ThermoFun.hpp>
using namespace ThermoFun;
int main()
{
Database db("aq17.json");
}
``` |
ae917fe6-c842-45f9-89c3-40819ee1eb77 | {
"language": "C++"
} | ```c++
/* Copyright 2014 Dietrich Epp.
This file is part of Oubliette. Oubliette is licensed under the terms
of the 2-clause BSD license. For more information, see LICENSE.txt. */
#include "stats.hpp"
namespace game {
const walking_stats stats::player = {
600.0f,
// Walking
1200.0f, 120.0f, 300.0f,... | ```c++
/* Copyright 2014 Dietrich Epp.
This file is part of Oubliette. Oubliette is licensed under the terms
of the 2-clause BSD license. For more information, see LICENSE.txt. */
#include "stats.hpp"
namespace game {
const walking_stats stats::player = {
600.0f,
// Walking
1200.0f, 120.0f, 300.0f,... |
764c9f69-e4e2-418b-919e-325ede4850dd | {
"language": "C++"
} | ```c++
//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===------------------------------------------------... | ```c++
//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===------------------------------------------------... |
3bba6887-4a58-457c-ab6e-79bdf48ae5da | {
"language": "C++"
} | ```c++
#include <iostream>
#include "../../rltk/rltk.hpp"
#include <sstream>
bool tick(double duration_ms) {
auto res = rltk::get_screen_size_px();
std::stringstream ss;
ss << "Frame duration: " << duration_ms << " ms. Resolution: " << res.first << "x" << res.second;
rltk::cls_root();
rltk::print_to_root(1, 1, ss... | ```c++
#include <iostream>
#include "../../rltk/rltk.hpp"
#include <sstream>
bool tick(double duration_ms) {
auto res = rltk::get_screen_size_px();
std::stringstream ss;
ss << "Frame duration: " << duration_ms << " ms (" << (1000.0/duration_ms) << " FPS). Resolution: " << res.first << "x" << res.second;
rltk::cls_... |
0f5c177f-7714-49f4-92cb-204f3cdcb932 | {
"language": "C++"
} | ```c++
#include <boost/optional.hpp>
#include "move.hh"
#include "../../../src/contents.hh"
namespace vick {
namespace move {
boost::optional< std::shared_ptr<change> > mvsot(contents& contents, boost::optional<int>) {
contents.waiting_for_desired = false;
contents.x = 0;
for(auto x : contents.cont[conte... | ```c++
#include <boost/optional.hpp>
#include "move.hh"
#include "../../../src/contents.hh"
namespace vick {
namespace move {
boost::optional< std::shared_ptr<change> > mvsot(contents& contents, boost::optional<int>) {
contents.waiting_for_desired = false;
contents.x = 0;
for(auto c : contents.cont[conte... |
8cc32455-0fd5-48af-ae61-587260e64a9d | {
"language": "C++"
} | ```c++
#include "nslog.h"
#include <node.h>
using namespace v8;
namespace {
Handle<Value> Log(const Arguments& args) {
String::Utf8Value utf8_string(Local<String>::Cast(args[0]));
nslog::Log(*utf8_string);
return Undefined();
}
void Init(Handle<Object> exports) {
NODE_SET_METHOD(exports, "log", Log);
}
} ... | ```c++
#include "nslog.h"
#include "nan.h"
using namespace v8;
namespace {
NAN_METHOD(Log) {
NanScope();
String::Utf8Value utf8_string(Local<String>::Cast(args[0]));
nslog::Log(*utf8_string);
NanReturnUndefined();
}
void Init(Handle<Object> exports) {
NODE_SET_METHOD(exports, "log", Log);
}
} // names... |
32317eea-93f8-4bb9-9ae0-d3ba04e13fdb | {
"language": "C++"
} | ```c++
#include "logger.h"
Logger g_logger;
//------------------------------------------------------------------------------
LogViewer::LogViewer(QWidget* parent)
: QPlainTextEdit(parent)
{ }
void LogViewer::connectLogger(Logger* logger)
{
connect(logger, SIGNAL(logMessage(int, QString)),
this,... | ```c++
#include "logger.h"
Logger g_logger;
//------------------------------------------------------------------------------
LogViewer::LogViewer(QWidget* parent)
: QPlainTextEdit(parent)
{ }
void LogViewer::connectLogger(Logger* logger)
{
connect(logger, SIGNAL(logMessage(int, QString)),
this,... |
721840ba-bfb5-4e1e-a6ef-a6ea87dd8296 | {
"language": "C++"
} | ```c++
#include "game/state/rules/city/vammotype.h"
#include "game/state/gamestate.h"
namespace OpenApoc
{
const UString &VAmmoType::getPrefix()
{
static UString prefix = "VAMMOTYPE_";
return prefix;
}
const UString &VAmmoType::getTypeName()
{
static UString name = "VAmmoType";
return name;
}
sp<VAmmoType> VAmm... | ```c++
#include "game/state/rules/city/vammotype.h"
#include "game/state/gamestate.h"
namespace OpenApoc
{
const UString &VAmmoType::getPrefix()
{
static UString prefix = "VEQUIPMENTAMMOTYPE_";
return prefix;
}
const UString &VAmmoType::getTypeName()
{
static UString name = "VAmmoType";
return name;
}
sp<VAmmoT... |
faf58acc-199a-44ab-a1ba-cf686d5aff5d | {
"language": "C++"
} | ```c++
#include<ros/ros.h>
#include<servo_msgs/IdBased.h>
#include<ics3/ics>
ics::ICS3* driver {nullptr};
ros::Publisher pub;
void move(const servo_msgs::IdBased::ConstPtr& msg) {
servo_msgs::IdBased result;
try {
auto&& now_pos = driver->move(msg->id, ics::Angle::newDegree(msg->angle));
result.angle = st... | ```c++
#include<ros/ros.h>
#include<servo_msgs/IdBased.h>
#include<ics3/ics>
ics::ICS3* driver {nullptr};
ros::Publisher pub;
void move(const servo_msgs::IdBased::ConstPtr& msg) {
servo_msgs::IdBased result;
try {
auto now_pos = driver->move(msg->id, ics::Angle::newRadian(msg->angle));
result.angle = std:... |
50fb2b1d-0530-4c7a-aacf-58ac9905a7e4 | {
"language": "C++"
} | ```c++
#include "nodes/ui/float_info.h"
#include "elements/ui/float_info.h"
#include <QTableWidget>
#include <QGraphicsSimpleTextItem>
namespace nodes::ui {
FloatInfo::FloatInfo()
{
QFont font{};
font.setPixelSize(32);
auto widget = new QGraphicsSimpleTextItem("0.0");
widget->setFont(font);
QPointF widget... | ```c++
#include "nodes/ui/float_info.h"
#include "elements/ui/float_info.h"
#include <QTableWidget>
#include <QGraphicsSimpleTextItem>
namespace nodes::ui {
FloatInfo::FloatInfo()
{
QFont font{};
font.setPixelSize(32);
auto widget = new QGraphicsSimpleTextItem("0.0");
widget->setFont(font);
QPointF widget... |
8f9676d4-caa8-4dcc-9a9e-fd91887012b7 | {
"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 "GameController.h"
#include <QFile... | ```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 "GameController.h"
#include <QFile... |
db2965dd-cf49-416b-a972-bed74ac9ac7d | {
"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.
//
//===---------------------------------... |
65e8e02c-84bf-4c29-b92b-d6a5d5c33bd2 | {
"language": "C++"
} | ```c++
#include "sipnondialogclient.h"
#include <QDebug>
SIPNonDialogClient::SIPNonDialogClient(SIPTransactionUser *tu): SIPClientTransaction (tu)
{}
void SIPNonDialogClient::set_remoteURI(SIP_URI& uri)
{
remoteUri_ = uri;
}
void SIPNonDialogClient::getRequestMessageInfo(RequestType type,
... | ```c++
#include "sipnondialogclient.h"
#include <QDebug>
SIPNonDialogClient::SIPNonDialogClient(SIPTransactionUser *tu): SIPClientTransaction (tu)
{}
void SIPNonDialogClient::set_remoteURI(SIP_URI& uri)
{
remoteUri_ = uri;
}
void SIPNonDialogClient::getRequestMessageInfo(RequestType type,
... |
c6ee93e5-61d5-4256-bacb-72b84344726a | {
"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 "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/tools/test_... | ```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 "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/tools/test_... |
91b593e5-c51c-4ec4-9efb-5485beaef773 | {
"language": "C++"
} | ```c++
#include "bitfield.h"
unsigned long getBitField(uint8_t* data, int start_bit, int num_bits) {
unsigned long ret = 0;
int start_byte = start_bit / 8;
if (num_bits <= 8 ) {
// Bit fields are positioned according to big-endian bit layout, but
// inside the bit field, values are represented as l... | ```c++
#include "bitfield.h"
unsigned long getBitField(uint8_t* data, int startBit, int numBits) {
unsigned long ret = 0;
int startByte = startBit / 8;
if (numBits <= 8 ) {
// Bit fields are positioned according to big-endian bit layout, but
// inside the bit field, values are represented as little... |
e719e441-0d1e-454b-b9c0-eca95498369f | {
"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/Enchants/Enchant.hpp>
namespace RosettaStone... | ```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/Enchants/Enchant.hpp>
namespace RosettaStone... |
9c6c5381-e95d-4acf-928c-d9d950806045 | {
"language": "C++"
} | ```c++
/**
* @file example.cpp
* @author Marcus Edel
*
* Simple random agent.
*/
#include <iostream>
#include "environment.hpp"
using namespace gym;
int main(int argc, char* argv[])
{
const std::string environment = "CartPole-v0";
const std::string host = "127.0.0.1";
const std::string port = "4040";
... | ```c++
/**
* @file example.cpp
* @author Marcus Edel
*
* Simple random agent.
*/
#include <iostream>
#include "environment.hpp"
using namespace gym;
int main(int argc, char* argv[])
{
const std::string environment = "SpaceInvaders-v0";
const std::string host = "kurg.org";
const std::string port = "4040";... |
5a86269e-8cca-4345-96aa-6bf9dffb472f | {
"language": "C++"
} | ```c++
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/test/ui/ui_test.h"
class LocaleTestsDa : public UITest {
public:
LocaleTestsDa() : UITest() {
launch_arguments_.A... | ```c++
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/test/ui/ui_test.h"
class LocaleTestsDa : public UITest {
public:
LocaleTestsDa() : UITest() {
launch_arguments_.A... |
43716e81-be57-489e-a9a4-064b961ee9e4 | {
"language": "C++"
} | ```c++
//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===------------------------------------------------... | ```c++
//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===------------------------------------------------... |
a70609c3-b31e-4c7e-96d3-dce8070420c5 | {
"language": "C++"
} | ```c++
// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
// RUN: remove-cstr-calls . %t.cpp --
// RUN: FileCheck -input-file=%t.cpp %s
// REQUIRES: shell
namespace std {
template<typename T> class allocator {};
template<typename T> class char_traits {};
template<typename C, typename T, typename A> struct basic_string {
ba... | ```c++
// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
// RUN: remove-cstr-calls . %t.cpp --
// RUN: FileCheck -input-file=%t.cpp %s
// REQUIRES: shell
namespace std {
template<typename T> class allocator {};
template<typename T> class char_traits {};
template<typename C, typename T, typename A> struct basic_string {
ba... |
4f1323e2-4221-4633-92b7-e94ce4a0f62e | {
"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 "ppapi/proxy/ppapi_messages.h"
#include "base/file_path.h"
#include "ipc/ipc_channel_handle.h"
#include "ppapi/c/dev/pp_file_info_dev... | ```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 "ppapi/proxy/ppapi_messages.h"
#include "base/file_path.h"
#include "ipc/ipc_channel_handle.h"
#include "ppapi/c/dev/pp_file_info_dev... |
db901c19-cd4a-4a9e-8b9e-14de5e892236 | {
"language": "C++"
} | ```c++
#include <Nazara/Audio.hpp>
#include <Nazara/Core.hpp>
#include <Nazara/Graphics.hpp>
#include <Nazara/Lua.hpp>
#include <Nazara/Network.hpp>
#include <Nazara/Noise.hpp>
#include <Nazara/Physics.hpp>
#include <Nazara/Renderer.hpp>
#include <Nazara/Utility.hpp>
#include <NDK/Application.hpp>
#include <iostream>
... | ```c++
#include <Nazara/Audio.hpp>
#include <Nazara/Core.hpp>
#include <Nazara/Graphics.hpp>
#include <Nazara/Lua.hpp>
#include <Nazara/Network.hpp>
#include <Nazara/Noise.hpp>
#include <Nazara/Physics2D.hpp>
#include <Nazara/Physics3D.hpp>
#include <Nazara/Renderer.hpp>
#include <Nazara/Utility.hpp>
#include <NDK/App... |
e1af36db-1444-4794-8e6f-5d802bda1f9c | {
"language": "C++"
} | ```c++
// RUN: %clang_analyze_cc1 -analyzer-checker=optin.osx.OSObjectCStyleCast %s -verify
#include "os_object_base.h"
struct OSArray : public OSObject {
unsigned getCount();
};
struct A {
int x;
};
struct B : public A {
unsigned getCount();
};
unsigned warn_on_explicit_downcast(OSObject * obj) {
OSArray *a... | ```c++
// RUN: %clang_analyze_cc1 -analyzer-checker=optin.osx.OSObjectCStyleCast %s -verify
#include "os_object_base.h"
struct OSArray : public OSObject {
unsigned getCount();
};
struct A {
int x;
};
struct B : public A {
unsigned getCount();
};
unsigned warn_on_explicit_downcast(OSObject * obj) {
OSArray *a... |
a5694819-50a1-4040-b5c7-4fa3c8e8d65a | {
"language": "C++"
} | ```c++
// Ouzel by Elviss Strazdins
#include "RenderTarget.hpp"
#include "Graphics.hpp"
#include "Texture.hpp"
namespace ouzel::graphics
{
RenderTarget::RenderTarget(Graphics& initGraphics,
const std::vector<Texture*>& initColorTextures,
Texture* initD... | ```c++
// Ouzel by Elviss Strazdins
#include "RenderTarget.hpp"
#include "Graphics.hpp"
#include "Texture.hpp"
namespace ouzel::graphics
{
RenderTarget::RenderTarget(Graphics& initGraphics,
const std::vector<Texture*>& initColorTextures,
Texture* initD... |
6fc6ce70-aff7-4d0c-8a98-7428a3b4c7d6 | {
"language": "C++"
} | ```c++
#include "grune/grammars/anbncn.hpp"
#include "grune/grammars/turtle.hpp"
#include "grune/grammars/tom_dick_and_harry.hpp"
#include "grune-yaml/grune-yaml.hpp"
#include <fstream>
#define MAKE_SAMPLE(name) \
do { \
std::ofstream out(#name ".yaml"); \
out << YAML::Node(grune::grammars::name()... | ```c++
#include "grune/grammars/anbncn.hpp"
#include "grune/grammars/turtle.hpp"
#include "grune/grammars/tom_dick_and_harry.hpp"
#include "grune-yaml/grune-yaml.hpp"
#include <fstream>
#define MAKE_SAMPLE_IMPL(name) \
do { \
std::ofstream out(#name ".yaml"); \
out << YAML::Node(grune::grammars::n... |
5cb70c4a-5bad-4964-ab5c-2f845cc98607 | {
"language": "C++"
} | ```c++
// REQUIRES: x86-registered-target,x86-64-registered-target
// RUN: %clang_cc1 -triple x86_64-apple-darwin -S %s -o %t-64.s
// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
// RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s
// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-3... | ```c++
// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | \
// RUN: FileCheck %s
// RUN: %clang_cc1 -triple i386-apple-darwin -emit-llvm %s -o - | \
// RUN: FileCheck %s
struct A {};
struct B
{
operator A&();
};
struct D : public B {
operator A();
};
extern B f();
extern D d();
int main(... |
3bb78ef7-9ac3-4f58-92e3-b366d70de77a | {
"language": "C++"
} | ```c++
#include <iostream>
#include <string>
#include <vector>
#include "Window.h"
#include "ProceduralRenderer.h"
#include <glbinding/gl/gl.h>
#include <glbinding/Binding.h>
using namespace gl;
int main() {
Window w;
w.init("procedural");
glbinding::Binding::initialize();
std::cout << "OpenGL Vers... | ```c++
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include "Window.h"
#include "ProceduralRenderer.h"
#include <glbinding/gl/gl.h>
#include <glbinding/Binding.h>
using namespace gl;
std::map<std::string, std::string> parseArguments(int argc, char * argv[])
{
std::v... |
6b92330a-7666-4e1b-a944-4204221a0fd9 | {
"language": "C++"
} | ```c++
// RUN: clang-cc -fsyntax-only -verify %s
namespace N { };
namespace A = N;
int B; // expected-note {{previous definition is here}}
namespace B = N; // expected-error {{redefinition of 'B' as different kind of symbol}}
namespace C { } // expected-note {{previous definition is here}}
namespace C = N; // expec... | ```c++
// RUN: clang-cc -fsyntax-only -verify %s
namespace N { };
namespace A = N;
int B; // expected-note {{previous definition is here}}
namespace B = N; // expected-error {{redefinition of 'B' as different kind of symbol}}
namespace C { } // expected-note {{previous definition is here}}
namespace C = N; // expec... |
4eba33a0-00cc-4d96-b8d8-53bdef259663 | {
"language": "C++"
} | ```c++
#include "list.h"
#include "gtest/gtest.h"
#include <string>
class listTest : public testing::Test {
protected:
virtual void SetUp() {
// NOT YET IMPLEMENTED
}
virtual void TearDown() {}
// setup fixtures
list<int> list_1;
list<int> list_2;
list<std::string> list_str;
};
TEST(listNodeTest, D... | ```c++
#include "list.h"
#include "gtest/gtest.h"
#include <string>
class listTest : public testing::Test {
protected:
virtual void SetUp() {
// NOT YET IMPLEMENTED
}
virtual void TearDown() {}
// setup fixtures
list<int> list_1;
list<int> list_2;
list<std::string> list_str;
};
// test the helper c... |
0acb737c-4878-4ab0-90bc-f60f457c0f2c | {
"language": "C++"
} | ```c++
/*
*
* Copyright 2019 gRPC authors.
*
* 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 o... | ```c++
/*
*
* Copyright 2019 gRPC authors.
*
* 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 o... |
5c60f1ea-e898-4ec0-9b7f-518b16cdd73d | {
"language": "C++"
} | ```c++
#include "jsonparser.h"
JSONParser::JSONParser(QObject *parent) :
QObject(parent)
{
clearData();
}
void JSONParser::clearData()
{
p_data = "{ ";
}
void JSONParser::addVariable(const QString name, int value)
{
p_data.append("\"");
p_data.append(name);
p_data.append("\":");
p_data.ap... | ```c++
#include "jsonparser.h"
JSONParser::JSONParser(QObject *parent) :
QObject(parent)
{
clearData();
}
void JSONParser::clearData()
{
p_data = "{ ";
}
void JSONParser::addVariable(const QString name, int value)
{
p_data.append("\"");
p_data.append(name);
p_data.append("\":");
p_data.ap... |
cf721489-a416-44ee-a689-aea0056dbb5a | {
"language": "C++"
} | ```c++
/**
* Coverity Scan model
*
* Manage false positives by giving coverity some hints.
*
* Updates to this file must be manually submitted by an admin to:
*
* https://scan.coverity.com/projects/1222
*
*/
// When tag is 1 or 2, let coverity know that execution is halting. Those
// tags correspond to INT_... | ```c++
/**
* Coverity Scan model
*
* Manage false positives by giving coverity some hints.
*
* Updates to this file must be manually submitted by an admin to:
*
* https://scan.coverity.com/projects/1222
*
*/
// When tag is 1 or 2, let coverity know that execution is halting. Those
// tags correspond to INT_... |
79075c9c-da23-4ebb-85a5-bb3250f4ec8f | {
"language": "C++"
} | ```c++
// RUN: clang-cc -emit-llvm -triple x86_64-apple-darwin10 -o - %s | FileCheck %s
template<typename T>
struct X {
static T member1;
static T member2;
static T member3;
};
template<typename T>
T X<T>::member1;
template<typename T>
T X<T>::member2 = 17;
// CHECK: @_ZN1XIiE7member1E = global i32 0
template ... | ```c++
// RUN: clang-cc -emit-llvm -triple x86_64-apple-darwin10 -o - %s | FileCheck %s
template<typename T>
struct X {
static T member1;
static T member2;
static T member3;
};
template<typename T>
T X<T>::member1;
template<typename T>
T X<T>::member2 = 17;
// CHECK: @_ZN1XIiE7member1E = global i32 0
template ... |
ca7753bd-9366-4c83-aaea-b638aa90bc3b | {
"language": "C++"
} | ```c++
#include "caffe2/operators/scale_op.h"
namespace caffe2 {
REGISTER_CPU_OPERATOR(Scale, ScaleOp<float, CPUContext>);
OPERATOR_SCHEMA(Scale)
.NumInputs(1)
.NumOutputs(1)
.AllowInplace({{0, 0}})
.SetDoc(R"DOC(
Scale takes one input data (Tensor<float>) and produces one output data
(Tensor<float>) whose va... | ```c++
#include "caffe2/operators/scale_op.h"
namespace caffe2 {
REGISTER_CPU_OPERATOR(Scale, ScaleOp<float, CPUContext>);
OPERATOR_SCHEMA(Scale)
.NumInputs(1)
.NumOutputs(1)
.AllowInplace({{0, 0}})
.SetDoc(R"DOC(
Scale takes one input data (Tensor<float>) and produces one output data
(Tensor<float>) whose va... |
a4a3b410-e48e-4a39-897f-a7e004dca889 | {
"language": "C++"
} | ```c++
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#include "MyGUI_ControllerRepeatClick.h"
namespace MyGUI
{
ControllerRepeatClick::ControllerRepeatC... | ```c++
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#include "MyGUI_ControllerRepeatClick.h"
namespace MyGUI
{
ControllerRepeatClick::ControllerRepeatC... |
28de2df2-75fc-4654-ba3b-90e7648e7019 | {
"language": "C++"
} | ```c++
// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "core/fpdfapi/fpdf_page/cpdf_contentmarkitem.h"
#include "cor... | ```c++
// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "core/fpdfapi/fpdf_page/cpdf_contentmarkitem.h"
#include "cor... |
d5eed5ac-ad3d-44df-a661-f4d924e1526f | {
"language": "C++"
} | ```c++
#include "ofMain.h"
#include "ofApp.h"
int main()
{
ofSetupOpenGL(600, 500, OF_WINDOW);
ofRunApp(new ofApp());
}```
Add fullscreen for Raspberry Pi | ```c++
#include "ofMain.h"
#include "ofApp.h"
int main()
{
#ifdef TARGET_RASPBERRY_PI
ofSetupOpenGL(600, 500, OF_FULLSCREEN);
#else
ofSetupOpenGL(600, 500, OF_WINDOW);
#endif
ofRunApp(new ofApp());
}``` |
6f9e8d29-76e3-4f85-a887-24e84f4b9ff3 | {
"language": "C++"
} | ```c++
#include <iostream>
#include <tcp/tcp_server.hpp>
#include <sstream>
int main(int argc, char** argv)
{
//initialize default port number and max connection cout
int port = 12001, max_connection_count= 1000;
// check if there are any passed arguments
if(argc > 1)
{
// initialize string stream from ... | ```c++
#include <iostream>
#include <tcp/tcp_server.hpp>
#include <sstream>
int main(int argc, char** argv)
{
//initialize default port number and max connection cout
int port = 12001, max_connection_count= 1000;
// check if there are any passed arguments
if(argc > 1)
{
// initialize string stream from ... |
2e35f788-a987-4a81-9d7b-7228ba992533 | {
"language": "C++"
} | ```c++
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool isValidBSTInternal(TreeNode* root, int minVal, int maxVal)
{
if (root =... | ```c++
#include <cstddef>
#include <climits>
/**
* Definition for a binary tree node.
*/
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
bool isValidBSTInternal(TreeNode* root, int minVal, int maxVal)
... |
595fd5f6-fab2-4f73-9b3e-4e0f29fda3e6 | {
"language": "C++"
} | ```c++
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "AsynchronousEventBeat.h"
namespace facebook {
namespace react {
AsynchronousEventBeat::AsynchronousEventBeat(
... | ```c++
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "AsynchronousEventBeat.h"
#include <react/debug/react_native_assert.h>
namespace facebook {
namespace react {
As... |
01d108a2-c347-497c-a102-001c71eb3969 | {
"language": "C++"
} | ```c++
#include <gtest/gtest.h>
#include "Vector2f.h"
TEST(Vector2fTest, VectorAddition) {
Vector2f v1(0, 0);
Vector2f v2(1, 2);
Vector2f v3(3, 4);
Vector2f result = v1 + v1;
EXPECT_FLOAT_EQ(0.0f, result.x);
EXPECT_FLOAT_EQ(0.0f, result.y);
result = v2 + v1;
EXPECT_FLOAT_EQ(v2.x, result.x);
EXPECT_FLOAT_E... | ```c++
#include <gtest/gtest.h>
#include "Vector2f.h"
Vector2f v1(0,0);
Vector2f v2(1, 2);
Vector2f v3(3, 4);
Vector2f v4(-5, 6);
TEST(Vector2fTest, VectorAddition) {
Vector2f result = v1 + v1;
EXPECT_FLOAT_EQ(0.0f, result.x);
EXPECT_FLOAT_EQ(0.0f, result.y);
result = v2 + v1;
EXPECT_FLOAT_EQ(v2.x, result.x)... |
6cef4603-89eb-4d29-b42e-d38eecc62b4f | {
"language": "C++"
} | ```c++
#include "cpptoml.h"
#include <iostream>
#include <cassert>
int main(int argc, char** argv)
{
if (argc < 2)
{
std::cout << "Usage: " << argv[0] << " filename" << std::endl;
return 1;
}
cpptoml::toml_group g = cpptoml::parse_file(argv[1]);
std::cout << g << std::endl;
ret... | ```c++
#include "cpptoml.h"
#include <iostream>
#include <cassert>
int main(int argc, char** argv)
{
if (argc < 2)
{
std::cout << "Usage: " << argv[0] << " filename" << std::endl;
return 1;
}
try
{
cpptoml::toml_group g = cpptoml::parse_file(argv[1]);
std::cout << ... |
3a2e1059-c85d-46ee-bf04-960cbd7856cd | {
"language": "C++"
} | ```c++
#include "Game/CannonBall.h"
CannonBall::CannonBall(const QPixmap & pixmap, QVector2D velocity, QVector2D position, Player owner, QGraphicsItem * parent) : Entity(pixmap, owner, parent), m_initialVelocity(velocity), m_initialPosition(position), m_gravity(9.8), m_timeSinceShot(0)
{
setScale(0.1);
setPos(m_init... | ```c++
#include "Game/CannonBall.h"
CannonBall::CannonBall(const QPixmap & pixmap, QVector2D velocity, QVector2D position, Player owner, QGraphicsItem * parent) : Entity(pixmap, owner, parent), m_initialVelocity(velocity), m_initialPosition(position), m_gravity(9.8), m_timeSinceShot(0)
{
setScale(0.1);
setPos(m_init... |
a9730cce-2e61-4f2a-a25d-7ee57581f341 | {
"language": "C++"
} | ```c++
// Check the value profiling instrinsics emitted by instrumentation.
// RUN: %clangxx %s -o - -emit-llvm -S -fprofile-instr-generate -mllvm -enable-value-profiling -fexceptions -target %itanium_abi_triple | FileCheck %s
void (*foo) (void);
int main(int argc, const char *argv[]) {
// CHECK: [[REG1:%[0-9]+]] =... | ```c++
// Check the value profiling instrinsics emitted by instrumentation.
// RUN: %clangxx %s -o - -emit-llvm -S -fprofile-instr-generate -mllvm -enable-value-profiling -fexceptions -target %itanium_abi_triple | FileCheck %s
void (*foo) (void);
int main(int argc, const char *argv[]) {
// CHECK: [[REG1:%[0-9]+]] =... |
e89002cc-8281-4761-acb2-0e750d1c2f27 | {
"language": "C++"
} | ```c++
#include <lightex/utils/file_utils.h>
#include <fstream>
#include <iostream>
namespace lightex {
namespace utils {
bool ReadDataFromFile(const std::string& path, std::string* output) {
if (!output) {
std::cerr << "Error: output pointer points to invalid memory." << std::endl;
return false;
}
st... | ```c++
#include <lightex/utils/file_utils.h>
#include <fstream>
#include <iostream>
#include <iterator>
namespace lightex {
namespace utils {
bool ReadDataFromFile(const std::string& path, std::string* output) {
if (!output) {
std::cerr << "Error: output pointer points to invalid memory." << std::endl;
ret... |
5cf21e66-dbe1-41ff-be88-58e322cd9b9e | {
"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 "ui/gfx/transform_util.h"
#include "ui/gfx/point.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(TransformUtilTest, GetScaleT... | ```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 "ui/gfx/transform_util.h"
#include "ui/gfx/point.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gfx {
namespace {
TEST... |
ade09efc-21cc-408a-b655-7a3a66be5a5c | {
"language": "C++"
} | ```c++
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
int _tmain(int argc, TCHAR * argv[])
{
if(1 >= argc)
{
_tprintf(_T("DummLoader.exe <DllName>*\n"));
return 0;
}
for(int i=1; i<argc; i++)
{
_tprintf(_T("Loading: \"%s\" "), argv[i]);
HMODULE hm = LoadLibrary(argv[i]);
_tp... | ```c++
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
int _tmain(int argc, TCHAR * argv[])
{
if(1 >= argc)
{
_tprintf(_T("DummLoader.exe <DllName>*\n"));
return 0;
}
for(int i=1; i<argc; i++)
{
_tprintf(_T("Loading: \"%s\" "), argv[i]);
HMODULE hm = LoadLibrary(argv[i]);
DWO... |
901f1def-3ce8-45a6-bd33-9859f7f93f63 | {
"language": "C++"
} | ```c++
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "functions.h"
#include "main-screen.h"
#include "models/profile.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
app.setApplicationN... | ```c++
#include <QDir>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "functions.h"
#include "main-screen.h"
#include "models/profile.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
app... |
8c919897-4f87-4a4c-9c96-206e3f140f47 | {
"language": "C++"
} | ```c++
/* The Halfling Project - A Graphics Engine and Projects
*
* The Halfling Project is the legal property of Adrian Astley
* Copyright Adrian Astley 2013
*/
#include "obj_loader_demo/obj_loader_demo.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
ObjLoad... | ```c++
/* The Halfling Project - A Graphics Engine and Projects
*
* The Halfling Project is the legal property of Adrian Astley
* Copyright Adrian Astley 2013
*/
#include "obj_loader_demo/obj_loader_demo.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
ObjLoad... |
2f483fff-4a8d-435e-8969-17fdb3f343e7 | {
"language": "C++"
} | ```c++
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "mmap_file_allocator_factory.h"
#include "mmap_file_allocator.h"
#include <vespa/vespalib/stllike/asciistream.h>
namespace vespalib::alloc {
MmapFileAllocatorFactory::MmapFileAllocatorFact... | ```c++
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "mmap_file_allocator_factory.h"
#include "mmap_file_allocator.h"
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/stllike/asciistream.h>
namespace vespalib::alloc {
MmapFil... |
160d9aca-0709-4dbe-bc85-54d0a2049287 | {
"language": "C++"
} | ```c++
// TODO: remove this later, hack for include order issues
#include "GLBlaat/GL.h"
#include <QApplication>
#include "Gui/MainWindow.h"
int main(int argc, char *argv[])
{
// Set up Qt application
QApplication app(argc, argv);
VFE::MainWindow *window = new VFE::MainWindow();
// Go!
window->s... | ```c++
// TODO: remove this later, hack for include order issues
#include "GLBlaat/GL.h"
#include <QApplication>
#include "Gui/MainWindow.h"
#include <vtkWin32ProcessOutputWindow.h>
int main(int argc, char *argv[])
{
#ifdef WIN32
// Use a more useful output window for VTK
vtkWin32ProcessOutputWindow *... |
144f7976-9846-4fb9-bf55-d18e6d806160 | {
"language": "C++"
} | ```c++
/** @file
@brief Implementation
@date 2014
@author
Ryan Pavlik
<ryan@sensics.com>
<http://sensics.com>
*/
// Copyright 2014 Sensics, Inc.
//
// All rights reserved.
//
// (Final version intended to be licensed under
// the Apache License, Version 2.0)
// Internal Includes
#include <os... | ```c++
/** @file
@brief Implementation
@date 2014
@author
Ryan Pavlik
<ryan@sensics.com>
<http://sensics.com>
*/
// Copyright 2014 Sensics, Inc.
//
// All rights reserved.
//
// (Final version intended to be licensed under
// the Apache License, Version 2.0)
// Internal Includes
#include <os... |
55b2bcf8-2904-46bb-a8a1-9284fdb4aa07 | {
"language": "C++"
} | ```c++
#include "ShadingLanguageIncludeImplementation_ShadingLanguageIncludeARB.h"
#include <glbinding/gl/functions.h>
#include <globjects/Shader.h>
#include <globjects/base/AbstractStringSource.h>
using namespace gl;
namespace globjects
{
void ShadingLanguageIncludeImplementation_ARB::updateSources(const Sh... | ```c++
#include "ShadingLanguageIncludeImplementation_ShadingLanguageIncludeARB.h"
#include <glbinding/gl/functions.h>
#include <globjects/Shader.h>
#include <globjects/base/AbstractStringSource.h>
using namespace gl;
namespace globjects
{
void ShadingLanguageIncludeImplementation_ARB::updateSources(const Sh... |
cc80ff54-f90a-423f-8c22-501299c835a0 | {
"language": "C++"
} | ```c++
/// Copyright 2019 Pinterest 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 a... | ```c++
/// Copyright 2019 Pinterest 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 a... |
904e4d18-06ac-418f-85f8-f192cdedc716 | {
"language": "C++"
} | ```c++
/******************************************************************************\
* gloperate
*
* Copyright (C) 2014 Computer Graphics Systems Group at the
* Hasso-Plattner-Institut (HPI), Potsdam, Germany.
\******************************************************************************/
#include <gloperate/c... | ```c++
/******************************************************************************\
* gloperate
*
* Copyright (C) 2014 Computer Graphics Systems Group at the
* Hasso-Plattner-Institut (HPI), Potsdam, Germany.
\******************************************************************************/
#include <gloperate/c... |
9dc2d30e-7a06-4c0a-979e-48db417a9f55 | {
"language": "C++"
} | ```c++
#include "stdafx.h"
#include <string>
#include "Listener.h"
using namespace DShowLib;
// Increments the number of processed frames
void CListener::frameReady(Grabber& caller, smart_ptr<MemBuffer> pBuffer, DWORD currFrame)
{
done++;
}
```
Add sound when frame is ready | ```c++
#include "stdafx.h"
#include <string>
#include "Listener.h"
using namespace DShowLib;
// Increments the number of processed frames
void CListener::frameReady(Grabber& caller, smart_ptr<MemBuffer> pBuffer, DWORD currFrame)
{
MessageBeep(-1);
done++;
}
``` |
c6e644a8-1735-4ec8-a254-c2b8cd391388 | {
"language": "C++"
} | ```c++
/* mbed Microcontroller Library
* Copyright (c) 2013-2014 ARM Limited
*
* 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
*
* Un... | ```c++
/* mbed Microcontroller Library
* Copyright (c) 2013-2014 ARM Limited
*
* 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
*
* Un... |
6756bf2f-ae69-42f5-b383-2e43e9210ce8 | {
"language": "C++"
} | ```c++
#include <cstdlib>
#include <libport/backtrace.hh>
#include <libport/config.h>
#if LIBPORT_HAVE_EXECINFO_H
# include <execinfo.h>
namespace libport
{
std::vector<const char*>
backtrace()
{
enum { size = 128 };
void* callstack[size];
size_t frames = ::backtrace(callstack, size);
char** st... | ```c++
#include <cstdlib>
#include <libport/backtrace.hh>
#include <libport/config.h>
#if LIBPORT_HAVE_EXECINFO_H
# include <execinfo.h>
# include <cstdlib>
namespace libport
{
std::vector<const char*>
backtrace()
{
enum { size = 128 };
void* callstack[size];
size_t frames = ::backtrace(callstack, ... |
daf4da1d-d29f-42a7-91da-2b1ee4117dc1 | {
"language": "C++"
} | ```c++
#include "instr.h"
namespace sasm { namespace instr {
instr::instr(const sasm::elf::elf& elf, uint64 addr)
: _elf(elf), _addr(addr)
{
}
void instr::_dump_addr(std::ostream& out) const
{
out << "0x" << std::hex << _addr << std::dec << ": ";
}
}}
```
Print function symbols when dumping asm. | ```c++
#include "instr.h"
namespace sasm { namespace instr {
instr::instr(const sasm::elf::elf& elf, uint64 addr)
: _elf(elf), _addr(addr)
{
}
void instr::_dump_addr(std::ostream& out) const
{
try
{
auto sym = _elf.symtab[_addr];
if (sym.type == sasm::elf::symtab::symbol::sym_type::func)
out << ... |
bbca4c89-93bf-4efa-a0d3-f10db41df5d1 | {
"language": "C++"
} | ```c++
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 The Bitcoin Core developers
// Copyright (c) 2015-2017 The Bitcoin Unlimited developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "node... | ```c++
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 The Bitcoin Core developers
// Copyright (c) 2015-2017 The Bitcoin Unlimited developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "node... |
0cd02b76-1572-4ea9-8d5c-152a73afe878 | {
"language": "C++"
} | ```c++
#include <iostream>
#include <conio.h>
#include <cstdlib>
#include <cmath>
#include <iomanip>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
cout << "Szymon Blaszczynski" << endl;
cout << setprecisio... | ```c++
#include <iostream>
// #include <conio.h> // getch
// #include <cstdlib> # system
#include <cmath>
#include <iomanip>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
cout << "Szymon Blaszczynski" << en... |
d1e603ae-c211-4b7a-a3ce-88d7070af54f | {
"language": "C++"
} | ```c++
/**
** \file object/delegate-class.cc
** \brief Creation of the URBI object delegate.
*/
#include "object/delegate-class.hh"
#include "object/object.hh"
#include "object/primitives.hh"
#include "runner/runner.hh"
namespace object
{
rObject delegate_class;
/*-----------------------.
| Primitive primit... | ```c++
/**
** \file object/delegate-class.cc
** \brief Creation of the URBI object delegate.
*/
#include "object/delegate-class.hh"
#include "object/object.hh"
#include "object/primitives.hh"
#include "runner/runner.hh"
namespace object
{
rObject delegate_class;
/*-----------------------.
| Primitive primi... |
7083a082-eeb6-468b-bdb1-4604afe810e0 | {
"language": "C++"
} | ```c++
// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
struct A {
virtual ~A();
};
struct B : A { };
struct C {
int i;
B b;
};
// CHECK: _Z15test_value_initv
void test_value_init() {
// This value initialization requires zero initialization of the 'B'
// subobject follow... | ```c++
// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
struct A {
virtual ~A();
};
struct B : A { };
struct C {
int i;
B b;
};
// CHECK: _Z15test_value_initv
void test_value_init() {
// This value initialization requires zero initialization of the 'B'
// subobject follow... |
61631eed-b66b-4030-b7a5-95618476773a | {
"language": "C++"
} | ```c++
#include "insertion.hpp"
#include "swap.hpp"
void insertion(int *data, int size_of_data)
{
for(int i = 0; i < size_of_data; ++i)
{
int j;
for(j = i; data[j] < data[i]; --j);
swap(data[i], data[j]);
}
}
```
Add boundary value in loop expression | ```c++
#include "insertion.hpp"
#include "swap.hpp"
void insertion(int *data, int size_of_data)
{
for(int i = 0; i < size_of_data; ++i)
{
int j;
for(j = i; j >= 0 && data[j] < data[i]; --j);
swap(data[i], data[j]);
}
}
``` |
dcdd4a84-6313-4a52-8bd7-f7980a137c6a | {
"language": "C++"
} | ```c++
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iterator>
using namespace std;
int getMinHelper(vector<int> DesiredArray, int Moves)
{
if(all_of(begin(DesiredArray), end(DesiredArray), [] (const int & element) {return element==0;}))
{
return Moves;
}... | ```c++
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iterator>
using namespace std;
class IncrementAndDoubling
{
public:
int getMinHelper(vector<int> DesiredArray, int Moves)
{
if(all_of(begin(DesiredArray), end(DesiredArray), [] (const int & ele... |
20914803-c0e9-40ff-a0da-0ab2c71d7566 | {
"language": "C++"
} | ```c++
#include "embedded.h"
#include <QtCore>
#include <QVBoxLayout>
#include <QApplication>
#include <QDesktopWidget>
#include <maliit/namespace.h>
#include <maliit/inputmethod.h>
MainWindow::MainWindow()
: QMainWindow()
{
initUI();
}
MainWindow::~MainWindow()
{}
void MainWindow::initUI()
{
setWindow... | ```c++
#include "embedded.h"
#include <QtCore>
#include <QVBoxLayout>
#include <QApplication>
#include <QDesktopWidget>
#include <maliit/namespace.h>
#include <maliit/inputmethod.h>
MainWindow::MainWindow()
: QMainWindow()
{
initUI();
}
MainWindow::~MainWindow()
{}
void MainWindow::initUI()
{
setWindow... |
00f528b8-9ddd-4870-93d3-45fff8cc83b5 | {
"language": "C++"
} | ```c++
#include "messmer/cpp-utils/tempfile/TempDir.h"
#include "messmer/fspp/fuse/Fuse.h"
#include "messmer/fspp/impl/FilesystemImpl.h"
#include "CopyDevice.h"
using cpputils::TempDir;
using copyfs::CopyDevice;
using fspp::FilesystemImpl;
using fspp::fuse::Fuse;
int main (int argc, char *argv[])
{
TempDir dir;
C... | ```c++
#include "messmer/cpp-utils/tempfile/TempDir.h"
#include "messmer/fspp/fuse/Fuse.h"
#include "messmer/fspp/impl/FilesystemImpl.h"
#include "CopyDevice.h"
#include <iostream>
using cpputils::TempDir;
using copyfs::CopyDevice;
using fspp::FilesystemImpl;
using fspp::fuse::Fuse;
int main (int argc, char *argv[])
... |
03006406-8ddf-4e3c-b27e-f8a1e3325621 | {
"language": "C++"
} | ```c++
// Copyright 2013-2015 Eric Schkufza, Rahul Sharma, Berkeley Churchill, Stefan Heule
//
// 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/LICENS... | ```c++
// Copyright 2013-2015 Eric Schkufza, Rahul Sharma, Berkeley Churchill, Stefan Heule
//
// 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/LICENS... |
173e6ca4-7c79-4b8a-8baa-f60aaf4b2f34 | {
"language": "C++"
} | ```c++
#include "mainwindow.h"
#include <QApplication>
#include <QFile>
#include "applicationdata.h"
#include "blocktype.h"
#include <QJsonDocument>
#include <QJsonArray>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QString appDir = a.applicationDirPath();
QString xmlPath = appDir + "/b... | ```c++
#include "mainwindow.h"
#include <QApplication>
#include <QFile>
#include "applicationdata.h"
#include "blocktype.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QMessageBox>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QString appDir = a.applicationDirPath();
QString... |
63cbd037-56d0-4f2e-9e21-474db468107e | {
"language": "C++"
} | ```c++
#include <pybind11/pybind11.h>
#include "basics.hpp"
#include "containers.hpp"
namespace py = pybind11;
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);
namespace containers {
PYBIND11_PLUGIN(containers) {
py::module m("containers", "wrapped C++ containers module");
py::class_<containers::Dooda... | ```c++
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "basics.hpp"
#include "containers.hpp"
namespace py = pybind11;
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);
namespace containers {
PYBIND11_PLUGIN(containers) {
py::module m("containers", "wrapped C++ containers module");
py... |
18e99d04-f57a-41a7-995e-594a402ec34f | {
"language": "C++"
} | ```c++
#include "stdafx.h"
#include "CppUnitTest.h"
#include "datastore.h"
#include "transaction.h"
#include "internal/operations/post_operation.h"
#include "dummy_values.h"
using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert;
namespace You {
namespace DataStore {
namespace UnitTests {
TEST_CLASS(Da... | ```c++
#include "stdafx.h"
#include "CppUnitTest.h"
#include "datastore.h"
#include "transaction.h"
#include "internal/operations/post_operation.h"
#include "dummy_values.h"
using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert;
namespace You {
namespace DataStore {
namespace UnitTests {
TEST_CLASS(Da... |
3f23e360-f90c-4e4e-9bb8-43fd34da2607 | {
"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"
``` |
b10fdaf8-dcf9-47f4-9c8d-fc14b44568b3 | {
"language": "C++"
} | ```c++
#include "gtest/gtest.h"
#include "PrologInterface.h"
#include <iostream>
namespace {
static int glob_argc;
static char **glob_argv;
class PrologLifetimeTest : public ::testing::Test {
};
TEST_F(PrologLifetimeTest, BeginInitializesProlog) {
PrologLifetime::begin(glob_argc, glob_argv);
ASSERT_TRUE(PL_is_... | ```c++
#include "gtest/gtest.h"
#include "PrologInterface.h"
#include <iostream>
namespace {
static int glob_argc;
static char **glob_argv;
class PrologLifetimeTest : public ::testing::Test {
};
TEST_F(PrologLifetimeTest, BeginInitializesProlog) {
PrologLifetime::begin(glob_argc, glob_argv);
ASSERT_TRUE(PL_is_... |
84357607-2027-4aaf-a70c-5222f3bea831 | {
"language": "C++"
} | ```c++
#include"ics3/eepparam.hpp"
#include<stdexcept>
constexpr int byteSize {4};
constexpr uint16_t mask {0xF};
void ics::EepParam::write(std::array<uint8_t, 64>& dest) const noexcept {
uint16_t nowData {data};
for (size_t i {offset + length - 1}; i >= offset; --i) {
dest[i] = nowData & mask;
nowData >... | ```c++
#include"ics3/eepparam.hpp"
#include<stdexcept>
constexpr int byteSize {4};
constexpr uint16_t mask {0xF};
void ics::EepParam::write(std::array<uint8_t, 64>& dest) const noexcept {
uint16_t nowData {data};
for (size_t i {offset + length - 1}; i >= offset; --i) {
dest[i] = nowData & mask;
nowData >... |
d07392f6-f583-4fa8-bd2f-4e6f6c597086 | {
"language": "C++"
} | ```c++
#include <Headers\Native IO Board\MainStream IO\Native MainInput\IO Board.h>
using namespace std;
int main()
{
}```
Remove standard namespace from source file. | ```c++
#include <Headers\Native IO Board\MainStream IO\Native MainInput\IO Board.h>
int main()
{
}``` |
66a546f0-d3ff-4db6-a58a-66030ff0cdd8 | {
"language": "C++"
} | ```c++
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - | FileCheck %s
struct A {
virtual int operator-() = 0;
};
void f(A *a) {
// CHECK: call i32 %
-*a;
}
```
Add a test for devirtualization of virtual operator calls. | ```c++
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - | FileCheck %s
struct A {
virtual int operator-();
};
void f(A a, A *ap) {
// CHECK: call i32 @_ZN1AngEv(%struct.A* %a)
-a;
// CHECK: call i32 %
-*ap;
}
``` |
8484ec6c-88ae-43e8-9378-ba5ff99945fb | {
"language": "C++"
} | ```c++
/*******************************************************************************
Binary tree preorder inorder successor
======================================
--------------------------------------------------------------------------------
Problem
=======
Finding the preoder and inorder successor in a binary ... | ```c++
/*******************************************************************************
Binary tree preorder inorder successor
======================================
--------------------------------------------------------------------------------
Problem
=======
Finding the preoder and inorder successor in a binary ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.