doc_id stringlengths 36 36 | metadata dict | input stringlengths 28 4.3k | output stringlengths 11 5.45k |
|---|---|---|---|
84acf79d-141a-4a2b-bbe5-a7e3afbbebd2 | {
"language": "C++"
} | ```c++
```
Remove Duplicates from Sorted Array II. | ```c++
/**
* Remove Duplicates from Sorted Array II
*
* cpselvis(cpselvis@gmail.com)
* September 21th, 2016
*/
#include<iostream>
#include<vector>
#include<unordered_map>
using namespace std;
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
unordered_map<int, int> umap;
int ret = num... |
732bcc97-9f19-4bd5-98d4-a5490216e078 | {
"language": "C++"
} | ```c++
```
Test case for naming of conversion function template specializations | ```c++
// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {
template <class T> operator T*();
};
template <class T> A::operator T*() { return 0; }
template <> A::operator char*(){ return 0; } // specialization
template A::operator void*(); // explicit instantiation
int main() {
A a;
int *ip;
ip = a.oper... |
d3ad76f3-bca4-4213-b4b7-373662e27edd | {
"language": "C++"
} | ```c++
```
Debug log implementation to use the STM32 HAL UART implementation. Redirects (f)printf HAL_UART_Transmit using a UART_HandleTypeDef that must be provided as DEBUG_UART_HANDLE | ```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... |
5633cbf9-2dcc-4bae-a4c1-261d897e25ed | {
"language": "C++"
} | ```c++
```
Add empty chip::lowLevelInitialization() for STM32L4 | ```c++
/**
* \file
* \brief chip::lowLevelInitialization() implementation for STM32L4
*
* \author Copyright (C) 2017 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
*
* \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 ... |
d04929e6-5edb-4c7b-b151-49a1f29960b2 | {
"language": "C++"
} | ```c++
```
Add benchmark for testing umat vs mat for optical flow | ```c++
/*
* optical_flow_mat_benchmark.cpp
*
* Created on: May 22, 2016
* Author: Cody W. Eilar <Cody.Eilar@Gmail.com>
*/
#include <celero/Celero.h>
#include "../readers/video_file_reader.h"
#include "../datatypes/image.h"
#include "../optical_flow/motion_estimation.h"
#include "../optical_flow/optical_flo... |
f996f67b-59af-439b-b974-3c5b1493f925 | {
"language": "C++"
} | ```c++
```
Add author solution for problem | ```c++
#include<iostream>
#include<set>
const int MAXN = 300042;
int A[MAXN];
int main()
{
std::cin.tie(0);
std::ios::sync_with_stdio(0);
int n, q;
std::cin >> n >> q;
for(int i = 0; i < n; ++i)
std::cin >> A[i];
std::set<int> break_points;
for(int i = 1; i < n; ++i)
{
if(A[i] <= A[i - 1])
break_po... |
8cbc29d4-79a8-4ff9-a87d-ab4fe2dc5e68 | {
"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.
// Use this file to assert that *_list.h enums that are meant to do the bridge
// from Blink are valid.
#include "base/macros.h"
#include "content... | ```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.
// Use this file to assert that *_list.h enums that are meant to do the bridge
// from Blink are valid.
#include "base/macros.h"
#include "content... |
65a7f47c-121e-45f8-8ce6-69a207c53c10 | {
"language": "C++"
} | ```c++
```
Implement basic, but useful Tokeniser tests. | ```c++
// This file is part of playd.
// playd is licenced under the MIT license: see LICENSE.txt.
/**
* @file
* Tests for the Tokeniser class.
*/
#include "catch.hpp"
#include "../io/tokeniser.hpp"
SCENARIO("Tokenisers can handle complete, unquoted commands", "[tokeniser]") {
GIVEN("A fresh Tokeniser") {
Toke... |
0e705076-568b-4f61-9209-fe9169b1627c | {
"language": "C++"
} | ```c++
```
Add Reverse of String using Stack | ```c++
// C++ Program Reverse String using Stack
#include<iostream> // include header files
#include<string.h>
using namespace std;
#define size 20 // include preprocessor
int top = -1; // global variables
char stack[size];
char push(char ch) // Function which push string in stack
{
if(top==(size-1)) // condi... |
8227920e-5445-4e77-8a3e-26374db6bd54 | {
"language": "C++"
} | ```c++
```
Add test for logging the implicit "this" argument for C++ member functions. | ```c++
// Intercept the implicit 'this' argument of class member functions.
//
// RUN: %clangxx_xray -g -std=c++11 %s -o %t
// RUN: rm log-args-this-* || true
// RUN: XRAY_OPTIONS="patch_premain=true verbosity=1 xray_logfile_base=log-args-this-" %run %t
//
// XFAIL: arm || aarch64 || mips
// UNSUPPORTED: powerpc64le
#i... |
ba6541f1-d2e0-4c7e-85db-78e88c67ac50 | {
"language": "C++"
} | ```c++
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/pref_service.h"
#include... | ```c++
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/pref_service.h"
#include... |
c9d3347c-227f-40ce-af4c-7a29edfb7e8e | {
"language": "C++"
} | ```c++
```
Test du Generator et de la Database en console | ```c++
#include <iostream>
#include <OptionList.h>
#include <SQLiteDatabase.h>
#include <SimilarityStrategy.h>
#include <Generator.h>
#define PARAMS 1
using namespace SoundCity;
using std::cout;
using std::endl;
void
usage (char *s)
{
fprintf(stderr, "Usage: %s <database>\n", s);
exit(EXIT_FAILURE);
}
int
mai... |
e2750dff-503a-4403-b0d9-bbf75ff6beef | {
"language": "C++"
} | ```c++
```
Add Solution for Problem 149 | ```c++
// 149. Max Points on a Line
/**
* Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
*
* Tags: Hash Table, Math
*
* Author: Kuang Qin
*/
#include "stdafx.h"
#include <vector>
#include <unordered_map>
using namespace std;
/**
* Definition for a point.
*... |
86928aac-0407-46f2-87f6-e31caf8e2a0b | {
"language": "C++"
} | ```c++
// Return multiple values
#include <tuple>
std::tuple<int, bool, float> foo()
{
return {128, true, 1.5f};
}
int main()
{
int obj1;
bool obj2;
float obj3;
std::tie(obj1, obj2, obj3) = foo();
}
// Return multiple values of different types from a function.
//
// The `foo` function on [5-8] returns a
// [... | ```c++
// Return multiple values
#include <tuple>
std::tuple<int, bool, float> foo()
{
return std::make_tuple(128, true, 1.5f);
}
int main()
{
int obj1;
bool obj2;
float obj3;
std::tie(obj1, obj2, obj3) = foo();
}
// Return multiple values of different types from a function.
//
// The `foo` function on [5-8]... |
9e9f4092-d2af-4783-946a-ac66008ed0ce | {
"language": "C++"
} | ```c++
```
Add solution for 17.8 problem. | ```c++
#include <iostream>
#include <tuple>
#include <vector>
namespace {
struct Person {
int weight;
int height;
};
bool operator>(const Person &a, const Person &b) {
return std::tie(a.weight, a.height) > std::tie(b.weight, b.height);
}
bool operator<(const Person &a, con... |
5924a7c0-d89a-4684-9602-82607bf89caf | {
"language": "C++"
} | ```c++
//TODO remove unused imports
#include <climits>
#include <cstring>
#include <unistd.h>
#include <sys/stat.h>
#include <algorithm>
#include <string>
#include <core/loader.h>
#include <core/module.h>
#include <core/logger.h>
#include <core/framework.h>
namespace lms{
std::string Framework::programDirectory(){
... | ```c++
//TODO remove unused imports
#include <climits>
#include <cstring>
#include <unistd.h>
#include <sys/stat.h>
#include <algorithm>
#include <string>
#include <core/loader.h>
#include <core/module.h>
#include <core/logger.h>
#include <core/framework.h>
#ifdef __APPLE__
#include <mach-o/dyld.h>
#endif
namesp... |
c57310a6-f9aa-4e3b-9913-e1738a92795c | {
"language": "C++"
} | ```c++
```
Add Forgotten test for: Fix template parameter default args missed if redecled | ```c++
// RUN: %clang_cc1 -fsyntax-only -verify %s
// expected-no-diagnostics
namespace llvm {
template<typename T > struct StringSet;
template<int I > struct Int;
template <typename Inner, template <typename> class Outer>
struct TemplTempl;
}
namespace lld {
using llvm::StringSet;
using llvm::Int;
usi... |
b3a10c18-73b1-4bdd-82e8-8b21ce3693b0 | {
"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 "net/url_request/url_fetcher.h"
#include "net/url_request/url_fetcher_factory.h"
#include "net/url_request/url_fetcher_impl.h"
names... | ```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 "net/url_request/url_fetcher.h"
#include "net/url_request/url_fetcher_factory.h"
#include "net/url_request/url_fetcher_impl.h"
names... |
ac525960-04e0-4dda-9aa8-941d40c7e457 | {
"language": "C++"
} | ```c++
```
Add unit tests for user C bindings | ```c++
#include <boost/test/unit_test.hpp>
#include <ygo/deck/c/User.h>
#include <ygo/deck/c/DB.h>
struct User_Fixture
{
User_Fixture()
{
DB_NAME(set_path)("test/card.db");
}
};
BOOST_FIXTURE_TEST_SUITE(User, User_Fixture)
BOOST_AUTO_TEST_CASE(Create)
{
auto user = USER_NAME(new_create)("Test... |
95ae0869-e250-40ec-b687-5016e1c0eb02 | {
"language": "C++"
} | ```c++
```
Revert "BinEditor: Remove unused file" | ```c++
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accorda... |
6eae1fd8-7a37-4af7-a76e-56c6ac030c94 | {
"language": "C++"
} | ```c++
```
Convert Sorted Array to Binary Search Tree | ```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:
TreeNode* transfer(vector<int>& nums, int start, int end){
if(start > end) retur... |
059b7d73-e5f3-4b85-9d32-667693093cbe | {
"language": "C++"
} | ```c++
// Check existence of a key
// C++11
#include <map>
#include <string>
int main()
{
std::map<std::string, int> m = {{"a", 1}, {"b", 2}, {"c", 3}};
if (m.count("b"))
{
// We know "b" is in m
}
}
// Check if a particular key is in an associative container.
//
// On [9], we create a [`std::map`](cpp/cont... | ```c++
// Check existence of a key
// C++11
#include <map>
#include <string>
int main()
{
std::map<std::string, int> m = {{"a", 1}, {"b", 2}, {"c", 3}};
if (m.count("b"))
{
// We know "b" is in m
}
}
// Check if a particular key is in an associative container.
//
// On [9], we create a [`std::map`](cpp/cont... |
d2f57c7e-1b5c-4261-8f88-371a6d5b52be | {
"language": "C++"
} | ```c++
```
Fix origin propagation for select of floats. | ```c++
// Regression test for origin propagation in "select i1, float, float".
// https://code.google.com/p/memory-sanitizer/issues/detail?id=78
// RUN: %clangxx_msan -O2 -fsanitize-memory-track-origins %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
// RUN: %clangxx_msan -O2 -fsanitize-memory-trac... |
5c08e771-7da5-4645-b06a-ee179b62f990 | {
"language": "C++"
} | ```c++
```
Add test for previous commit. | ```c++
// RUN: %clang_cc1 %s -triple=arm-linux-gnueabi -target-abi aapcs -emit-llvm -o - | FileCheck %s
class SMLoc {
const char *Ptr;
public:
SMLoc();
SMLoc(const SMLoc &RHS);
};
SMLoc foo(void *p);
void bar(void *x) {
foo(x);
}
void zed(SMLoc x);
void baz() {
SMLoc a;
zed(a);
}
// CHECK: declare arm_aapcscc... |
f820a894-528e-4d09-a24c-de043e023627 | {
"language": "C++"
} | ```c++
```
Add script to test install | ```c++
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
``` |
cb7c0ae2-2534-47e0-a4b4-619eee99d5d1 | {
"language": "C++"
} | ```c++
```
Create a class to look at difference in time for constructors | ```c++
#include <iostream>
#include <chrono>
struct Test {
Test(long N) : n(N) {
long sum = 0;
for (long i = 0; i < n; ++i) {
sum += i;
}
}
Test() : n(1e8) {
Test(n);
}
long n;
}; // struct Test
int main(int argc, char* argv[]) {
const long N(1e8);
auto start = std::chrono::system_clock::now();
T... |
f9219923-2634-49fe-bf04-7660fabb9a45 | {
"language": "C++"
} | ```c++
```
Add a test for double version of mdivide_left_sped. | ```c++
#include <stan/math/matrix/mdivide_left_spd.hpp>
#include <stan/math/matrix/typedefs.hpp>
#include <gtest/gtest.h>
TEST(MathMatrix,mdivide_left_spd_val) {
using stan::math::mdivide_left_spd;
stan::math::matrix_d Ad(2,2);
stan::math::matrix_d I;
Ad << 2.0, 3.0,
3.0, 7.0;
I = mdivide_left_spd... |
7939f198-8b53-463f-9381-adf339d594c7 | {
"language": "C++"
} | ```c++
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/at_exit.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/test/lau... | ```c++
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/at_exit.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/test/lau... |
8b38a1bf-5968-46ef-8010-41e51b327cca | {
"language": "C++"
} | ```c++
```
Test fix-it added in r152198. | ```c++
// RUN: %clang_cc1 -Wc++11-compat -verify -std=c++98 %s
// RUN: cp %s %t
// RUN: not %clang_cc1 -Wc++11-compat -Werror -x c++ -std=c++98 -fixit %t
// RUN: %clang_cc1 -Wall -pedantic-errors -Wc++11-compat -Werror -x c++ -std=c++98 %t
// This is a test of the code modification hints for C++11-compatibility proble... |
b333b74f-ddf0-4542-a915-b6539de5905a | {
"language": "C++"
} | ```c++
```
Add thread cached ints benchmark | ```c++
/*
* Copyright 2018-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... |
077d3d54-99c9-49f9-9eea-5d8178843943 | {
"language": "C++"
} | ```c++
#include <stddef.h>
#include "util/timer.h"
#define MS_PER_SECOND 1000
unsigned long openxc::util::time::startupTimeMs() {
static unsigned long startupTime = time::systemTimeMs();
return startupTime;
}
unsigned long openxc::util::time::uptimeMs() {
return systemTimeMs() - startupTimeMs();
}
/* Pr... | ```c++
#include <stddef.h>
#include "util/timer.h"
#define MS_PER_SECOND 1000
unsigned long openxc::util::time::startupTimeMs() {
static unsigned long startupTime = time::systemTimeMs();
return startupTime;
}
unsigned long openxc::util::time::uptimeMs() {
return systemTimeMs() - startupTimeMs();
}
/* Pr... |
cf51fd4a-7738-4afb-a80c-f0f1636a283e | {
"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 <vector>
#include "base/message_loop/message_loop.h"
#include "device/hid/hid_service.h"
#include "testing/gtest/include/gtest/gtest.h"
... | ```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 <vector>
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "device/hid/hid_service.h"
#include "te... |
fac2356d-5a0f-4ea3-8113-a66a151db530 | {
"language": "C++"
} | ```c++
```
Add "multiple return values" sample | ```c++
// Return multiple values
#include <tuple>
#include <string>
std::tuple<int, bool, std::string> foo()
{
return {128, true, "hello"};
}
int main()
{
int obj1;
bool obj2;
std::string obj3;
std::tie(obj1, obj2, obj3) = foo();
}
// Return multiple values of different types from a function.
//
// The `foo`... |
03bfd7ec-6a51-48e8-b6ec-d159c16a22e5 | {
"language": "C++"
} | ```c++
```
Add example for the room functions | ```c++
// Copyright 2018 otris software AG
//
// 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 appli... |
52dcd647-696c-4a48-a8b1-7763b838e525 | {
"language": "C++"
} | ```c++
```
Add C++ program that does not depend on libstdc++ but still uses many c++ features. This is for testing compilers. | ```c++
/* A c++ program that can be linked without libstdc++ */
#include <cstdio> //Seems to be ok, requires libc
#include <cstdlib>
class C
{
public:
C(int x) { data = x; mem = (int *)malloc(sizeof*mem); }
~C() { printf("Destroying C object with data = %i\n",data); free(mem); }
protected:
int data;
int *mem;... |
887df63a-7855-490c-9cbb-e6072236dab1 | {
"language": "C++"
} | ```c++
```
Add solution for chapter 17 test 25 | ```c++
#include <iostream>
#include <string>
#include <regex>
using namespace std;
using namespace std::regex_constants;
int main() {
string phone = "(\\()?(\\d{3})(\\))?([-. ])?(\\d{3})([-. ])?(\\d{4})";
regex r(phone);
string s;
string fmt = "$2.$5.$7";
while(getline(cin, s)) {
... |
02271213-e022-4657-aa58-231af68ef03a | {
"language": "C++"
} | ```c++
```
Test case for OpenCL 1.1 Sampler Objects | ```c++
/* test OpenCL 1.1 Sampler Objects (section 5.5) */
#include "utest_helper.hpp"
void compiler_sampler(void)
{
OCL_ASSERT(ctx != 0);
cl_sampler s;
cl_int err;
int a1[] = {CL_TRUE, CL_FALSE},
a2[] = {CL_ADDRESS_MIRRORED_REPEAT,
CL_ADDRESS_REPEAT,
CL_ADDRESS_CLAMP_TO_EDGE,... |
9547eacb-1bc8-4821-bcf3-42d9fe237dbc | {
"language": "C++"
} | ```c++
```
Add solution for chapter 18 test 3 | ```c++
#include <iostream>
#include <fstream>
#include <vector>
#include <memory>
using namespace std;
void exercise1(int *b, int *e) {
try {
vector<int> v(b, e);
int *p = new int[v.size()];
ifstream in("ins");
throw p;
} catch(int *p) {
delete[] p;
}... |
60ad66e2-b2c1-4098-b307-6c5589adb104 | {
"language": "C++"
} | ```c++
```
Add solution for problem 4.1 | ```c++
#include "data.hpp"
#include "graph.hpp"
#include <string>
#include <vector>
namespace {
enum Status : uint8_t { NONE, VISITED, PROCESSED };
template <typename Graph> struct DFS {
using index_type = unsigned int;
explicit DFS(Graph &g) : graph(g), states(g.get_number_of_vertexes(), NONE... |
9546b2dc-431c-4f30-af09-a5bae12f3db1 | {
"language": "C++"
} | ```c++
```
Add Chapter 2, exercise 1: eliminate duplicates in linked list | ```c++
// 2.1 - remove duplicates from unsorted linked list
// uses STL list and set
#include<iostream>
#include<list>
#include<set>
using namespace std;
typedef list<int>::iterator iter;
typedef list<int>::const_iterator c_iter;
void remove_duplicates(list<int>& l)
{
set<int> vals;
iter p = l.begin();
... |
3f5b2026-9dde-4d1c-b2fa-a6641240cdfd | {
"language": "C++"
} | ```c++
```
Add missing test case for PR8230 | ```c++
// RUN: %clang_cc1 -fsyntax-only -verify %s
void g();
void f(); // expected-note 9{{candidate function}}
void f(int); // expected-note 9{{candidate function}}
template<class T> void t(T); // expected-note 3{{candidate function}}
template<class T> void t(T*); // expected-note 3{{candidate function}}
template<c... |
d0a44e3e-31d9-4da1-8ca9-5b81a3549b52 | {
"language": "C++"
} | ```c++
```
Add rdtsc snippet and wrapper script | ```c++
//usr/bin/g++ "$0" -o /tmp/Rdtsc && exec /tmp/Rdtsc "$@"
/*
* Copyright (c) 2015-2018 Agalmic Ventures LLC (www.agalmicventures.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Soft... |
f904ec86-9162-4299-b8d9-a5389ff641cb | {
"language": "C++"
} | ```c++
```
Add tests for the user defined subsystem interface² | ```c++
#include "stdafx.h"
#include "engineBootstrap.hpp"
#include <catch/catch.hpp>
namespace Annwvyn
{
class TestEvent : public AnnUserSpaceEvent
{
public:
TestEvent(const std::string& message) : AnnUserSpaceEvent("TestEvent"),
storedMessage(message)
{
}
std::string getMessage() const { return storedM... |
a5b17817-5361-4508-b24e-744ed98c6937 | {
"language": "C++"
} | ```c++
```
Add solution for chapter 16 test 42. | ```c++
#include <iostream>
#include <string>
using namespace std;
template <typename T>
void g(T &&val) {
T t = val;
t -= 1;//for test
if(val == t) {
cout << "T is reference" << endl;
} else {
cout << "T is not reference" << endl;
}
}
template <typename T>
void g3... |
6775bbb7-6a46-4eb1-b6cc-3452bd9dac8f | {
"language": "C++"
} | ```c++
```
Remove gived elements from vector. | ```c++
/**
* Remove Element
*
* cpselvis(cpselvis@gmail.com)
* August 24th, 2016
*/
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int i;
for (i = 0; i < nums.size(); )
{
if (nums[i] == val)
{
nums.erase... |
af7df27a-8896-4f55-a68d-8c5cbaa579ea | {
"language": "C++"
} | ```c++
```
Add simple function for printing some freshly generated keys. | ```c++
#include <openssl/bn.h>
#include <openssl/ecdsa.h>
#include <openssl/ec.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <stdio.h>
main() {
EC_KEY *eckey;
BN_CTX *ctx;
ctx = BN_CTX_new();
if(!ctx) {
printf("failed to create bn ctx\n");
return 1;
}
eckey = EC_KEY_new_by_cu... |
b6135a48-678c-4809-a5b0-c38a41c477ea | {
"language": "C++"
} | ```c++
```
Add tests for library version of is_convertible | ```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.
//
//===---------------------------------... |
9ef9f051-9ee9-4da0-9f05-d35cd5c2f260 | {
"language": "C++"
} | ```c++
```
Add conversion Roman numbers to integer value. | ```c++
#include <unordered_map>
#include <iostream>
using namespace std;
int romanToInteger(const string& s) {
unordered_map<char, int> T = {
{ 'I', 1 },
{ 'V', 5 },
{ 'X', 10 },
{ 'L', 50 },
{ 'C', 100 },
{ 'D', 500 },
{ 'M', 1000 }
};
int sum = T[s.back()];
for (int i = s.length() - 2; i >= 0; i-... |
4519e31c-39c4-4a11-a49d-ab2746524fe9 | {
"language": "C++"
} | ```c++
```
Add Solution for Problem 077 | ```c++
// 77. Combinations
/**
* Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
*
* For example,
* If n = 4 and k = 2, a solution is:
*
* [
* [2,4],
* [3,4],
* [2,3],
* [1,2],
* [1,3],
* [1,4],
* ]
*
* Tags: Backtracking
*
* Similar Problems: ... |
e4dc1bef-4999-4f64-be52-162f54c87e19 | {
"language": "C++"
} | ```c++
```
Add test case for insertion sort | ```c++
/*
This program tests soring algorithms defined in sort.h
*/
#include<iostream>
#include<vector>
#include "sort.h" // My implementation of some sorting algorithms on std::vector of int
// Displays vector
void printVector(std::vector<int> A){
for(auto x: A){
std::cout<<x<<" ";
}
std::cout<<std::endl;
}... |
bdc1e749-4a3b-47ab-9ede-4680efa57dba | {
"language": "C++"
} | ```c++
```
Add a simple test for indexing namespaces | ```c++
// Test is line- and column-sensitive; see below.
namespace std {
namespace rel_ops {
void f();
}
}
namespace std {
void g();
}
// FIXME: using directives, namespace aliases
// RUN: c-index-test -test-load-source all %s | FileCheck %s
// CHECK: load-namespaces.cpp:3:11: Namespace=std:3:11 (Definiti... |
9cce7683-df7c-42fc-b238-6ceb4dec537c | {
"language": "C++"
} | ```c++
```
Convert BST to Greater Tree | ```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 {
int presum=0;
public:
TreeNode* convertBST(TreeNode* root) {
inorder(root);
retu... |
a2e9a258-00bc-4da3-82c9-66a7a1b540e4 | {
"language": "C++"
} | ```c++
```
Remove Duplicates from Sorted Array II | ```c++
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int cur = 0, count = 0, total = nums.size();
for (auto iter = nums.begin(); iter != nums.end();) {
if (iter == nums.begin()) {
cur = *iter;
count = 1;
++iter;
... |
037af23f-d4b2-4330-9936-8c3de1913a48 | {
"language": "C++"
} | ```c++
```
Add quantas chamadas recursivas to cadernaveis | ```c++
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll sol(ll n, int m) {
ll a, b, c, d, r;
a = 1; b = 0; c = 0; d = 1;
while (n) {
if (n&1) {
r = ((d*b) + (c*a)) % m;
b = (d*(b+a) + (c*b)) % m;
a = r;
}
r = (c*c + d*d) % m... |
b24e99b3-83cf-467e-b098-3bc1295330f9 | {
"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.
extern "C" {
#if defined(GLES2_CONFORM_SUPPORT_ONLY)
#include "gpu/gles2_conform_support/gtf/gtf_stubs.h"
#else
#include "third_party/gles2_con... | ```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.
extern "C" {
#if defined(GLES2_CONFORM_SUPPORT_ONLY)
#include "gpu/gles2_conform_support/gtf/gtf_stubs.h"
#else
#include "third_party/gles2_con... |
9d1df86d-56ad-4a3d-9e10-2923c396cca1 | {
"language": "C++"
} | ```c++
```
Test case for llvm-gcc rev. 64648. | ```c++
// Test on debug info to make sure that anon typedef info is emitted.
// RUN: %llvmgcc -S --emit-llvm -x c++ -g %s -o - | grep composite
typedef struct { int a; long b; } foo;
foo x;
``` |
70c47d80-2e66-41ee-bc1e-15a6b1f29d91 | {
"language": "C++"
} | ```c++
```
Add test cases for SAX2XMLReader. | ```c++
// test cases for rule CWE-611
#include "tests.h"
// ---
typedef unsigned int XMLCh;
class XMLUni
{
public:
static const XMLCh fgXercesDisableDefaultEntityResolution[];
};
class SAX2XMLReader
{
public:
void setFeature(const XMLCh *feature, bool value);
void parse(const InputSource &data);
};
class XMLRe... |
9f9c174e-a724-46ac-91a9-a34383ee2650 | {
"language": "C++"
} | ```c++
```
Add a pin interrupt test | ```c++
/*
* isr.c:
* Wait for Interrupt test program - ISR method
*
* How to test:
* Use the SoC's pull-up and pull down resistors that are avalable
* on input pins. So compile & run this program (via sudo), then
* in another terminal:
* gpio mode 0 up
* gpio mode 0 down
* at which point it should trigger... |
5c7a445b-5675-4e54-b5e8-5709c706fd77 | {
"language": "C++"
} | ```c++
```
Add test to check implicit upcasting of float16_t works. | ```c++
#include "Halide.h"
#include <stdio.h>
#include <cmath>
using namespace Halide;
// FIXME: We should use a proper framework for this. See issue #898
void h_assert(bool condition, const char *msg) {
if (!condition) {
printf("FAIL: %s\n", msg);
abort();
}
}
int main() {
Halide::Func f... |
42c57699-6959-4300-97a3-ab2a38cb1a87 | {
"language": "C++"
} | ```c++
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <unistd.h>
#include "base/sys_info.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace android {
TEST(SysUtils... | ```c++
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <unistd.h>
#include "base/sys_info.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace android {
TEST(SysUtils... |
c03d9cce-b1ff-43ea-93f3-a2cfc16be5c2 | {
"language": "C++"
} | ```c++
```
Add file missed in r574. | ```c++
#include <common/buffer.h>
#include <event/action.h>
#include <event/callback.h>
#include <event/event.h>
#include <event/event_system.h>
Action *
Callback::schedule(void)
{
return (EventSystem::instance()->schedule(this));
}
``` |
6b3cf13f-d761-4d09-a0ca-38b3e6b6a9a6 | {
"language": "C++"
} | ```c++
```
Add a solution of prob 1 | ```c++
#include <stdio.h>
int main(void)
{
int sum = 0, count = 0;
do
{
int num;
printf("Enter the num= ");
scanf("%d", &num);
sum += (++count % 2 == 1) ? num : -num;
}
while(sum != 0);
printf("Result: %d\n", count);
return 0;
}
``` |
fc0332da-410d-481f-b0bc-26049864aa30 | {
"language": "C++"
} | ```c++
```
Add ARM-to-FPGA 32-bit raw I/O example | ```c++
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#define FPGA_MANAGER_BASE 0xFF706000
#define FPGA_GPO_OFFSET 0x10
#define FPGA_GPI_OFFSET 0x14
int main()
{
int dev_mem = open("/dev/mem", O_RDWR);
if(dev_mem == 0) {
perror("open");
exit(... |
a3806813-cf8d-40d5-93f0-99401f1c5c97 | {
"language": "C++"
} | ```c++
```
Add dexgrep tool -- grep for class definitions | ```c++
/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#in... |
57e70250-b7d4-43b9-be7f-e394b224232b | {
"language": "C++"
} | ```c++
```
Add Chapter 21, Try This 3 | ```c++
// Chapter 21, Try This 3: define a vector<Record>, initialise it with four
// records of your choice, and compute their total price using the functions
// given
#include "../lib_files/std_lib_facilities.h"
#include<numeric>
//------------------------------------------------------------------------------
stru... |
9372ca74-c63b-424d-83ec-cb5d9361e1b0 | {
"language": "C++"
} | ```c++
```
Add example for MoveFolder operation | ```c++
// Copyright 2016 otris software AG
//
// 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 appli... |
04d7ed3f-96fb-4c42-85dc-2adada0c02c5 | {
"language": "C++"
} | ```c++
```
Add Chapter 25, exercise 10 | ```c++
// Chapter 25, exercise 10: write an example that initializes a PPN, then reads
// and prints each field value, then changes each field value (by assigning to
// the field) and prints the result. Repeat, but store the PPN information in a
// 32-bit unsigned integer and use bit manipulation operators to access th... |
b3095769-a585-4a8e-af5b-1ed4db086757 | {
"language": "C++"
} | ```c++
```
Add floyd warshall all pairs shortest path | ```c++
/**
* Floyd Warshall's Algorithm for All Pairs shortest path problem
*/
#include <iostream>
#include <limits.h>
#define V 4
#define INF INT_MAX
using namespace std;
void print(int array[][V]) {
for (int i = 0; i < V; i++) {
for (int j = 0; j < V; j++) {
if (array[i][j] == INF)
cout<<"INF ";... |
a9dda46e-9d8e-49f5-a75a-86aa50ed165b | {
"language": "C++"
} | ```c++
```
Add solution to problem 10. | ```c++
/*
* Summation of primes
*
* The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
*
* Find the sum of all the primes below two million.
*/
#include <iostream>
#include <numeric>
#include <vector>
#include "sieve.hpp"
constexpr Long limit = 2'000'000;
int main(int, char **) {
auto primes = sieve(li... |
2e0b3213-3347-4355-8748-1b62e7d7665a | {
"language": "C++"
} | ```c++
```
Add merge sort c++ source code | ```c++
#include <bits/stdc++.h>
using namespace std;
void merge(vector<int>& v, int beg1, int half, int beg2){
int szL, szR;
szL = half-beg1+1;
szR = beg2-half;
//create auxiliar arrays;
int left[szL], right[szR];
for (int i = 0; i < szL; i++)
left[i] = v[beg1 + i];
for (int i = 0;... |
8888c558-5688-4730-9abd-465f31884ba9 | {
"language": "C++"
} | ```c++
```
Add a DQG cycle detection algorithm. | ```c++
#include "data.hpp"
#include "graph.hpp"
#include "dag_loop.hpp"
#include <string>
#include <vector>
// We will need two bfs operations to check that there is a path from node A to node B.
namespace graph {
namespace algorithms {
} // namespace algorithms
template <typename Graph>
bool detect_l... |
aa03f79e-665e-45ad-8ac7-84b6e5fb2e0f | {
"language": "C++"
} | ```c++
```
Check if Word Equals Summation of Two Words | ```c++
class Solution {
public:
bool isSumEqual(string firstWord, string secondWord, string targetWord) {
return (convert(firstWord) + convert(secondWord)) == convert(targetWord);
}
private:
int convert(std::string word) {
int ret = 0, index = 0;
while (index < word.size() && word[in... |
72be9f75-d58c-47bc-9bf1-a1c11cf5b82a | {
"language": "C++"
} | ```c++
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/child/file_info_util.h"
#include "base/logging.h"
#include "third_party/WebKit/public/platform/WebFileInfo.h"
namespace content... | ```c++
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/child/file_info_util.h"
#include "base/logging.h"
#include "third_party/WebKit/public/platform/WebFileInfo.h"
namespace content... |
7fb6a986-6c52-475b-8c00-2620dd9de63f | {
"language": "C++"
} | ```c++
```
Add convolutional auto encoder unit test | ```c++
//=======================================================================
// Copyright (c) 2014-2016 Baptiste Wicht
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
// http://opensource.org/licenses/MIT)
//===========================================================... |
3984c277-95db-49fc-b76d-b53ff3dcca86 | {
"language": "C++"
} | ```c++
```
Add some useful ecuations over a circle. | ```c++
//Some useful equations
int main(){
//area portion of a circle
A = pi*r^2 * (theta/(2*pi))
//area chord of a circle
A = R * R * acos((R - h)/R) - (R - h) * sqrt(2 * R * h - h * h)
// h is the height of the chord
}
``` |
83135294-82ae-4238-854f-ee5cf142c04a | {
"language": "C++"
} | ```c++
#include <osgDB/ImageOptions>
using namespace osgDB;
ImageOptions::ImageOptions()
{
init();
}
ImageOptions::ImageOptions(const std::string& str)
{
init();
_str = str;
}
void ImageOptions::init()
{
_sourceImageSamplingMode = NEAREST;
_sourceImageWindowMode = ALL_IMAGE;
_dest... | ```c++
#include <osgDB/ImageOptions>
using namespace osgDB;
ImageOptions::ImageOptions()
{
init();
}
ImageOptions::ImageOptions(const std::string& str)
{
init();
_str = str;
}
void ImageOptions::init()
{
_sourceImageSamplingMode = NEAREST;
_sourceImageWindowMode = ALL_IMAGE;
_dest... |
b7448573-2046-469c-9374-3b64cacedefe | {
"language": "C++"
} | ```c++
```
Test file for CFMM tree added. | ```c++
#include "fastlib/fastlib.h"
#include "fastlib/tree/statistic.h"
#include "general_spacetree.h"
#include "contrib/dongryel/fast_multipole_method/fmm_stat.h"
#include "subspace_stat.h"
#include "cfmm_tree.h"
#include "mlpack/kde/dataset_scaler.h"
int main(int argc, char *argv[]) {
fx_init(argc, argv, NULL);
... |
98a3b7fa-792f-43e1-a24f-1157a03a1716 | {
"language": "C++"
} | ```c++
```
Add unittests for summary requests | ```c++
#include "gtest/gtest.h"
#include <typeinfo>
#include "request_message.h"
#include "requests.pb.h"
class TypeVisitor : public traffic::RequestVisitor
{
public:
enum Type {
SUMMARY,
STATISTIC,
ERROR,
NOTSET
};
private:
Type _t;
protected:
void visit(traffic::StatisticRequest const &) { _t = STA... |
88ccff44-528f-4d2c-8474-c17c9ef31d74 | {
"language": "C++"
} | ```c++
```
Convert Sorted Array to Binary Search Tree | ```c++
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : va... |
727856d0-3b01-4101-8a78-d507fc8469be | {
"language": "C++"
} | ```c++
```
Test of rendering text as outlines | ```c++
#if defined(HAVE_CAIRO)
#include "catch.hpp"
#include <mapnik/map.hpp>
#include <mapnik/load_map.hpp>
#include <mapnik/cairo/cairo_renderer.hpp>
#include <sstream>
#include <cairo-pdf.h>
static cairo_status_t write(
void *closure,
const unsigned char *data,
unsigned int length)
{
std::ostream & ss ... |
bbfe3eb8-af2d-4a53-9885-853f631a15c7 | {
"language": "C++"
} | ```c++
```
Add serialization tests for entities. | ```c++
#include "gtest/gtest.h"
#include "src/common/entity/Block.h"
#include "src/common/entity/Bomb.h"
#include "src/common/entity/Bonus.h"
#include "src/common/entity/Character.h"
#include "src/common/entity/Fire.h"
#include "src/common/entity/Wall.h"
#include "src/common/net/Deserializer.h"
using namespace common... |
ed7defd8-652e-471b-941c-38a1e41ad368 | {
"language": "C++"
} | ```c++
```
Copy List with Random Pointer | ```c++
/**
* Definition for singly-linked list with a random pointer.
* struct RandomListNode {
* int label;
* RandomListNode *next, *random;
* RandomListNode(int x) : label(x), next(NULL), random(NULL) {}
* };
*/
class Solution {
public:
RandomListNode *copyRandomList(RandomListNode *head) {
... |
e86c9f7c-e612-4a38-b403-190eff039a43 | {
"language": "C++"
} | ```c++
```
Add Naive find over strings. | ```c++
#include <bits/stdc++.h>
using namespace std;
int main(){
string needle = "CD", haystack ="MANICD";
if(haystack.find(needle) != string::npos) cout << "Gotcha!!!";
else cout << "Not Gotcha";
cout << endl;
return 0;
}``` |
b5a30621-96ae-49c5-9868-3caa7a186953 | {
"language": "C++"
} | ```c++
```
Create unit test file for datastore api | ```c++
#include "stdafx.h"
#include "CppUnitTest.h"
using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert;
namespace You {
namespace DataStore {
namespace UnitTests {
TEST_CLASS(DataStoreApiTest) {
public:
//TEST_METHOD(TestMethod1) {
// // TODO: Your test code here
//}
};
} // namespace UnitTest... |
71f3a0e3-8e34-416e-af77-41e0d0351447 | {
"language": "C++"
} | ```c++
```
Add unit test for acc::getAccDevProps | ```c++
/* Copyright 2020 Sergei Bastrakov
*
* This file is part of alpaka.
*
* 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 <alpaka/acc/AccDevProps.... |
ec7e16a0-c82d-4c60-a4b9-0247d4db9c89 | {
"language": "C++"
} | ```c++
```
Fix build. Forgot to explictly add file while patching. BUG=none TEST=none TBR=rsleevi | ```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 "chrome/test/webdriver/commands/response.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/values.h"
na... |
4a1c7457-e2db-4190-9126-0bb6e023dc5c | {
"language": "C++"
} | ```c++
```
Add pallindromic substring algorithm to find if a substring of a string is pallindrome or not. | ```c++
#include <bits/stdc++.h>
using namespace std;
vector< vector<bool> > dp;
string s;
void preprocess() {
int n = s.size();
//single letter is always a pallindrome
for(int i = 0; i < n; ++i)
dp[i][i] = true;
//if adjacent letters are same then they are pallindrome
for(int i = 0; i < n - 1; ++i)
if(s[i... |
7fa57213-7c8b-44f8-9ff0-24794f45fbbf | {
"language": "C++"
} | ```c++
/*
* Copyright 2020 Google, LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "fuzz/Fuzz.h"
void fuzz_SVGCanvas(Fuzz* f);
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
auto fuzz = Fuzz(SkData::MakeWithou... | ```c++
/*
* Copyright 2020 Google, LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "fuzz/Fuzz.h"
#include "src/core/SkFontMgrPriv.h"
#include "tools/fonts/TestFontMgr.h"
void fuzz_SVGCanvas(Fuzz* f);
extern "C" int LLVMFuzzerTestOneInput(co... |
35c79ac2-82ce-4571-9c20-ecec5ff35fbe | {
"language": "C++"
} | ```c++
```
Test source file - initial commit. | ```c++
#include "naive_bayes.h"
#include <iostream>
int main(int argc, char* argv[])
{
NaiveBayes nb;
nb.set_training_data_file(std::string("training.dat"));
nb.add_training_data("Buy cheap viagra SPAM");
nb.add_training_data("Buy cheap airlines airlines tickets HAM");
nb.add_training_data("Dear friend I ... |
45df92ed-e632-4d41-b7a4-89dbb88a7bd8 | {
"language": "C++"
} | ```c++
```
Define the methods declared in read-and-write-data header file | ```c++
#include <read_and_write_data.h>
using namespace std;
void importData(FileReader &reader, vector<DataObject> &data) {
// Definition goes here!!
}
void exportData(FileWriter &writer, const vector<DataObject> &data) {
// Definition goes here!!
}
``` |
82834f26-b9d8-4cf1-a8ce-1003da5a8ec3 | {
"language": "C++"
} | ```c++
```
Add a C++ test. Just using C things now | ```c++
#include <rmc.h>
// Ok first make sure the regular old C ones still work
void mp_send(rmc_int *flag, rmc_int *data) {
VEDGE(wdata, wflag);
L(wdata, rmc_store(data, 42));
L(wflag, rmc_store(flag, 1));
}
int mp_recv(rmc_int *flag, int *data) {
int rf;
XEDGE(rflag, rdata);
do {
LS(... |
1c0da387-8196-4ca8-bb20-e4e15346bfa6 | {
"language": "C++"
} | ```c++
```
Add example to read tracks from binary output file | ```c++
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include "outputtrack.h"
int main(int argc, char** argv)
{
FILE* fpInput = fopen("../output.bin", "rb");
if (fpInput == NULL)
{
printf("Error opening input file\n");
exit(1);
}
//Loop over all events in the input file.
//Number of events is no... |
e652031a-886e-4d7f-b93b-7223f76a69ee | {
"language": "C++"
} | ```c++
#include "EntityManager.h"
namespace zmc
{
EntityManager::EntityManager(std::shared_ptr<ComponentManager> componentManager)
: mLastEntityID(0)
, mComponentManager(componentManager)
{
}
EntityManager::~EntityManager()
{
}
int EntityManager::getEntityCount()
{
return mEntityMap.size();
}
void Enti... | ```c++
#include "EntityManager.h"
namespace zmc
{
EntityManager::EntityManager(ComponentManager *componentManager)
: mLastEntityID(0)
, mComponentManager(componentManager)
{
}
EntityManager::~EntityManager()
{
}
int EntityManager::getEntityCount()
{
return mEntityMap.size();
}
void EntityManager::remov... |
c29e025e-6391-4fd8-9395-38f93f886b83 | {
"language": "C++"
} | ```c++
```
Add a test for Neon vector mangling | ```c++
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
typedef float float32_t;
typedef signed char poly8_t;
typedef short poly16_t;
typedef unsigned long long uint64_t;
typedef __attribute__((neon_vector_type(2))) int int32x2_t;
typedef __attribute__((neon_vector_type(4))) int int32x4_t;
typedef __attribute__((... |
d82ad176-7019-438b-a119-c9d7e4dc9e26 | {
"language": "C++"
} | ```c++
```
Add test forgotten in r181388. | ```c++
// RUN: %clang_cc1 -std=c++1y -fsyntax-only -verify %s -DMAX=1234 -fconstexpr-steps 1234
// RUN: %clang_cc1 -std=c++1y -fsyntax-only -verify %s -DMAX=10 -fconstexpr-steps 10
// RUN: %clang -std=c++1y -fsyntax-only -Xclang -verify %s -DMAX=12345 -fconstexpr-steps=12345
// This takes a total of n + 4 steps accord... |
762a1046-f0b0-4f42-b960-891918806e7e | {
"language": "C++"
} | ```c++
```
Solve problem 21 in C++ | ```c++
// Copyright 2016 Mitchell Kember. Subject to the MIT License.
// Project Euler: Problem 21
// Amicable numbers
#include "common.hpp"
#include <array>
namespace problem_21 {
long solve() {
typedef std::vector<long>::size_type sz_t;
constexpr sz_t max = 10000;
std::vector<long> sums(max);
for (sz_t i = 1... |
20764971-a0e4-4cf6-9af6-8ba022dfe4c6 | {
"language": "C++"
} | ```c++
```
Add unit tests for matrices | ```c++
// This file is distributed under the MIT license.
// See the LICENSE file for details.
#include <cassert>
#include <visionaray/math/math.h>
#include <gtest/gtest.h>
using namespace visionaray;
//-------------------------------------------------------------------------------------------------
// Helper fun... |
d7b8c78e-993b-4c9f-951d-df3f416a642b | {
"language": "C++"
} | ```c++
```
Test harness for the HtmlParser class. | ```c++
// Test harness for the HtmlParser class.
#include <iostream>
#include <cstdlib>
#include "FileUtil.h"
#include "HtmlParser.h"
#include "util.h"
void Usage() {
std::cerr << "Usage: " << ::progname << " html_filename\n";
std::exit(EXIT_FAILURE);
}
class Parser: public HtmlParser {
public:
Parser(c... |
a7102fb2-c3ee-42ae-b597-1dafb39b41a1 | {
"language": "C++"
} | ```c++
```
Add test case that exposes the out of bound errors in apply split | ```c++
#include "Halide.h"
#include "test/common/check_call_graphs.h"
#include <stdio.h>
using namespace Halide;
int main(int argc, char **argv) {
Func f("f"), input("input");
Var x("x"), y("y"), c("c");
f(x, y, c) = x + y + c;
f.reorder(c, x, y);
Var yo("yo"), yi("yi");
f.split(y, yo, yi, 2, ... |
08ca00bf-e902-4f73-a8fc-81dc7b62f7f8 | {
"language": "C++"
} | ```c++
```
Set up the bare structure of the source | ```c++
/*********************************************************************
** Author: Zach Colbert
** Date: 27 September 2017
** Description: A simple input/output program with mathematical operations. By prompting the user for three floats, the program will calculate and output a sum.
******************************... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.