doc_id stringlengths 36 36 | metadata dict | input stringlengths 28 4.3k | output stringlengths 11 5.45k |
|---|---|---|---|
35af0a2b-31b9-4167-9532-ae39c1a72088 | {
"language": "C++"
} | ```c++
```
Add solution for chapter 17 test 10 | ```c++
#include <iostream>
#include <bitset>
#include <vector>
using namespace std;
int main() {
vector<int> ivec = {1, 2, 3, 5, 8, 13, 21};
unsigned long val = 0UL;
for(auto i : ivec) {
val |= 1UL << i;
}
cout << val << endl;
bitset<32> b(val);
cout << b << endl;
... |
3e3a8b0c-f282-4a59-bad4-2448882373b5 | {
"language": "C++"
} | ```c++
```
Revert "Revert "add test file to show the max open files."" | ```c++
/**
g++ pipe_fds.cpp -g -O0 -o pipe_fds
About the limits:
[winlin@dev6 srs]$ ulimit -n
1024
[winlin@dev6 srs]$ sudo lsof -p 21182
pipe_fds 21182 winlin 0u CHR 136,4 0t0 7 /dev/pts/4
pipe_fds 21182 winlin 1u CHR 136,4 0t0 7 /dev/pts/4
pipe_fds 21182 winlin 2u ... |
bbd40365-999a-4d5c-b301-b30d071f8f2a | {
"language": "C++"
} | ```c++
```
Implement Outputting Text Program in C++ | ```c++
#include <iostream>
using namespace std;
int main(){
cout << "Starting Program..." << flush;
cout << "This is the first line" << endl;
cout << "-Item 1. " << "-Item 2. " << "-Item 3." << endl;
cout << "The Program is ending." << endl;
return 0;
}``` |
db690f16-5c3a-4328-b90d-6ccf3213598f | {
"language": "C++"
} | ```c++
```
Add Chapter 25, exercise 7 | ```c++
// Chapter 25, exercise 7: write out the hexadecimal values from 0 to 400; write
// out the hexadecimal values from -200 to 200
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
cout << "0 to 400:\n\n";
for (int i = 0; i<=400; ++i)
cout << hex << i << (i%16 ? '\t' : '\n');... |
1e36863c-b6a8-451b-9773-f909d71eeae6 | {
"language": "C++"
} | ```c++
```
Add solution for chapter 16 test 48. | ```c++
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
template <typename T>
string debug_rep(const T &t) {
ostringstream ret;
ret << t;
return ret.str();
}
template <typename T>
string debug_rep(T *p) {
ostringstream ret;
ret << "pointer: " << p;
... |
a1152bd1-c6d4-47ca-8f8c-43e02b6a2e0c | {
"language": "C++"
} | ```c++
```
Add "run-time decorator pattern" sample | ```c++
// Decorator (run-time)
class foo
{
public:
virtual void do_work() = 0;
};
class foo_concrete : public foo
{
public:
virtual void do_work()
{ }
};
class foo_decorator : public foo
{
public:
foo_decorator(foo& f)
: f(f)
{ }
virtual void do_work() {
// Do something else here to decorate
... |
bfa7a7e5-a978-4c9f-a95a-2e3eead328cc | {
"language": "C++"
} | ```c++
```
Add a test for a subtle instantiation pattern that showed up within a Boost miscompile reduction. Clang already handles this correctly, but let's make sure it stays that way. | ```c++
// RUN: %clang_cc1 -fsyntax-only -verify %s
// This is the function actually selected during overload resolution, and the
// only one defined.
template <typename T> void f(T*, int) {}
template <typename T> struct S;
template <typename T> struct S_ : S<T> { typedef int type; }; // expected-note{{in instantiatio... |
0d6fafe7-41b7-4f70-9ffa-296f1297e480 | {
"language": "C++"
} | ```c++
```
Add error test for inlined stages | ```c++
#include "Halide.h"
#include <stdio.h>
using namespace Halide;
int main(int argc, char **argv) {
Func f, g;
Var x, y;
f(x) = x;
f(x) += x;
g(x) = f(x);
// f is inlined, so this schedule is bad.
f.vectorize(x, 4);
g.realize(10);
printf("There should have been an error\n")... |
594b14d8-82cc-4607-abd0-9c6e6239a791 | {
"language": "C++"
} | ```c++
```
Add test for (properly escaped) XML output. | ```c++
// RUN: clang-format -output-replacements-xml -sort-includes %s > %t.xml
// RUN: FileCheck -strict-whitespace -input-file=%t.xml %s
// CHECK: <?xml
// CHECK-NEXT: {{<replacements.*incomplete_format='false'}}
// CHECK-NEXT: {{<replacement.*#include <a> #include <b><}}
// CHECK-NEXT: {{<replacement.*>&#... |
b72285ec-0fc4-40a2-a36e-eee350c55ec6 | {
"language": "C++"
} | ```c++
```
Add primitive load recorder prototype | ```c++
#include "types.hpp"
#include "constants.hpp"
#include "sys/sysctl.hpp"
#include <iostream> /* std::cout, std::cerr */
#include <chrono> /* std::chrono::steady_clock::now() */
#include <thread> /* std::this_thread::sleep_until() */
#include <sys/resource.h> /* CPUSTATES */
namespace {
using namespa... |
09d4a0b1-c710-48bd-8cc8-aab72518b9e3 | {
"language": "C++"
} | ```c++
```
Add problem about parenthesis sequences | ```c++
/*
* Copyright (C) 2015-2016 Pavel Dolgov
*
* See the LICENSE file for terms of use.
*/
#include <bits/stdc++.h>
void generate(std::string prefix, int open, int len) {
if (len == prefix.size()) {
std::cout << prefix << std::endl;
} else {
if (open < (len - prefix.size())) {
... |
8b4ebd40-c3f0-4eed-8e75-99fa70be7f47 | {
"language": "C++"
} | ```c++
```
Add code to delete a Linked List | ```c++
#include<iostream>
#include<cstdlib>
using namespace std;
class Node{
public:
int data;
Node *next;
Node(){}
Node(int d){
data=d;
next=NULL;
}
Node *insertE... |
50c5d939-3622-4022-a188-a7a10236e133 | {
"language": "C++"
} | ```c++
```
Add some basic tests of Data_Store class | ```c++
/*
* (C) 2018 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#include "tests.h"
#if defined(BOTAN_HAS_X509_CERTIFICATES)
#include <botan/datastor.h>
namespace Botan_Tests {
class Datastore_Tests : public Test
{
public:
std::vector<Test::Result> run() overr... |
d5bf4180-16f6-44dc-a555-1b08f2ba1763 | {
"language": "C++"
} | ```c++
```
Add solution to the matching parentheses problem with multiple kinds of parentheses. This solution uses stack data structure | ```c++
#include <iostream>
#include <stack>
#include <utility>
using std::cout;
using std::boolalpha;
using std::stack;
using std::pair;
class ParenthesesPair {
pair<char, char> parentheses;
public:
ParenthesesPair(char opening, char closing): parentheses(opening, closing) {}
char opening() const {
retur... |
971c713e-bcd2-4ebd-beac-2792a584f6e2 | {
"language": "C++"
} | ```c++
```
Add test for pointer qualification conversion. | ```c++
//===------------------------- catch_ptr_02.cpp ---------------------------===//
//
// 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.
//
//===---------------------------------... |
d08a408b-8e80-4d6d-895f-976f612e46f2 | {
"language": "C++"
} | ```c++
```
Add basic structure and interface | ```c++
#include <iostream>
#include <string>
void findPossiblePlainTexts(const std::string&, int);
char* decrypt(const char*);
int main(int argc, char** argv)
{
std::cout << "Letter Frequency attack on additive cipher\n";
std::cout << "Enter the cipher text: ";
std::string ciphertext;
std::cin >> ciphertext;... |
5c08a8de-e3c1-4034-a8f1-d044eefb2b53 | {
"language": "C++"
} | ```c++
```
Insert libkldap catalog to translate dialogbox when we "add host" | ```c++
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
... |
91fcc3e7-4fa6-4515-ac24-4ce846e0d556 | {
"language": "C++"
} | ```c++
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... | ```c++
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... |
aa322712-cd5d-4850-a9bb-afd5465863aa | {
"language": "C++"
} | ```c++
```
Check in test that demonstrates ABI break for std::function. | ```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
//
//===-----... |
798cad23-9897-4d61-b4cb-bc07ea9d8908 | {
"language": "C++"
} | ```c++
```
Add all greater nodes to a node in BST. | ```c++
// Given a Binary Search Tree (BST), modify it so that all greater values in the given BST are added to every node.
#include <iostream>
using namespace std;
struct Node{
int data;
struct Node *left;
struct Node *right;
};
struct Node *newNode(int x){
struct Node *newptr = new Node;
newptr->data = x;
new... |
432c486b-3276-4815-b674-edd870cb65b9 | {
"language": "C++"
} | ```c++
```
Add longest increasing subsequence in c++ | ```c++
#include <bits/stdc++.h>
using namespace std;
int main()
{
int arr[9] = { 1, 4, 2, 3, 8, 3, 4, 1, 9}; // LIS should be {1, 2, 3, 8, 9}
int f[9] = {}, LIS[9] = {}, max = 1, L = 0; // f used to record previous location of LIS
for (int i = 0; i < 9; i++)
{
LIS[i] = 1;
f[i] = i;
... |
adc7c1dc-bccc-4cd7-9362-426de250045f | {
"language": "C++"
} | ```c++
#include <algorithm>
#include <bts/import_bitcoin_wallet.hpp>
#include <fc/exception/exception.hpp>
#include <fc/log/logger.hpp>
#include <fc/crypto/aes.hpp>
#include <fc/crypto/base58.hpp>
#include <fc/crypto/hex.hpp>
namespace bts { namespace bitcoin {
std::vector<fc::ecc::private_key> import_bitcoin_wall... | ```c++
#include <algorithm>
#include <fc/exception/exception.hpp>
#include <fc/log/logger.hpp>
#include <fc/crypto/aes.hpp>
#include <fc/crypto/base58.hpp>
#include <fc/crypto/hex.hpp>
#include <fc/crypto/elliptic.hpp>
#include <fc/filesystem.hpp>
namespace bts { namespace bitcoin {
std::vector<fc::ecc::private_key... |
48e634e6-62d8-45d4-a697-a949dcdc7e30 | {
"language": "C++"
} | ```c++
```
Add tests for idx importer | ```c++
#include "test_helper.h"
#include "uTensor/loaders/tensorIdxImporter.hpp"
#include <iostream>
using std::cout;
using std::endl;
TensorIdxImporter t_import;
Context ctx;
void test_core_ntoh32(void) {
uint32_t input = 63;
uint32_t result = ntoh32(input);
EXPECT_EQ(result, 1056964608);
}
void tes... |
4870d272-1a91-4624-a32f-5c79e00d9037 | {
"language": "C++"
} | ```c++
```
Add Solution for Problem 058 | ```c++
// 58. Length of Last Word
/**
* Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.
*
* If the last word does not exist, return 0.
*
* Note: A word is defined as a character sequence consists of non-space characters only.
... |
3cc104ca-97c2-4771-8713-c63b81dfb281 | {
"language": "C++"
} | ```c++
```
Add test for Stereographic projection for real. | ```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 2014 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
//
#include "Stereographi... |
6e9371ef-8798-4459-8c00-78a8068b64c0 | {
"language": "C++"
} | ```c++
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
#include "atom/browser/login_handler.h"
#include "atom/common/platform_util.h"
#include "content/public/browser... | ```c++
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
#include "atom/browser/login_handler.h"
#include "atom/common/platform_util.h"
#include "content/public/browser... |
2ad6d703-1fa3-4084-8710-099e04b329fe | {
"language": "C++"
} | ```c++
```
Add empty chip::lowLevelInitialization() for STM32L0 | ```c++
/**
* \file
* \brief chip::lowLevelInitialization() implementation for STM32L0
*
* \author Copyright (C) 2017 Cezary Gapinski cezary.gapinski@gmail.com
*
* \par License
* 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 t... |
935b59b3-f24e-4137-99e0-4a5ffb23e115 | {
"language": "C++"
} | ```c++
```
Update debug log to support redirection | ```c++
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... |
ade5e62c-5c6d-4229-9ec0-cc44bd015d65 | {
"language": "C++"
} | ```c++
```
Remove All Adjacent Duplicates In String | ```c++
class Solution {
public:
string removeDuplicates(string s) {
int index = 0;
while (!s.empty() && index < (s.size()-1)) {
if (s[index] == s[index+1]) {
if ((index+2) < s.size()) {
s = s.substr(0, index) + s.substr(index+2);
... |
a0728bbb-4165-4893-a4c8-13ed37253c06 | {
"language": "C++"
} | ```c++
```
Add pseudo code for performing an Inverse Kinematics analysis. Perform IK without using a Tool or any Analyses. | ```c++
#include <OpenSim/OpenSim.h>
main() {
// A study is the top level component that contains the model and other
// computational components.
Study inverseKinematicsStudy;
Model model("subject_01.osim");
inverseKinematicsStudy.addComponent(model);
// A data Source component wraps a ... |
556ee700-28ce-46ef-bf5f-256fc98ac0c8 | {
"language": "C++"
} | ```c++
```
Add C++11 solution for Nov. 2013 Bronze Problem 2 | ```c++
#include <fstream>
#include <map>
using namespace std;
int main() {
ifstream cin("milktemp.in");
ofstream cout("milktemp.out");
int num_cows, cold, comfortable, hot;
cin >> num_cows >> cold >> comfortable >> hot;
int cold_change = comfortable - cold;
int hot_change = hot - comfortable;
map<i... |
8743754d-fcad-47aa-bac1-d452c7b892f9 | {
"language": "C++"
} | ```c++
```
Test case for my last patch. | ```c++
// RUN: clang-cc -fsyntax-only -verify %s
class Base { // expected-error {{cannot define the implicit default assignment operator for 'class Base'}} \
// expected-note {{synthesized method is first required here}}
int &ref; // expected-note {{declared at}}
};
class X : Base { // // expected-e... |
a551555d-68ec-4181-a2ad-578387e3bbcf | {
"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... |
c8a25136-871d-4514-b850-f59d7694c658 | {
"language": "C++"
} | ```c++
#include "env_vars.hh"
namespace Kakoune
{
EnvVarMap get_env_vars()
{
EnvVarMap env_vars;
for (char** it = environ; *it; ++it)
{
const char* name = *it;
const char* value = name;
while (*value != 0 and *value != '=')
++value;
env_vars[String{name, value}]... | ```c++
#include "env_vars.hh"
#if __APPLE__
extern char **environ;
#endif
namespace Kakoune
{
EnvVarMap get_env_vars()
{
EnvVarMap env_vars;
for (char** it = environ; *it; ++it)
{
const char* name = *it;
const char* value = name;
while (*value != 0 and *value != '=')
+... |
350de37f-945b-493c-accb-7fb6867faf3c | {
"language": "C++"
} | ```c++
#include <algorithm>
#include "command.hh"
#include "common-args.hh"
#include "eval.hh"
#include "globals.hh"
#include "legacy.hh"
#include "shared.hh"
#include "store-api.hh"
namespace nix {
struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
{
NixArgs() : MultiCommand(*RegisterCommand::commands... | ```c++
#include <algorithm>
#include "command.hh"
#include "common-args.hh"
#include "eval.hh"
#include "globals.hh"
#include "legacy.hh"
#include "shared.hh"
#include "store-api.hh"
namespace nix {
struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
{
NixArgs() : MultiCommand(*RegisterCommand::commands... |
ad5d78fb-cd29-4d7e-9e94-70fcf2db8762 | {
"language": "C++"
} | ```c++
#include <iostream>
#include <thread>
#include <atomic>
#include <vector>
std::vector<int> data;
bool data_ready = false;
void reader_thread()
{
int i = 1;
while (!data_ready) // 1
{
std::cout << "Reader loop " << i << std::endl;
++i;
std::this_thread::sleep_for(std::chrono:... | ```c++
#include <iostream>
#include <thread>
#include <atomic>
#include <vector>
std::vector<int> data;
bool data_ready = false;
void reader_thread()
{
int i = 1;
while (!data_ready) // 1
{
std::cout << "Reader loop " << i << std::endl;
++i;
}
std::cout << "Data value: " << data[0... |
fde3cad5-42c2-4f6f-a716-ae0c57ab5b4e | {
"language": "C++"
} | ```c++
#include "grid.h"
#include "graphics/Renderer.h"
#include "jewel.h"
#include "cell.h"
namespace bejeweled {
Grid::Grid(int width, int height, graphics::Renderer &renderer) : width_(width), height_(height), grid_() {
for (int i = 0; i < width_; ++i) {
grid_.emplace_back();
for (int j = 0; j < height_... | ```c++
#include "grid.h"
#include "graphics/Renderer.h"
#include "jewel.h"
#include "cell.h"
namespace bejeweled {
Grid::Grid(int width, int height, graphics::Renderer &renderer) : width_(width), height_(height), grid_() {
for (int i = 0; i < width_; ++i) {
grid_.emplace_back();
for (int j = 0; j < height_... |
42903429-6b15-49ef-9aa4-524e439df26a | {
"language": "C++"
} | ```c++
class base {
public:
virtual int foo(int a)
{ return 4 + a; }
int bar(int a)
{ return a - 2; }
};
class sub final : public base {
public:
virtual int foo(int a) override
{ return 8 + 2 * a; };
};
class sub2 final : public base {
public:
virtual int foo(int a) override final
... | ```c++
class base {
public:
virtual int foo(int a)
{ return 4 + a; }
int bar(int a)
{ return a - 2; }
};
class sub final : public base {
public:
virtual int foo(int a) override
{ return 8 + 2 * a; };
};
class sub2 final : public base {
public:
virtual int foo(int a) override final
... |
5d5a91f1-f9f2-4b44-8f28-f0f42124e02a | {
"language": "C++"
} | ```c++
#include "rapidjson/document.h"
#include "rapidjson/filereadstream.h"
#include <cstdio>
#include <iostream>
using namespace std;
using namespace rapidjson;
int main() {
FILE* fp = std::fopen("./1.json", "r");
char buffer[65536];
FileReadStream frs(fp, buffer, sizeof(buffer));
Document jobj;
... | ```c++
#include "rapidjson/document.h"
#include "rapidjson/filereadstream.h"
#include <cstdio>
#include <iostream>
using namespace std;
using namespace rapidjson;
int main() {
FILE* fp = std::fopen("./1.json", "r");
char buffer[65536];
FileReadStream frs(fp, buffer, sizeof(buffer));
Document jobj;
... |
7e870823-41b2-48f4-9ace-724f64edc09e | {
"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.
//
//===---------------------------------... |
bf0a5dfc-16bd-4c86-9181-8b677b06d00e | {
"language": "C++"
} | ```c++
#include <iostream>
#include "SDL/SDL.h"
#include "world.hpp"
namespace Polarity {
World *world = nullptr;
World::World():physics(b2Vec2(0.0f, -10.0f)),keyState(SDLK_LAST) {
std::cerr << "World has started"<<std::endl;
for (int i=0; i< SDLK_LAST; ++i) {
keyState[i] = false;
}
}
void Wo... | ```c++
#include <iostream>
#include "SDL/SDL.h"
#include "world.hpp"
namespace Polarity {
World *world = nullptr;
World::World():physics(b2Vec2(0.0f, -10.0f)),keyState(SDLK_LAST) {
std::cerr << "World has started"<<std::endl;
for (int i=0; i< SDLK_LAST; ++i) {
keyState[i] = false;
}
}
void Wo... |
9e0c8378-d1b3-44ab-b9e0-aa50b86a391c | {
"language": "C++"
} | ```c++
//---------------------------- block_matrix_array_02.cc ---------------------------
// $Id$
// Version: $Name$
//
// Copyright (C) 2005 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// to the fi... | ```c++
//---------------------------- block_matrix_array_02.cc ---------------------------
// $Id$
// Version: $Name$
//
// Copyright (C) 2005 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// to the fi... |
06785c16-e966-4c51-9a90-139f279318a6 | {
"language": "C++"
} | ```c++
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "config.h"
#include "modules/push_messaging/PushError.h"
#include "core/dom/ExceptionCode.h"
#include "wtf/OwnPtr.h"
namespace blink {
... | ```c++
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "config.h"
#include "modules/push_messaging/PushError.h"
#include "core/dom/ExceptionCode.h"
#include "wtf/OwnPtr.h"
namespace blink {
... |
bc1856de-29b1-4d22-96b6-50c72d90686f | {
"language": "C++"
} | ```c++
#include "MainWindow.h"
#include <QBoxLayout>
#include <QLabel>
#include <QSpinBox>
#include <fiblib/Fibonacci.h>
MainWindow::MainWindow()
{
// Create content widget
QWidget * content = new QWidget(this);
setCentralWidget(content);
// Create layout
QBoxLayout * boxLayout = new QVBoxLayo... | ```c++
#include "MainWindow.h"
#include <QBoxLayout>
#include <QLabel>
#include <QSpinBox>
#include <fiblib/Fibonacci.h>
MainWindow::MainWindow()
{
// Create content widget
QWidget * content = new QWidget(this);
setCentralWidget(content);
// Create layout
QBoxLayout * layout = new QVBoxLayout(... |
fe53e588-dcc1-49ec-b01b-27da7ed835df | {
"language": "C++"
} | ```c++
#include <rusql/connection.hpp>
#include <assert.h>
int main(int argc, char *argv[]) {
assert(argc == 5);
try {
rusql::connection(rusql::connection::connection_info(argv[1], argv[2], argv[3], argv[4]));
} catch(...) {
return 0;
}
return 1;
}
```
Change C header to C++ header | ```c++
#include <rusql/connection.hpp>
#include <cassert>
int main(int argc, char *argv[]) {
assert(argc == 5);
try {
rusql::connection(rusql::connection::connection_info(argv[1], argv[2], argv[3], argv[4]));
} catch(...) {
return 0;
}
return 1;
}
``` |
0bef4d97-dd1a-4f5d-9cc9-97a76ce5cb01 | {
"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 "printing/backend/print_backend.h"
namespace printing {
PrinterBasicInfo::PrinterBasicInfo() : printer_status(0) {}
PrinterBasicInf... | ```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 "printing/backend/print_backend.h"
namespace printing {
PrinterBasicInfo::PrinterBasicInfo()
: printer_status(0),
is_defau... |
13bb2f46-a2af-4e1a-9882-3220e22185dd | {
"language": "C++"
} | ```c++
#include <QApplication>
#include <QIcon>
#include <QSettings>
#include <QString>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("SheetMusicViewer");
QCoreApplication::setApplicationName("SheetMusicViewer");
QSettings... | ```c++
#include <QApplication>
#include <QIcon>
#include <QProcess>
#include <QSettings>
#include <QString>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("SheetMusicViewer");
QCoreApplication::setApplicationName("SheetMusicView... |
774b278f-c04f-4800-aa07-ffe7a0e56c5b | {
"language": "C++"
} | ```c++
#include "gtest/gtest.h"
#include "test_convergence.h"
// TODO: Add more extensive testing
class LqrKalmanConvergenceTest: public ConvergenceTest {
public:
void simulate() {
for(unsigned int i = 0; i < m_N; ++i) {
auto u = m_lqr->control_calculate(m_x);
m_... | ```c++
#include "gtest/gtest.h"
#include "test_convergence.h"
// TODO: Add more extensive testing
class LqrKalmanConvergenceTest: public ConvergenceTest {
public:
void simulate() {
for(unsigned int i = 0; i < m_N; ++i) {
auto u = m_lqr->control_calculate(m_kalman->x());
... |
32e917c6-5f35-4af0-a5fa-134e03409822 | {
"language": "C++"
} | ```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... | ```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... |
24670f29-446b-4066-a8f9-6f1ee4647aa0 | {
"language": "C++"
} | ```c++
#include "hapticbutton.h"
#include <QPainter>
HapticButton::HapticButton(const QString &label) :
QWidget(0), m_label(label), m_checked(false), m_checkable(false)
{
setMinimumSize(100, 100);
}
void HapticButton::mousePressEvent(QMouseEvent *)
{
if (m_checkable) {
m_checked = !m_checked;
... | ```c++
#include "hapticbutton.h"
#include <QPainter>
HapticButton::HapticButton(const QString &label) :
QWidget(0), m_label(label), m_checked(false), m_checkable(false)
{
setMinimumSize(100, 100);
}
void HapticButton::mousePressEvent(QMouseEvent *)
{
if (m_checkable) {
m_checked = !m_checked;
... |
286fffe4-ee37-4aeb-8c0e-527e090cbcfc | {
"language": "C++"
} | ```c++
#include <configure/utils/path.hpp>
#include <configure/error.hpp>
BOOST_AUTO_TEST_CASE(path)
{
using namespace configure::utils;
BOOST_CHECK_THROW(
relative_path("pif", "/paf"),
configure::error::InvalidPath
);
BOOST_CHECK_THROW(
relative_path("/pif", "paf"),
configure::error::InvalidP... | ```c++
#include <configure/utils/path.hpp>
#include <configure/error.hpp>
namespace fs = boost::filesystem;
BOOST_AUTO_TEST_CASE(path)
{
# define P1 "pif"
# define P2 "paf"
#ifdef _WIN32
# define ABS_P1 "c:\\pif"
# define ABS_P2 "c:/paf"
#else
# define ABS_P1 "/pif"
# define ABS_P2 "/paf"
#endif
using namespace conf... |
8c2b6cce-de95-4c0f-b24b-36da889b9caf | {
"language": "C++"
} | ```c++
#include "wrangleplow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
WranglePlow::MainWindow wrangleplow;
wrangleplow.show();
wrangleplow.resize(1024, 768);
return app.exec();
}```
Move the window to a good location. | ```c++
#include "wrangleplow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
WranglePlow::MainWindow wrangleplow;
wrangleplow.show();
wrangleplow.resize(1024, 768);
wrangleplow.move(100, 100);
return app.exec();
}``` |
9c0f634d-f352-4ad9-94c9-e67212a22112 | {
"language": "C++"
} | ```c++
#include "./persistent_constraint_updater.h"
#include "./constraint_updater.h"
PersistentConstraintUpdater::PersistentConstraintUpdater(
std::shared_ptr<ConstraintUpdater> constraintUpdater)
: constraintUpdater(constraintUpdater)
{
}
void PersistentConstraintUpdater::updateConstraints(
int labelId, E... | ```c++
#include "./persistent_constraint_updater.h"
#include <chrono>
#include <QLoggingCategory>
#include "./constraint_updater.h"
QLoggingCategory pcuChan("Placement.PersistentConstraintUpdater");
PersistentConstraintUpdater::PersistentConstraintUpdater(
std::shared_ptr<ConstraintUpdater> constraintUpdater)
:... |
826e20cb-98e3-43ff-bd80-6f07c6b8c01e | {
"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.
//
//===---------------------------------... |
a787cec2-ed4e-4030-be27-e02bcec0cfb9 | {
"language": "C++"
} | ```c++
// RUN: %clang_cc1 -fsyntax-only -verify %s
class A { };
class B1 : A { };
class B2 : virtual A { };
class B3 : virtual virtual A { }; // expected-error{{duplicate 'virtual' in base specifier}}
class C : public B1, private B2 { };
class D; // expected-note {{forward declaration of 'D'}}
cla... | ```c++
// RUN: %clang_cc1 -fsyntax-only -verify %s
class A { };
class B1 : A { };
class B2 : virtual A { };
class B3 : virtual virtual A { }; // expected-error{{duplicate 'virtual' in base specifier}}
class C : public B1, private B2 { };
class D; // expected-note {{forward declaration of 'D'}}
cla... |
ffbfc3b6-3fd5-442d-9cb4-169d7858f8e6 | {
"language": "C++"
} | ```c++
#include <stingraykit/io/ByteDataConsumer.h>
namespace stingray
{
ByteDataConsumer::ByteDataConsumer(ByteData consumer)
: _consumer(consumer)
{ }
size_t ByteDataConsumer::Process(ConstByteData data, const ICancellationToken&)
{
const size_t size = data.size();
STINGRAYKIT_CHECK(size <= _consumer.... | ```c++
#include <stingraykit/io/ByteDataConsumer.h>
#include <string.h>
namespace stingray
{
ByteDataConsumer::ByteDataConsumer(ByteData consumer)
: _consumer(consumer)
{ }
size_t ByteDataConsumer::Process(ConstByteData data, const ICancellationToken&)
{
const size_t size = data.size();
STINGRAYKIT_CH... |
dcced84f-5cf9-4407-9dc9-7b69f9c5e2fa | {
"language": "C++"
} | ```c++
#include "qtquick1applicationviewer.h"
#include <QApplication>
#include <QDeclarativeComponent>
#include <QDeclarativeEngine>
#include <QDeclarativeContext>
#include "artworkimageprovider.h"
#include "qiscp.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QtQuick1ApplicationViewer v... | ```c++
#include "qtquick1applicationviewer.h"
#include <QApplication>
#include <QDeclarativeComponent>
#include <QDeclarativeEngine>
#include <QDeclarativeContext>
#include "artworkimageprovider.h"
#include "qiscp.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QtQuick1ApplicationViewer vi... |
fa242ff7-1bc7-48f7-9158-b0f7794d3c75 | {
"language": "C++"
} | ```c++
#include "AConfig.h"
#if(HAS_STD_CALIBRATIONLASERS)
#include "Device.h"
#include "Pin.h"
#include "CalibrationLaser.h"
#include "Settings.h"
Pin claser("claser", CALIBRATIONLASERS_PIN, claser.analog, claser.out);
void CalibrationLaser::device_setup(){
Settings::capability_bitarray |= (1 << CALIBRATION_LASE... | ```c++
#include "AConfig.h"
#if(HAS_STD_CALIBRATIONLASERS)
#include "Device.h"
#include "Pin.h"
#include "CalibrationLaser.h"
#include "Settings.h"
Pin claser("claser", CALIBRATIONLASERS_PIN, claser.analog, claser.out);
void CalibrationLaser::device_setup(){
Settings::capability_bitarray |= (1 << CALIBRATION_LASE... |
11f7b1eb-1468-4ef4-84ec-622b3dbd3f7b | {
"language": "C++"
} | ```c++
#include "KeyboardHotkeyProcessor.h"
#include <string>
#include "SyntheticKeyboard.h"
#include "HotkeyInfo.h"
#include "Logger.h"
std::unordered_map<std::wstring, unsigned short>
KeyboardHotkeyProcessor::mediaKeyMap = CreateKeyMap();
void KeyboardHotkeyProcessor::ProcessHotkeys(HotkeyInfo &hki) {
if ... | ```c++
#include "KeyboardHotkeyProcessor.h"
#include <string>
#include "SyntheticKeyboard.h"
#include "HotkeyInfo.h"
#include "Logger.h"
std::unordered_map<std::wstring, unsigned short>
KeyboardHotkeyProcessor::mediaKeyMap = CreateKeyMap();
void KeyboardHotkeyProcessor::ProcessHotkeys(HotkeyInfo &hki) {
/* ... |
339b59a2-708d-4f18-acf2-a12011b7383b | {
"language": "C++"
} | ```c++
#include "RawTextGraphInput.hh"
/*
name
|V|
[|V| names]
|E|
[|E| lines formatted like start end type distance]
*/
template <typename V>
void RawTextGraphInput<V>::input(string path) {
ifstream ifs(path, ifstream::in);
int v, e;
string title;
// Graph title fetching
ifs >> title;
... | ```c++
#include "RawTextGraphInput.hh"
/*
name
|V|
[|V| names]
|E|
[|E| lines formatted like start end type distance]
*/
template <typename V>
void RawTextGraphInput<V>::input(string path) {
ifstream ifs(path, ifstream::in);
int v, e;
string title;
// Graph title fetching
ifs >> title;
... |
e245028a-b593-4fe2-9581-c8382cd39dc9 | {
"language": "C++"
} | ```c++
#include <typeinfo>
class A {
virtual void x() { }
};
class B : public A {
void x() override { }
};
int main() {
A a;
B *b = dynamic_cast<B *>(&a);
(void)b;
return 0;
}
```
Fix enableRtti test with GCC. | ```c++
#include <typeinfo>
class I {
public:
virtual ~I() { }
virtual void x() { }
};
class A : public I {
void x() override { }
};
class B : public I {
void x() override { }
};
int main() {
I *a = new A();
B *b = dynamic_cast<B *>(a);
(void)b;
delete a;
return 0;
}
``` |
e2f1620e-cb96-45c1-b589-9e28c52be28e | {
"language": "C++"
} | ```c++
#include "Bootil/Bootil.h"
using namespace Bootil;
int main( int argc, char** argv )
{
CommandLine::Set( argc, argv );
BString strInFolder = CommandLine::GetArg( 0, "" );
BString strOutFolder = CommandLine::GetArg( 1, strInFolder );
if (strInFolder == "")
Output::Error("Usage: gluaextract <in> [out]");... | ```c++
#include "Bootil/Bootil.h"
using namespace Bootil;
int main( int argc, char** argv )
{
Debug::SuppressPopups( true );
CommandLine::Set( argc, argv );
Console::FGColorPush( Console::Green );
Output::Msg( "GMod Lua Cache Extractor 1.0\n\n" );
Console::FGColorPop();
BString strInFolder = CommandLin... |
21e3b6aa-9f65-4d2c-a6da-3630516766ee | {
"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/thread_test_helper.h"
#include "base/location.h"
namespace base {
ThreadTestHelper::ThreadTestHelper(MessageLoopProxy* t... | ```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/thread_test_helper.h"
#include "base/bind.h"
#include "base/location.h"
namespace base {
ThreadTestHelper::ThreadTestHel... |
ced5e755-3b2a-4ffb-8998-6bb2fe79a114 | {
"language": "C++"
} | ```c++
/******************************************************************************/
/*
Author - Ming-Lun "Allen" Chou
Web - http://AllenChou.net
Twitter - @TheAllenChou
*/
/******************************************************************************/
#include "sidnet/sidnet.h"
#include "sidnet/sidser... | ```c++
/******************************************************************************/
/*
Author - Ming-Lun "Allen" Chou
Web - http://AllenChou.net
Twitter - @TheAllenChou
*/
/******************************************************************************/
#include "sidnet/sidnet.h"
#include "sidnet/sidser... |
e10834bc-3617-4097-bc78-5e3e972937e7 | {
"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::ISy... | ```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::ISy... |
2e7942e2-4020-45ac-95a3-1f89d0d29011 | {
"language": "C++"
} | ```c++
#include <memory>
#include "film/color.h"
#include "textures/texture.h"
#include "material/lambertian.h"
#include "material/oren_nayer.h"
#include "material/matte_material.h"
#include "material/specular_reflection.h"
#include "material/fresnel.h"
MatteMaterial::MatteMaterial(const Texture *diffuse, float roughn... | ```c++
#include <memory>
#include "film/color.h"
#include "textures/texture.h"
#include "material/lambertian.h"
#include "material/oren_nayer.h"
#include "material/matte_material.h"
#include "material/specular_reflection.h"
#include "material/fresnel.h"
MatteMaterial::MatteMaterial(const Texture *diffuse, float roughn... |
b10d8c0d-96d4-4b7a-b1c8-e62be52052ec | {
"language": "C++"
} | ```c++
#include "file_scrubber.hpp"
#include <stdio.h>
#include <iostream>
#include "string_utils.hpp"
#include "error.hpp"
using std::ifstream;
namespace mocc {
FileScrubber::FileScrubber(const char* fName, const char* commentFlag):
stream_(fName),
flag_(commentFlag){
if( !stream_... | ```c++
#include "file_scrubber.hpp"
#include <stdio.h>
#include <iostream>
#include "string_utils.hpp"
#include "error.hpp"
using std::ifstream;
namespace mocc {
FileScrubber::FileScrubber(const char* fName, const char* commentFlag):
stream_(fName),
flag_(commentFlag){
if( !stream_... |
506e474a-4a5f-4c99-97d8-076e1a47d674 | {
"language": "C++"
} | ```c++
#include "listener.h"
#include "log.h"
#include "buffers.h"
void conditionalEnqueue(QUEUE_TYPE(uint8_t)* queue, uint8_t* message,
int messageSize) {
if(queue_available(queue) < messageSize + 2) {
debug("Dropped incoming CAN message -- send queue (at %p) full\r\n",
queue);
... | ```c++
#include "listener.h"
#include "log.h"
#include "buffers.h"
void conditionalEnqueue(QUEUE_TYPE(uint8_t)* queue, uint8_t* message,
int messageSize) {
if(queue_available(queue) < messageSize + 2) {
debug("Dropped incoming CAN message -- send queue (at %p) full\r\n",
queue);
... |
6517ce39-7fca-4d7e-818e-14ee6a0b0ca4 | {
"language": "C++"
} | ```c++
#include "removegrain.h"
#include "clense.h"
#include "repair.h"
#include "vertical_cleaner.h"
const AVS_Linkage *AVS_linkage = nullptr;
extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) {
AVS_linkage = vectors;
env-... | ```c++
#include "removegrain.h"
#include "clense.h"
#include "repair.h"
#include "vertical_cleaner.h"
const AVS_Linkage *AVS_linkage = nullptr;
extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) {
AVS_linkage = vectors;
env-... |
00b5d14c-11c9-4bf0-82ec-44aee492aa92 | {
"language": "C++"
} | ```c++
#include <Halide.h>
#include "vzero.h"
#include <stdio.h>
using namespace Halide;
// RUN: rm -f vzero.stdout; ./vzero.out; llvm-dis -o vzero.stdout vzero.bc; FileCheck %s < vzero.stdout
int main(int argc, char **argv) {
Target target;
setupHexagonTarget(target);
target.set_feature(Target::HVX_64);
//CH... | ```c++
#include <Halide.h>
#include "vzero.h"
#include <stdio.h>
using namespace Halide;
// RUN: rm -f vzero.stdout; ./vzero.out; llvm-dis -o vzero.stdout vzero.bc; FileCheck %s < vzero.stdout
int main(int argc, char **argv) {
Target target;
setupHexagonTarget(target, Target::HVX_64);
//CHECK: call{{.*}}@llvm.h... |
c28944c5-8995-4d69-93c0-0f9499fd716d | {
"language": "C++"
} | ```c++
// RUN: %clangxx_asan -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
// Test how well we unwind in presence of qsort in the stack
// (i.e. if we can unwind through a function compiled w/o frame pointers).
// https://code.google.com/p/address-sanitizer/issues/detail?id=137
#include <stdlib.h>
#include <stdi... | ```c++
// RUN: %clangxx_asan -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
// Test how well we unwind in presence of qsort in the stack
// (i.e. if we can unwind through a function compiled w/o frame pointers).
// https://code.google.com/p/address-sanitizer/issues/detail?id=137
#include <stdlib.h>
#include <stdi... |
e35529ac-4ff9-421c-88c1-3a63f0b731d1 | {
"language": "C++"
} | ```c++
// RUN: %clangxx_tsan %s -o %t
// RUN: %run %t 2>&1 | FileCheck %s --implicit-check-not='ThreadSanitizer'
#include <dispatch/dispatch.h>
#import <memory>
#import <stdatomic.h>
_Atomic(long) destructor_counter = 0;
struct MyStruct {
virtual ~MyStruct() {
usleep(10000);
atomic_fetch_add_explicit(&des... | ```c++
// RUN: %clangxx_tsan %s %link_libcxx_tsan -o %t
// RUN: %run %t 2>&1 | FileCheck %s --implicit-check-not='ThreadSanitizer'
#include <dispatch/dispatch.h>
#include <memory>
#include <stdatomic.h>
#include <cstdio>
_Atomic(long) destructor_counter = 0;
struct MyStruct {
virtual ~MyStruct() {
usleep(1000... |
7fe4d932-50d3-4f4e-82a1-86b9e87829dd | {
"language": "C++"
} | ```c++
#include <map>
#include <string>
#include <boost/assign/list_of.hpp>
#include <AlpinoCorpus/CorpusInfo.hh>
namespace alpinocorpus {
CorpusInfo const ALPINO_CORPUS_INFO(
boost::assign::list_of("node"),
"node",
"word");
CorpusInfo const TUEBA_DZ_CORPUS_INFO(
boost::assign::list_of("node")("ne"... | ```c++
#include <map>
#include <string>
#include <boost/assign/list_of.hpp>
#include <AlpinoCorpus/CorpusInfo.hh>
namespace alpinocorpus {
CorpusInfo const ALPINO_CORPUS_INFO(
boost::assign::list_of("node"),
"node",
"word");
CorpusInfo const TUEBA_DZ_CORPUS_INFO(
boost::assign::list_of("node")("ne"... |
7a2f0029-786c-4bda-8ba0-8c1ae6fc304f | {
"language": "C++"
} | ```c++
// ========================================================================== //
// This file is part of DO++, a basic set of libraries in C++ for computer
// vision.
//
// Copyright (C) 2014 David Ok <david.ok8@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License v. ... | ```c++
// ========================================================================== //
// This file is part of DO++, a basic set of libraries in C++ for computer
// vision.
//
// Copyright (C) 2014 David Ok <david.ok8@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License v. ... |
4cceb6d3-b525-407f-9ff7-be34d9260518 | {
"language": "C++"
} | ```c++
#include "../include/Common.h"
#include "../include/StoreGreetings.h"
#include <random>
#include <string>
std::string random_greeting() {
std::random_device rand;
std::default_random_engine rand_eng(rand());
std::uniform_int_distribution<int> uniform_dist(0, STORE_GREETINGS.size());
size_t inde... | ```c++
#include "../include/Common.h"
#include "../include/StoreGreetings.h"
#include <random>
#include <string>
std::string random_greeting() {
std::random_device rand;
std::default_random_engine rand_eng(rand());
std::uniform_int_distribution<int> uniform_dist(0, STORE_GREETINGS.size()-1);
size_t in... |
31fb64e5-02e5-4d7a-9299-fb8745d8c412 | {
"language": "C++"
} | ```c++
#include <mart-netlib/unix.hpp>
#include <mart-common/PrintWrappers.h>
#include <catch2/catch.hpp>
#include <filesystem>
#include <iostream>
TEST_CASE( "unix_domain_socket_simple_member_check1", "[.][net][unix_domain_socket]" )
{
mart::nw::un::Socket sock1;
mart::nw::un::Socket sock2( /... | ```c++
#include <mart-netlib/unix.hpp>
#include <mart-common/PrintWrappers.h>
#include <catch2/catch.hpp>
#include <filesystem>
#include <iostream>
TEST_CASE( "unix_domain_socket_simple_member_check1", "[.][net][unix_domain_socket]" )
{
mart::nw::un::Socket sock1;
mart::nw::un::Socket sock2( /... |
a896c807-c208-4848-b461-c3d4a3011019 | {
"language": "C++"
} | ```c++
#include "mini_stdint.h"
#define WEAK __attribute__((weak))
extern "C" {
extern int __android_log_vprint(int, const char *, const char *, __builtin_va_list);
WEAK int halide_printf(void *user_context, const char * fmt, ...) {
__builtin_va_list args;
__builtin_va_start(args,fmt);
int result = __an... | ```c++
#include "mini_stdint.h"
#define WEAK __attribute__((weak))
extern "C" {
extern int __android_log_vprint(int, const char *, const char *, __builtin_va_list);
#define ANDROID_LOG_INFO 4
WEAK int halide_printf(void *user_context, const char * fmt, ...) {
__builtin_va_list args;
__builtin_va_start(args... |
3a843053-f5bc-4f39-b7c8-6fb70b9200c0 | {
"language": "C++"
} | ```c++
// RUN: %clang_cc1 -std=c++1z %s -emit-llvm -o - | FileCheck %s
template<typename T> struct A {
A(T = 0);
A(void*);
};
template<typename T> A(T*) -> A<long>;
A() -> A<int>;
// CHECK-LABEL: @_Z1fPi(
void f(int *p) {
// CHECK: @_ZN1AIiEC
A a{};
// CHECK: @_ZN1AIlEC
A b = p;
// CHECK: @_ZN1AIxEC
... | ```c++
// RUN: %clang_cc1 -std=c++1z %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
template<typename T> struct A {
A(T = 0);
A(void*);
};
template<typename T> A(T*) -> A<long>;
A() -> A<int>;
// CHECK-LABEL: @_Z1fPi(
void f(int *p) {
// CHECK: @_ZN1AIiEC
A a{};
// CHECK: @_ZN1AIlEC
A b =... |
86eb4689-774c-452b-8208-e210c32b0a53 | {
"language": "C++"
} | ```c++
#include "catch.hpp"
#include "Interpreter.hpp"
TEST_CASE("Allocation", "Make sure we can allocate a scheme interpreter")
{
script::Interpreter eval;
}
```
Make sure our interpreter is valid after construction. | ```c++
#include "catch.hpp"
#include "Interpreter.hpp"
TEST_CASE("Allocation", "Make sure we can allocate a scheme interpreter")
{
script::Interpreter eval;
REQUIRE(eval.isValid() == true);
}
``` |
1f14d22b-c0d1-4935-8645-2695e9238cf8 | {
"language": "C++"
} | ```c++
#include <map>
#include <ncurses.h>
#include <string>
#include <typeinfo>
#include <vector>
#include "configuration.hh"
#include "file_contents.hh"
#include "key_listeners.hh"
#include "show_message.hh"
#include "hooks.hh"
void loop() {
add_listeners();
add_hook(Hook::REFRESH,hook_show_message);
w... | ```c++
#include <map>
#include <ncurses.h>
#include <string>
#include <typeinfo>
#include <vector>
#include "configuration.hh"
#include "file_contents.hh"
#include "key_listeners.hh"
#include "show_message.hh"
#include "hooks.hh"
#include "to_str.hh"
void loop() {
add_listeners();
add_hook(Hook::REFRESH,hook_... |
4c76398e-5604-4a54-a9bd-9a70271aae5a | {
"language": "C++"
} | ```c++
#include <gtest/gtest.h>
#include <gmock/gmock-matchers.h>
#include "rendering/renderablezindexcomparer.hpp"
#include "__mocks__/rendering/renderablemock.hpp"
using testing::ElementsAre;
TEST(RenderableZIndexComparer_Compare, If_first_z_index_is_less_than_second_z_index_Then_true_is_returned)
{
qrw::Rendera... | ```c++
#include <gtest/gtest.h>
#include <gmock/gmock-matchers.h>
#include "rendering/renderablezindexcomparer.hpp"
#include "__mocks__/rendering/renderablemock.hpp"
using ::testing::ElementsAre;
TEST(RenderableZIndexComparer_Compare, If_first_z_index_is_less_than_second_z_index_Then_true_is_returned)
{
qrw::Rende... |
eb44e4fc-2271-480f-9c80-211d2b94ff15 | {
"language": "C++"
} | ```c++
#include "coincontroltreewidget.h"
#include "coincontroldialog.h"
CoinControlTreeWidget::CoinControlTreeWidget(QWidget *parent) :
QTreeWidget(parent)
{
}
void CoinControlTreeWidget::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Space) // press spacebar -> select checkbox
{
... | ```c++
#include "coincontroltreewidget.h"
#include "coincontroldialog.h"
CoinControlTreeWidget::CoinControlTreeWidget(QWidget *parent) :
QTreeWidget(parent)
{
}
void CoinControlTreeWidget::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Space) // press spacebar -> select checkbox
{
... |
aeb10ab6-a714-45ad-bf69-0900695e72f3 | {
"language": "C++"
} | ```c++
#include <vector>
#include "proc-service.h"
// Stub out run_child_proc function, for testing purposes.
void base_process_service::run_child_proc(const char * const *args, const char *working_dir,
const char *logfile, bool on_console, int wpipefd, int csfd, int socket_fd,
int notify_fd, int for... | ```c++
#include <vector>
#include "proc-service.h"
// Stub out run_child_proc function, for testing purposes.
void base_process_service::run_child_proc(run_proc_params params) noexcept
{
}
``` |
8bff7979-e812-4730-acf9-5bd8aa50274e | {
"language": "C++"
} | ```c++
// This is the main function for the NATIVE version of this project.
#include <iostream>
#include "../QSWorld.h"
int main()
{
std::cout << "Hello World!" << std::endl;
QSWorld world;
}
```
Build native QSWorld and run it for 100 updates; no muts yet. | ```c++
// This is the main function for the NATIVE version of this project.
#include <iostream>
#include "../QSWorld.h"
int main()
{
std::cout << "Hello World!" << std::endl;
QSWorld world(20, 20, 5);
for (size_t ud = 0; ud < 100; ud++) {
world.Update();
}
world.Print();
}
``` |
61af1701-ef8c-4509-a07f-d2aafa212b01 | {
"language": "C++"
} | ```c++
#include "adalgluggi.h"
#include "ui_adalgluggi.h"
#include <QDebug>
adalgluggi::adalgluggi(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::adalgluggi)
{
ui->setupUi(this);
}
adalgluggi::~adalgluggi()
{
delete ui;
}
void adalgluggi::on_velar_clicked()
{
qDebug () << "Vélar hnappur click... | ```c++
#include "adalgluggi.h"
#include "ui_adalgluggi.h"
#include <QDebug>
adalgluggi::adalgluggi(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::adalgluggi)
{
ui->setupUi(this);
}
adalgluggi::~adalgluggi()
{
delete ui;
}
void adalgluggi::on_velar_clicked()
{
qDebug () << "Vélar hnappur click... |
205b213b-ed93-4412-9017-920367357417 | {
"language": "C++"
} | ```c++
/* Copyright (c) 2013-2019 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RotatedHeaderView.h"
#include <QPainter>
using namesp... | ```c++
/* Copyright (c) 2013-2019 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RotatedHeaderView.h"
#include <QPainter>
using namesp... |
30a75e30-b867-4406-9686-bca1da28d0c3 | {
"language": "C++"
} | ```c++
#include "Halide.h"
#include <stdint.h>
#include <stdio.h>
#include <cmath>
using namespace Halide;
// FIXME: Why aren't we using a unit test framework for this?
// See Issue #898
void h_assert(bool condition, const char* msg) {
if (!condition) {
printf("FAIL: %s\n", msg);
abort();
}
}
... | ```c++
#include "Halide.h"
#include <stdint.h>
#include <stdio.h>
#include <cmath>
using namespace Halide;
// FIXME: Why aren't we using a unit test framework for this?
// See Issue #898
void h_assert(bool condition, const char* msg) {
if (!condition) {
printf("FAIL: %s\n", msg);
abort();
}
}
... |
b6b82831-7006-41ac-8980-34e1e3d812e9 | {
"language": "C++"
} | ```c++
#include <shogun/base/init.h>
#include <shogun/lib/common.h>
#include <shogun/lib/GCArray.h>
#include <shogun/kernel/Kernel.h>
#include <shogun/kernel/GaussianKernel.h>
#include <stdio.h>
using namespace shogun;
const int l=10;
int main(int argc, char** argv)
{
init_shogun();
// create array of kernels
C... | ```c++
#include <shogun/base/init.h>
#include <shogun/lib/common.h>
#include <shogun/lib/GCArray.h>
#include <shogun/kernel/Kernel.h>
#include <shogun/kernel/GaussianKernel.h>
#include <stdio.h>
using namespace shogun;
const int l=10;
int main(int argc, char** argv)
{
init_shogun();
// we need this scope, becaus... |
f0b03119-4150-4638-8805-56ceb1d26579 | {
"language": "C++"
} | ```c++
#include "Query.hh"
QString generateQuery(QString const &base, QString const &attribute, QString const &value)
{
QString condition = QString("@%1=\"%2\"").arg(attribute).arg(value);
return generateQuery(base, condition);
}
QString generateQuery(QString const &base, QString const &condition)
{
... | ```c++
#include <QtDebug>
#include "Query.hh"
QString generateQuery(QString const &base, QString const &attribute, QString const &value)
{
QString condition = QString("@%1=\"%2\"").arg(attribute).arg(value);
return generateQuery(base, condition);
}
QString generateQuery(QString const &base, QString cons... |
e86585b5-51f9-49ca-b40a-28136a0ab3b1 | {
"language": "C++"
} | ```c++
#include "stdafx.h"
#include "Collider.h"
#include "Explosion.h"
#include "ColliderManager.h"
//Base Class of All Explosions
bool Explosion::init()
{
explosion = ParticleExplosion::create();
this->addChild(explosion);
isFlying = true;
lifeTime = 2 * Director::getInstance()->getFrameRate();
return true;
}
... | ```c++
#include "stdafx.h"
#include "Collider.h"
#include "Explosion.h"
#include "ColliderManager.h"
//Base Class of All Explosions
bool Explosion::init()
{
explosion = ParticleExplosion::create();
this->addChild(explosion);
isFlying = true;
lifeTime = 10 * Director::getInstance()->getFrameRate();
return true;
}
... |
2bc46bed-51cf-41e3-965d-c34979f35031 | {
"language": "C++"
} | ```c++
// Copyright (c) 2020-2022 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#include <tinyformat.h>
#include <util/syserror.... | ```c++
// Copyright (c) 2020-2022 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#include <tinyformat.h>
#include <util/syserror.... |
0602180e-2e74-4684-bc0c-99013f3a3e2b | {
"language": "C++"
} | ```c++
#include "gtest/gtest.h"
#include "lms/endian.h"
TEST(Endian, uint16) {
using lms::Endian;
ASSERT_EQ(0xFECAu, Endian::letoh(Endian::htobe(uint16_t(0xCAFEu))));
ASSERT_EQ(0xFECAu, Endian::betoh(Endian::htole(uint16_t(0xCAFEu))));
}
TEST(Endian, uint32) {
using lms::Endian;
ASSERT_EQ(0xEFBEAD... | ```c++
#include "gtest/gtest.h"
#include "lms/endian.h"
TEST(Endian, uint16) {
using lms::Endian;
ASSERT_EQ(0xFECAu, Endian::letoh(Endian::htobe(uint16_t(0xCAFEu))));
ASSERT_EQ(0xFECAu, Endian::betoh(Endian::htole(uint16_t(0xCAFEu))));
}
TEST(Endian, uint32) {
using lms::Endian;
ASSERT_EQ(0xEFBEAD... |
08168fd1-2596-41ac-8bd2-20c8a35f2f90 | {
"language": "C++"
} | ```c++
#include "Selector.h"
bool StartsWith(const std::string& prefix, const std::string& query)
{
return (query.compare(0, prefix.length(), prefix) == 0);
}
std::string ConsumePrefix(const std::string& prefix, const std::string& query)
{
if (StartsWith(prefix, query))
return query.substr(prefix.length());
... | ```c++
#include "Selector.h"
bool StartsWith(const std::string& prefix, const std::string& query)
{
if (prefix.length() == 0)
return true;
if (prefix[0] == '?' && query.length() > 0)
{
return StartsWith(prefix.substr(1), query.substr(1));
}
return (query.compare(0, prefix.length(), prefix) == 0);
}... |
1f36172a-9818-4677-8154-c2d13ea48166 | {
"language": "C++"
} | ```c++
// RUN: %clang_cc1 -fdelayed-template-parsing -fsyntax-only -verify %s
template <class T>
class A {
void foo() {
undeclared();
}
void foo2();
};
template <class T>
class B {
void foo4() { } // expected-note {{previous definition is here}} expected-note {{previous definition i... | ```c++
// RUN: %clang_cc1 -fdelayed-template-parsing -fsyntax-only -verify %s
template <class T>
class A {
void foo() {
undeclared();
}
void foo2();
};
template <class T>
class B {
void foo4() { } // expected-note {{previous definition is here}} expected-note {{previous definition is here}}
... |
b4a68175-6eb2-4ddc-8c8a-789758344b0d | {
"language": "C++"
} | ```c++
#include "Progression.h"
Progression* Progression::m_instance = nullptr;
Progression::Progression()
{
}
Progression::~Progression()
{
}
bool Progression::WriteToFile(std::string filename)
{
std::ofstream saveFile;
saveFile.open("..\\Debug\\Saves\\" + filename + ".txt");
if (!saveFile.is_open()) {
re... | ```c++
#include "Progression.h"
Progression* Progression::m_instance = nullptr;
Progression::Progression()
{
this->m_currentLevel = 0;
this->m_currentCheckpoint = 0;
this->m_unlockedLevels = 0;
}
Progression::~Progression()
{
}
bool Progression::WriteToFile(std::string filename)
{
std::ofstream saveFile;
sav... |
a03b9758-a563-4e66-b858-0af101afe207 | {
"language": "C++"
} | ```c++
#include <hal/clock.hpp>
#include <hal/uart.hpp>
#include <stdio.h>
#define UNUSED(expr) do { (void)(expr); } while (0)
#define CURRENT_UART 1
//------------------------------------------------------------------------------
void callback (const types::buffer& buffer, uart::Uart& uart)
{
uart.send(buffer... | ```c++
#include <hal/clock.hpp>
#include <hal/uart.hpp>
#include <stdio.h>
#define UNUSED(expr) do { (void)(expr); } while (0)
#define CURRENT_UART 2
//------------------------------------------------------------------------------
void callback (const types::buffer& buffer, uart::Uart& uart)
{
uart.send(buffer... |
1446d53d-da31-40da-a36e-f9b43704f8d4 | {
"language": "C++"
} | ```c++
#include "../vm/debug.h"
#include "../vm/vm.h"
#include <fstream>
int main(int argc, char *argv[]) {
std::ifstream bytecode_if;
std::streamsize bytecode_size;
uint8_t *bytecode;
if (argc < 3) {
printf("Usage: %s <opcodes_key> <program>\n", argv[0]);
return 1;
}
/*
r... | ```c++
#include "../vm/debug.h"
#include "../vm/vm.h"
#include <fstream>
int main(int argc, char *argv[]) {
std::ifstream bytecode_if;
std::streamsize bytecode_size;
uint8_t *bytecode;
if (argc < 3) {
printf("Usage: %s <opcodes_key> <program>\n", argv[0]);
return 1;
}
/*
r... |
e0a56019-d0c5-4f63-904e-1dc36fd119de | {
"language": "C++"
} | ```c++
#include <exception>
#include "globals.hh"
#include "G4Application.hh"
using namespace g4;
using namespace std;
/**
* @short Simple main function.
*
* It only initializes and runs application and
* prints out all exceptions.
*/
int main(int argc, char** argv)
{
try
{
// Run the appl... | ```c++
#include <exception>
#include "globals.hh"
#include "G4Application.hh"
using namespace g4;
using namespace std;
/**
* @short Simple main function.
*
* It only initializes and runs application and
* prints out all exceptions.
*/
int main(int argc, char** argv)
{
try
{
// Run the appl... |
0ddf244f-835f-487e-8560-99b8312de366 | {
"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... |
0b420324-023c-4c60-bca7-fc3b72abe394 | {
"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)
//==============================================... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.