doc_id stringlengths 36 36 | metadata dict | input stringlengths 28 4.3k | output stringlengths 11 5.45k |
|---|---|---|---|
aaa5265d-405b-4294-ac1c-7efa8e9c2f5a | {
"language": "C++"
} | ```c++
#include <mach/mach_time.h>
#include <string>
#include <stdio.h>
#define LAPS 10000000
std::wstring s = L"siebenhundertsiebenundsiebzigtausendsiebenhundertsiebenundsiebzig";
int
main(void) {
uint64_t count = 0;
uint64_t start = mach_absolute_time();
for (auto i = 0; i < LAPS; i++) {
for (auto c : s)... | ```c++
#include <mach/mach_time.h>
#include <string>
#include <stdio.h>
#define LAPS 10000000
std::wstring s = L"siebenhundertsiebenundsiebzigtausendsiebenhundertsiebenundsiebzig";
int
main(void) {
uint64_t count = 0;
uint64_t start = mach_absolute_time();
for (auto i = 0; i < LAPS; i++) {
for (auto c : s)... |
e055c2c7-39eb-4dd7-8fba-760a2144c120 | {
"language": "C++"
} | ```c++
```
Remove duplicate elements of an array. | ```c++
/**
* Remove Duplicates from Sorted Array
*
* cpselvis (cpselvis@gmail.com)
* August 23th, 2016
*/
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int prev, len = 0;
for (int i = 0; i < nums.size(); ) {
if (nums[... |
3c38e84e-8580-4a18-88d6-d0efe24bd715 | {
"language": "C++"
} | ```c++
```
Add solution to the dynamic array problem | ```c++
#include <iostream>
using namespace std;
class DynamicArray {
int* elements;
int size;
int capacity;
void resize() {
// increase capacity
capacity *= 2;
// allocate new memory
int* newElements = new int[capacity];
// copy old array
for (int i = 0; i < size; ++i) {
newEl... |
30fcd6f4-eb41-4e70-8ac9-06994dedf25f | {
"language": "C++"
} | ```c++
```
Test application to read in an .ics file and export it to .vcs. | ```c++
/*
This file is part of libkcal.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License... |
1aaa15b9-b5f2-4501-be45-09b3b3d5a2fc | {
"language": "C++"
} | ```c++
#include "greentea-client/greentea_serial.h"
SingletonPtr<GreenteaSerial> greentea_serial;
GreenteaSerial::GreenteaSerial() : mbed::RawSerial(USBTX, USBRX) {};
```
Make GreenTea respect STDIO baud rate | ```c++
#include "greentea-client/greentea_serial.h"
SingletonPtr<GreenteaSerial> greentea_serial;
GreenteaSerial::GreenteaSerial() : mbed::RawSerial(USBTX, USBRX, MBED_CONF_PLATFORM_STDIO_BAUD_RATE) {};
``` |
42e538cb-757a-498f-870e-c7e81f9e40d8 | {
"language": "C++"
} | ```c++
```
Add Chapter 25, exercise 3 | ```c++
// Chapter 25, exercise 3: initialize a 32-bit signed int with the bit patterns
// and print the result:
// - all zeros
// - all ones
// - alternating ones and zeros (starting with leftmost one)
// - alternating zeros and ones (starting with leftomst zero)
// - 110011001100...
// - 001100110011...
// - all-one b... |
1e0efc03-9daa-4bab-af78-ee49d3836f0a | {
"language": "C++"
} | ```c++
```
Add first test for LabelCollisionForce. | ```c++
#include "../test.h"
#include "../../src/forces/label_collision_force.h"
#include "../../src/forces/label_state.h"
namespace Forces
{
TEST(Test_LabelCollisionForce, NoForceIfLabelsDontCollide)
{
LabelCollisionForce force;
Eigen::Vector2f size(0.1f, 0.1f);
LabelState label(1, "Tested label", Eigen::Vecto... |
c5032d11-066e-4b1e-bdde-6d203664f183 | {
"language": "C++"
} | ```c++
```
Add a new SkMemory implementation that uses mozalloc instead of malloc | ```c++
/*
* Copyright 2011 Google Inc.
* Copyright 2012 Mozilla Foundation
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkTypes.h"
#include "mozilla/mozalloc.h"
#include "mozilla/mozalloc_abort.h"
#include "mozilla/mozalloc_oom.h"
void sk_... |
370fe3ea-9ddd-4696-a658-c285ff9e88e7 | {
"language": "C++"
} | ```c++
```
Add tests for `class contents` | ```c++
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
#include "contents.hh"
#include "catch.hpp"
using namespace vick;
TEST_CASE("contents construction coordinates", "[contents]") {
#define TESTS \
... |
8ce27dfb-f3c4-40a2-b516-d998f14498f9 | {
"language": "C++"
} | ```c++
```
Test various varint encoding/decoding cases with failure modes. | ```c++
#include <test.hpp>
TEST_CASE("varint") {
std::string buffer;
mapbox::util::pbf_writer pw(buffer);
SECTION("encode/decode int32") {
pw.add_int32(1, 17);
mapbox::util::pbf item(buffer.data(), buffer.size());
REQUIRE(item.next());
REQUIRE(17 == item.get_int32());
... |
19bfaaa7-66db-43c0-a1a2-b34e6232cde9 | {
"language": "C++"
} | ```c++
```
Add unit test for option parsing | ```c++
#include "option_types.hh"
#include "unit_tests.hh"
namespace Kakoune
{
UnitTest test_option_parsing{[]{
auto check = [](auto&& value, StringView str)
{
auto repr = option_to_string(value);
kak_assert(repr == str);
std::decay_t<decltype(value)> parsed;
option_from_string... |
d349b664-3674-47ce-87bc-c98e6ff93a6d | {
"language": "C++"
} | ```c++
```
Add wshop form 05 Oct 2015 | ```c++
#include <cstdlib>
#include <iostream>
#include <cmath>
using namespace std;
void pow2(int& x) {
x = pow(x, 2);
}
int pow3(int x) {
return pow(x, 3);
}
int main() {
int x, y;
cin >> x >> y;
pow2(x);
y = pow3(y);
cout << x << " " << y << endl;
return 0;
}
``` |
0ab1a066-6e66-4988-99ec-7f86bd6b71b0 | {
"language": "C++"
} | ```c++
```
Add an example benchmark for methods in `engine_util_spatial`. | ```c++
// Copyright 2021 DeepMind Technologies Limited
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... |
b23f3bee-6e19-46d6-9a70-71432cb0c1f0 | {
"language": "C++"
} | ```c++
```
Add some short metaprogramming examples | ```c++
#include <utility>
template <std::size_t I, typename T> struct holder { T t; };
template <typename Sequence, typename... Ts> struct tuple_impl;
template <std::size_t... I, typename... Ts>
struct tuple_impl<std::index_sequence<I...>, Ts...> : holder<I, Ts>... {};
template <typename... Ts>
using tuple = tuple_... |
680d5306-1b60-47f5-8b09-9f7d08e8e707 | {
"language": "C++"
} | ```c++
```
Add test case for PR5290; this bug was fixed with the non-class rvalue de-cv-qualification fixes. | ```c++
// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
// PR5290
int const f0();
void f0_test() {
decltype(0, f0()) i = 0; // expected-warning{{expression result unused}}
i = 0;
}
struct A { int a[1]; A() { } };
typedef A const AC;
int &f1(int*);
float &f2(int const*);
void test_f2() {
float &fr = f2(AC... |
63d3009f-ad0c-405d-b888-08394b8e727f | {
"language": "C++"
} | ```c++
```
Fix handling of multiplication by a constant with a number of trailing zeroes. | ```c++
// RUN: %clangxx_msan -m64 -O2 %s -o %t && %run %t
#include <sanitizer/msan_interface.h>
struct S {
S(int a0) : a(a0) {}
int a;
int b;
};
// Here S is passed to FooRun as a 64-bit integer.
// This triggers an optimization where 10000 * s.a is transformed into
// ((*(uint64_t *)&s) * (10000 * 2**32)) >> ... |
9bab38bf-579e-4e45-9ced-ec618cab1cb6 | {
"language": "C++"
} | ```c++
```
Add a test of searching in order | ```c++
#include <stdio.h>
#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string.h>
/*
1000 in 9 seconds
so each one takes ~0.01s - fine
10x faster than haskell
*/
std::string readFile(const char* file)
{
std::ifstream f;
std::stringstream ss;
f.open(fil... |
4e80cc62-7b64-4e9e-8176-846cf6722632 | {
"language": "C++"
} | ```c++
```
Add Chapter 25, exercise 9 | ```c++
// Chapter 25, exercise 9: without using standard headers such as <limits>,
// compute the number of bits in an int and determine wether char is signed or
// unsigned
#include<iostream>
using namespace std;
int main()
{
int n = 0;
int i = 1;
while (true) {
cout << "1 at bit " << n << ": " ... |
3d5f2322-ad05-4c4c-9446-be5a963eb518 | {
"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 "chrome/browser/extensions/extension_apitest.h"
#include "net/dns/mock_host_resolver.h"
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Wallpape... | ```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 "chrome/browser/extensions/extension_apitest.h"
#include "net/dns/mock_host_resolver.h"
// Disabled due to flakiness. See http://crbug.co... |
258a9ba3-9509-4bdd-bc6d-a0043ad6f497 | {
"language": "C++"
} | ```c++
```
Add a test case for r208215 [stack buffer overflow in <iostream>] | ```c++
// RUN: %clang_cl_asan -O0 %s -Fe%t
// RUN: echo "42" | %run %t 2>&1 | FileCheck %s
#include <iostream>
int main() {
int i;
std::cout << "Type i: ";
std::cin >> i;
return 0;
// CHECK: Type i:
// CHECK-NOT: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
}
``` |
8af02d9e-2cc2-4015-a537-36c204f9b4ed | {
"language": "C++"
} | ```c++
```
Add bfs source code in c++ | ```c++
#include <bits/stdc++.h>
using namespace std;
vector<int> G[MAX];
/* this visited array should be initialized with false
eg.: memset(visited, false, sizeof visited) */
bool visited[MAX];
void BFS(int first) {
queue<int>Q;
Q.push(first);
while (!Q.empty()) {
int act = Q.front();
... |
b3dec712-9c70-49be-b47b-9d29d8ba64a6 | {
"language": "C++"
} | ```c++
```
Add test case for DBN | ```c++
#include "catch.hpp"
#include "dll/rbm.hpp"
#include "dll/dbn.hpp"
#include "dll/vector.hpp"
#include "dll/labels.hpp"
#include "dll/test.hpp"
#include "mnist/mnist_reader.hpp"
#include "mnist/mnist_utils.hpp"
TEST_CASE( "dbn/mnist_1", "rbm::simple" ) {
typedef dll::dbn<
dll::layer<28 * 28, 100, d... |
f00def51-3063-490f-a2ff-970749ddddc4 | {
"language": "C++"
} | ```c++
```
Test handling of TRY_CATCH_EXPRs for which the handler is a sequence of ordinary statements, rather than a list of CATCH_EXPRs or an EH_FILTER_EXPR. | ```c++
// RUN: %llvmgxx -S %s -o /dev/null
#include <locale>
namespace std
{
codecvt<char, char, mbstate_t>::
codecvt(size_t __refs)
: __codecvt_abstract_base<char, char, mbstate_t>(__refs),
_M_c_locale_codecvt(_S_get_c_locale())
{ }
}
``` |
7d509e65-7476-427c-90c0-4fc19f5ecf77 | {
"language": "C++"
} | ```c++
```
Test that we emit a subrange type for vlas. | ```c++
// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
// CHECK: DW_TAG_subrange_type
struct StructName {
int member[];
};
struct StructName SN;
``` |
db0c0acc-6c98-4932-a961-203389a746af | {
"language": "C++"
} | ```c++
```
Add a template test that requires canonical expression comparison | ```c++
// RUN: clang-cc -fsyntax-only -verify %s
// XFAIL
template<int N, int M>
struct A0 {
void g0();
};
template<int X, int Y> void f0(A0<X, Y>) { } // expected-note{{previous}}
template<int N, int M> void f0(A0<M, N>) { }
template<int V1, int V2> void f0(A0<V1, V2>) { } // expected-error{{redefinition}}
templa... |
4e6aea03-0d64-4c38-8611-e940ac7d3808 | {
"language": "C++"
} | ```c++
#include "backtrace_formatter.h"
#include <iostream>
namespace lms {
namespace extra {
void BacktraceFormatter::print(){
std::cerr << "BacktraceFormatter::print not implemented on Win32" << std::endl;
}
} // namespace extra
} // namespace lms
```
Implement BacktraceFormatter for Win32 (NOT tested) | ```c++
#include "lms/extra/backtrace_formatter.h"
#include <iostream>
#include <Windows.h>
namespace lms {
namespace extra {
void printStacktrace() {
// http://stackoverflow.com/questions/5693192/win32-backtrace-from-c-code
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb204633(v=vs.85).aspx
... |
dd1129a9-5d93-4934-926b-f9870ff072f6 | {
"language": "C++"
} | ```c++
```
Determine Whether Matrix Can Be Obtained By Rotation | ```c++
class Solution {
public:
bool findRotation(vector<vector<int>>& mat, vector<vector<int>>& target) {
if (check(mat, target))
return true;
rotate(mat);
if (check(mat, target))
return true;
rotate(mat);
if (check(mat, target))
r... |
2741975a-7beb-422f-ae22-c8fadfe42db6 | {
"language": "C++"
} | ```c++
```
Add solution for chapter 17 test 1, test 2 | ```c++
#include <iostream>
#include <tuple>
#include <vector>
#include <utility>
using namespace std;
int main() {
//test 17.1
auto ituple = make_tuple(10, 20, 30);
size_t sz = tuple_size<decltype(ituple)>::value;
cout << sz << endl;
// for(size_t i = 0; i != sz; ++ i) {
// ... |
9d28b6c7-3f68-4a0c-a9be-3e3dd29e3ffc | {
"language": "C++"
} | ```c++
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"
class Windo... | ```c++
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"
class Windo... |
78b37638-6764-4e60-b58f-f897489000ba | {
"language": "C++"
} | ```c++
```
Add Solution for 009 Palindrome Number | ```c++
// 9. Palindrome Number
/**
* Determine whether an integer is a palindrome. Do this without extra space.
*
* Some hints:
* Could negative integers be palindromes? (ie, -1)
*
* If you are thinking of converting the integer to string, note the restriction of using extra space.
*
* You could also try rev... |
2fe979ae-3e91-4f4e-80b5-b3bd604a1358 | {
"language": "C++"
} | ```c++
```
Add library (Union find tree) | ```c++
// Verified: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_1_A
struct union_find {
vector<int> par;
vector<int> rank;
union_find (int n) : par(n), rank(n, 0) {
REP(i,n)par[i]=i;
}
int find (int x) {
if (par[x] == x)
return x;
else
return par[x] = find(par[x]);
... |
7af81f92-29a6-4834-b9ce-bc23335192be | {
"language": "C++"
} | ```c++
```
Add indicator platform to icarus. | ```c++
#include "variant/indicator_platform.hpp"
#include <hal.h>
IndicatorPlatform::IndicatorPlatform() {
}
void IndicatorPlatform::set(IndicatorIntent intent, bool value) {
switch(intent) {
case HEARTBEAT:
//palWritePad(GPIOE, GPIOE_LED3_RED, value);
break;
case VEHICLE_ARMED:
//palWrit... |
028fdc25-dec7-4440-a230-9940494c69be | {
"language": "C++"
} | ```c++
```
Add a simple halide file that starts from the low level IR and generates an object file | ```c++
#include <stdio.h>
#include "Halide.h"
#include <iostream>
#include <string>
#define SIZE 10
void generate_function(std::string f_name, int size, int pos, int val)
{
std::string buff_name = "myOutBuff";
halide_dimension_t *shape = new halide_dimension_t[1];
shape[0].min = 0;
shape[0].... |
ee53f0cb-0529-4e08-b7c0-bf9e95af057d | {
"language": "C++"
} | ```c++
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/renderer/gpu/delegated_compositor_output_surface.h"
namespace content {
DelegatedCompositorOutputSurface::DelegatedCompositorOu... | ```c++
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/renderer/gpu/delegated_compositor_output_surface.h"
namespace content {
DelegatedCompositorOutputSurface::DelegatedCompositorOu... |
626d688e-5df5-4a79-b6c1-40ac75b7e904 | {
"language": "C++"
} | ```c++
```
Add solution for chapter 16 test 63 64 | ```c++
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
//solution for test 16.63 16.64
template <typename T>
typename vector<T>::size_type countTimes(const vector<T> &vec, const T &target) {
typename vector<T>::size_type time = 0;
for(auto elem : ve... |
ccea1acb-e44b-4909-9b65-e530ed131408 | {
"language": "C++"
} | ```c++
```
Add useful function to know if a number is even or odd. | ```c++
#include <iostream>
#define isOdd(x) (x & 0x01)
using namespace std;
int main (){
int a =57;
int b= 32;
cout << isOdd(a) << endl;
cout << isOdd(b) << endl;
return 0;
}
``` |
1e6d0c32-c5b2-4540-9c8b-57c28987a9f2 | {
"language": "C++"
} | ```c++
```
Add empty board::lowLevelInitialization() for NUCLEO-F103RB | ```c++
/**
* \file
* \brief board::lowLevelInitialization() implementation for NUCLEO-F103RB
*
* \author Copyright (C) 2016 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 t... |
9b52335b-c812-42e9-bf37-faee2adbeca5 | {
"language": "C++"
} | ```c++
```
Add solution for chapter 16 test 49. | ```c++
#include <iostream>
using namespace std;
template <typename T>
void f(T t) {
cout << "f(T)" << endl;
}
template <typename T>
void f(const T* t) {
cout << "f(const T*)" << endl;
}
template <typename T>
void g(T t) {
cout << "g(T)" << endl;
}
template <typename T>
void g(T* t) ... |
78d976d5-1bf8-4d96-976d-1be59095af3c | {
"language": "C++"
} | ```c++
```
Add some tests for ChunkedVector | ```c++
#include "chunked-vector.hh"
#include <gtest/gtest.h>
namespace nix {
TEST(ChunkedVector, InitEmpty) {
auto v = ChunkedVector<int, 2>(100);
ASSERT_EQ(v.size(), 0);
}
TEST(ChunkedVector, GrowsCorrectly) {
auto v = ChunkedVector<int, 2>(100);
for (auto i = 1; i < 20; ... |
cb330025-6103-4e35-80b0-f12dd4b54f89 | {
"language": "C++"
} | ```c++
```
Add Tarjan for SCC + binconnected components. Needs further testing. | ```c++
// TODO: retest this code. It was tested once, but had to be pushed for backup purposes.
// DO TEST IT BEFORE PROPER USE.
// Tarjan for SCC and Edge Biconnected Componentes - O(n + m)
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
vector<int> adj[N], st;
int num[N], low[N], vis[N], cnt, sc... |
a0bb3613-bfe7-4a7e-9367-cd9f54295007 | {
"language": "C++"
} | ```c++
```
Add simple algorithm over c++ to get the permutations. | ```c++
#include <stdio.h>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;
typedef vector <int > vi;
inline void show(vi &data, int &size){
for (int i=0; i<size; i++)
printf("%d \t", data[i]);
printf("\n");
}
inline void permutation(vi data, int size){
sort(... |
0286fb6e-d3fc-42a3-b024-da8181caaa29 | {
"language": "C++"
} | ```c++
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All co... | ```c++
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All co... |
f1f5fa22-48ec-42b0-9d62-825b422ca21d | {
"language": "C++"
} | ```c++
```
Add Solution for 016 3Sum Closest | ```c++
// 16. 3Sum Closest
/**
* Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
*
* For example, given array S = {-1 2 1 -4}, and target = 1.
*... |
a220f880-be19-4b12-8dfe-8ef845b63d95 | {
"language": "C++"
} | ```c++
```
Move debug info tests for scoped enums into a separate file. | ```c++
// RUN: %clang_cc1 -std=c++11 -emit-llvm -g -o - %s | FileCheck %s
// Test that we are emitting debug info and base types for scoped enums.
// CHECK: [ DW_TAG_enumeration_type ] [Color] {{.*}} [from int]
enum class Color { gray };
void f(Color);
void g() {
f(Color::gray);
}
// CHECK: [ DW_TAG_enumeration_ty... |
40993b21-25cf-47dc-af39-270b5c9f73b8 | {
"language": "C++"
} | ```c++
```
Add the forgotten file. splice is only a stub. | ```c++
////////////////////////////////////////////////////////////////////////////////
/// @brief fundamental types for the optimisation and execution of AQL
///
/// @file arangod/Aql/Types.cpp
///
/// DISCLAIMER
///
/// Copyright 2010-2014 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Ver... |
74d450b8-c283-4e2f-9ade-9a04414a4d57 | {
"language": "C++"
} | ```c++
```
Delete Doubly Linked List Node. | ```c++
#include <stdio.h>
#include <stdlib.h>
typedef struct _NODE {
int data;
_NODE* next;
_NODE* prev;
} NODE;
void push(NODE** head_ref, int data) {
NODE* node = new NODE();
node->data = data;
node->next = *head_ref;
node->prev = NULL;
if (*head_ref != nullptr) {
(*head_ref)->prev = node;
}
... |
c7e6c7b7-c82f-4c23-b536-52b99f85293e | {
"language": "C++"
} | ```c++
```
Remove Duplicates from Sorted List II | ```c++
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
if(NULL == head || NULL == head->next) return head;
ListNode *pr... |
38333e8f-7bed-4ea6-9e74-15192a6fec6b | {
"language": "C++"
} | ```c++
```
Test for llvm-gcc checkin 89898. | ```c++
// RUN: %llvmgxx %s -S -o - | FileCheck %s
// Make sure pointers are passed as pointers, not converted to int.
// The first load should be of type i8** in either 32 or 64 bit mode.
// This formerly happened on x86-64, 7375899.
class StringRef {
public:
const char *Data;
long Len;
};
void foo(StringRef X);
v... |
1f076675-3e8f-48a9-9bff-0696142bb784 | {
"language": "C++"
} | ```c++
```
Add simple led tutorial code | ```c++
#include <gpio.h> // gpio pin controllling
int main()
{
// defines the variable ledPin and refers it to an GPIO-Pin
auto ledPin = gpio::output_pin(15);
// loop 10 times
for (int i = 0; i < 10; i++) {
// pin is set true, pin is HIGH, LED is on
ledPin.set_state(true);
// p... |
ac821cb1-57ce-4a23-bb12-b0375761a2fc | {
"language": "C++"
} | ```c++
```
Add solution for chapter 17 test 24 | ```c++
#include <iostream>
#include <string>
#include <regex>
using namespace std;
int main() {
string phone = "(\\()?(\\d{3})(\\))?([-. ])?(\\d{3})([-. ])?(\\d{4})";
regex r(phone);
string s;
string fmt = "$2.$5.$7";
while(getline(cin, s)) {
cout << regex_replace(s, r, fmt) <<... |
99c5a9eb-50ee-4e8d-813e-31acc338ea0b | {
"language": "C++"
} | ```c++
//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// debug.cpp: Debugging utilities.
#include "common/debug.h"
#include <stdio.h>
#include <stdarg.h>
namespace gl
{
void trac... | ```c++
//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// debug.cpp: Debugging utilities.
#include "common/debug.h"
#include <stdio.h>
#include <stdarg.h>
static bool trace_on = t... |
3a268144-21a6-49b5-8aaa-3a4c23a1ca36 | {
"language": "C++"
} | ```c++
```
Add Solution for 371 Sum of Two Integers | ```c++
// 371. Sum of Two Integers
/**
* Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.
*
* Example:
* Given a = 1 and b = 2, return 3.
*
* Tags: Bit Manipulation
*
* Similar Problems: (M) Add Two Numbers
*
* Author: Kuang Qin
*/
#include <iostream>
usi... |
3ad39c00-7db0-4003-aa8f-52316f72f9d6 | {
"language": "C++"
} | ```c++
```
Add algorithm for computing the center of a circle based on three points. | ```c++
#include <bits/stdc++.h>
using namespace std;
// Constants
const double PI = acos(-1);
struct point {
double x;
double y;
point (){}
point (double _x, double _y){
x = _x;
y = _y;
}
};
inline point get_center(point A, point B, point C){
float yDelta_a = B.y - A.y;
fl... |
06a17823-dad0-46fb-86da-1a16966b4642 | {
"language": "C++"
} | ```c++
```
Prepare exercise 4 from chapter 8. | ```c++
// 8.exercise.04.cpp
//
// An int can hold integers only up to a maximum number. Find an approximation
// of that maximum number by using fibonacci().
//
// COMMENTS
#include "std_lib_facilities.h"
void print(const string& label, const vector<int>& data)
// Only read arguments, so it safe to pass them by co... |
589ea6f5-91f7-4fff-86bc-7e80f7cbd529 | {
"language": "C++"
} | ```c++
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/download/download_completion_blocker.h"
#include "base/logging.h"
DownloadCompletionBlocker::DownloadCompletionBlock... | ```c++
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/download/download_completion_blocker.h"
#include "base/logging.h"
DownloadCompletionBlocker::DownloadCompletionBlock... |
523f0fa6-976f-48be-affe-777d4bf450c2 | {
"language": "C++"
} | ```c++
```
Add a test showing that nodebug is accepted in methods too. Patch by Paul Robinson. | ```c++
// RUN: %clang_cc1 %s -verify -fsyntax-only
// Note: most of the 'nodebug' tests are in attr-nodebug.c.
// expected-no-diagnostics
class c {
void t3() __attribute__((nodebug));
};
``` |
854755c0-7a9a-4f59-9f65-9bc7112bf4d8 | {
"language": "C++"
} | ```c++
```
Package Datagram Class Behaviour defined | ```c++
#include "PackageDatagram.h"
// Constructors
PackageDatagram::PackageDatagram(char* data, unsigned int length, char* ip, int port)
{
this->data = new char[length];
memcpy(this->data, data, length);
this->length = length;
memcpy(this->ip, ip, sizeof this->ip);
this->port = port;
}
PackageDatagram::Packa... |
f420ba6a-b869-473b-8849-2a2d919d0875 | {
"language": "C++"
} | ```c++
```
Patch for r148243 which was left behind. | ```c++
// RUN: %clang_cc1 %s -emit-llvm-only
// CHECK that we don't crash.
int main(void){
int x = 12;
// Make sure we don't crash when constant folding the case 4
// statement due to the case 5 statement contained in the do loop
switch (4) {
case 4: do { case 5: x++;} while (x < 100);
}
return x;
}
``` |
f7da158b-8248-4f19-8656-36530ddc268c | {
"language": "C++"
} | ```c++
// Copyright (c) 2013 Stanislas Polu.
// Copyright (c) 2012 The Chromium Authors.
// See the LICENSE file.
#include "exo/exo_browser/common/switches.h"
namespace switches {
// Makes ExoBrowser use the given path for its data directory.
const char kExoBrowserDataPath[] = "data-path";
// Prevents the launch of ... | ```c++
// Copyright (c) 2013 Stanislas Polu.
// Copyright (c) 2012 The Chromium Authors.
// See the LICENSE file.
#include "exo/exo_browser/common/switches.h"
namespace switches {
// Makes ExoBrowser use the given path for its data directory.
const char kExoBrowserDataPath[] = "data-path";
// Prevents the launch of ... |
3a59d22f-68de-4fc2-82e3-29da7a237938 | {
"language": "C++"
} | ```c++
```
Test explicit specialization involving multiple template<> headers | ```c++
// RUN: clang-cc -fsyntax-only -verify %s
template<class T1>
class A {
template<class T2> class B {
void mf();
};
};
template<> template<> class A<int>::B<double>;
template<> template<> void A<char>::B<char>::mf();
template<> void A<char>::B<int>::mf(); // expected-error{{requires 'template<>'}}
``` |
cf5e256a-5995-4566-9347-9645c5360ad4 | {
"language": "C++"
} | ```c++
```
Print Users' Database. For testing. | ```c++
#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
#include <string>
static int callback(void *data, int argc, char **argv, char **azColName){
int i;
fprintf(stderr, "%s: ", (const char*)data);
for(i=0; i<argc; i++){
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
printf... |
aee93bd9-8c3e-4f9f-b8dc-7e9097765425 | {
"language": "C++"
} | ```c++
```
Add Chapter 25, Try This 5 | ```c++
// Chapter 25, Try This 5: int, char, unsigned char and signed char example
// using si = 128
#include<iostream>
using namespace std;
template<class T> void print(T i) { cout << i << '\t'; }
void print(char i) { cout << int(i) << '\t'; }
void print(signed char i) { cout << int(i) << '\t'; }
void print(unsi... |
00f11072-4751-41fa-8cd0-a7f6b76fb2f2 | {
"language": "C++"
} | ```c++
```
Add host info (add new files). | ```c++
//===--- HostInfo.cpp - Host specific information -----------------------*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===------------------------------------------------... |
507f9e65-7595-4406-adee-5cb8e745b7b0 | {
"language": "C++"
} | ```c++
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/drive/drive_system_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_b... | ```c++
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/drive/drive_system_service.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profil... |
08e41142-dd00-49ce-a117-49a89bf918bd | {
"language": "C++"
} | ```c++
```
Add 104 Maximum Depth of Binary Tree | ```c++
// 104 Maximum Depth of Binary Tree
/**
* Given a binary tree, find its maximum depth.
*
* The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
*
* Author: Yanbin Lu
*/
#include <stddef.h>
#include <vector>
#include <string.h>
#include <stdio.h>
#inc... |
02a7c7a3-4d8a-4739-9fe9-7a0af46912ca | {
"language": "C++"
} | ```c++
```
Add missing test case for r332639 | ```c++
// RUN: %clang_cc1 -o /dev/null -emit-llvm -std=c++17 -triple x86_64-pc-windows-msvc %s
struct Foo {
virtual void f();
virtual void g();
};
void Foo::f() {}
void Foo::g() {}
template <void (Foo::*)()>
void h() {}
void x() {
h<&Foo::f>();
h<&Foo::g>();
}
``` |
d17f6674-f908-4ec0-a46f-85802ea407db | {
"language": "C++"
} | ```c++
```
Add solution for chapter 17 test 22 | ```c++
#include <iostream>
#include <string>
#include <regex>
using namespace std;
bool valid(const smatch &m) {
if(m[1].matched) {
return m[3].matched && m[4].matched == 0;
} else {
return m[3].matched == 0 && m[4].str() == m[7].str();
}
}
int main() {
string phone = "... |
3dfbe024-5742-4f00-9558-c33201416e03 | {
"language": "C++"
} | ```c++
/**
* @file version.cpp
* @author Ryan Curtin
*
* The implementation of GetVersion().
*/
#include "version.hpp"
#include <sstream>
// If we are not a git revision, just use the macros to assemble the version
// name.
std::string mlpack::util::GetVersion()
{
#ifndef __MLPACK_SUBVERSION
std::stringstream ... | ```c++
/**
* @file version.cpp
* @author Ryan Curtin
*
* The implementation of GetVersion().
*/
#include "version.hpp"
#include <sstream>
// If we are not a git revision, just use the macros to assemble the version
// name.
std::string mlpack::util::GetVersion()
{
#ifndef __MLPACK_GIT_VERSION
std::stringstream... |
70112fd7-b191-486b-8ad0-99da6c6b1164 | {
"language": "C++"
} | ```c++
```
Test case for anonymous unions in C++ | ```c++
// RUN: clang -fsyntax-only -verify %s
struct X {
union {
float f3;
double d2;
} named;
union {
int i;
float f;
union {
float f2;
mutable double d;
};
};
void test_unqual_references();
struct {
int a;
float b;
};
void test_unqual_references_con... |
1384cb92-8b48-4120-ae56-7694eda58a0e | {
"language": "C++"
} | ```c++
```
Add set of tests for SerialiseList | ```c++
/*
* Copyright (C) 2016 deipi.com LLC and contributors. All rights reserved.
*
* 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 Software without restriction, including without limitation th... |
e1b5d539-b29b-42d7-845f-5ff3e0a63e57 | {
"language": "C++"
} | ```c++
```
Add beautiful implementation binary search. | ```c++
#include <bits/stdc++.h>
using namespace std;
const int TAM = 5;
int arr[TAM];
/* Recursive
* l -> left
* r -> right
* x -> element to search
*/
int binary_search(int l, int r, int x){
if (r >= l){
int mid = l + (r - l)/2;
// The element in the middle
if (arr[mid] == x) ret... |
64001b80-a8c2-400b-a8a8-7cd5177d8e39 | {
"language": "C++"
} | ```c++
```
Add a symbolizer testcase for closed stdin/stdout | ```c++
// Check that when the program closed its std(in|out|err), running the external
// symbolizer still works.
// RUN: rm -f %t.log.*
// RUN: %clangxx_asan -O0 %s -o %t 2>&1 && ASAN_OPTIONS=log_path=%t.log:verbosity=2 not %run %t 2>&1
// RUN: FileCheck %s --check-prefix=CHECK-FILE < %t.log.*
#include <assert.h>
#i... |
a1fa82a7-598a-4d67-93a8-a1455de33bfe | {
"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... |
20591c0f-d614-4cae-a6f8-37f595b6376c | {
"language": "C++"
} | ```c++
```
Check that leak sanitizer works in the forked process | ```c++
// Test that leaks detected after forking without exec().
// RUN: %clangxx_lsan %s -o %t && not %run %t 2>&1 | FileCheck %s
#include <assert.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
int main() {
pid_t pid = fork();
assert(pid >= 0);
if (pid > 0) {
int status = 0;
waitpid(p... |
3a2ec45a-c4ad-479b-87ff-3502bf4e094b | {
"language": "C++"
} | ```c++
```
Split Linked List in Parts | ```c++
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
vector<ListNode*> splitListToParts(ListNode* root, int k) {
int d=depth(root);
vector<int> ls;
while(... |
9a2b9673-be44-41b2-8970-f403b756b5a6 | {
"language": "C++"
} | ```c++
```
Add useful algorithm to find all possible substrings of size k of a set of characters. | ```c++
#include<bits/stdc++.h>
#define debug(x) cout << #x << " = "<< x << endl
#define pb push_back
/*
Algorithm to find all possible substrings of size k given a set of values
*/
using namespace std;
set<string> subs;
//print all possible substrings of size k
void substringSizek(char set[], string prefix, int n, in... |
d74e1371-e731-4687-a98f-ab5258dbe7f9 | {
"language": "C++"
} | ```c++
```
Remove chars in s2 from s1 | ```c++
// remove chars in s1 which are present in the s2
#include <iostream>
#include <string>
using namespace std;
void removeChars(string &s1, string &s2) {
int map[256] = {0};
int s2_len = s2.length();
for (int i = 0; i < s2_len; i++) {
map[s2[i]] = 1;
}
int s1_len = s1.length();
string result;
for (int i ... |
051439e0-6c74-4efe-bead-e5cc0ade5233 | {
"language": "C++"
} | ```c++
//===- RustWrapper.cpp - Rust wrapper for core functions --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===------------------------------------------------... | ```c++
//===- RustWrapper.cpp - Rust wrapper for core functions --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===------------------------------------------------... |
03ed725b-b2ca-44f4-8d37-93502d434fa8 | {
"language": "C++"
} | ```c++
```
Add unit tests for point. | ```c++
/*
* Unit tests for the Point3 class.
* Author: Dino Wernli
*/
#include <gtest/gtest.h>
#include "util/point3.h"
TEST(Point3, Distance) {
Point3 p(1, 2, 3);
EXPECT_DOUBLE_EQ(0, Point3::Distance(p, p));
Point3 q(1, 2, 4);
EXPECT_DOUBLE_EQ(1, Point3::Distance(p, q));
Point3 r(1, 2, 1);
EXPECT_D... |
39bec0d3-f2b5-4c23-ae73-baaa8991614a | {
"language": "C++"
} | ```c++
```
Add a solution of prob 4 | ```c++
#include <stdio.h>
int get_gcd(const int num1, const int num2)
{
/* Euclidean algorithm */
/* Base case */
if(num1 < num2) return get_gcd(num2, num1); /* Swap two numbers; num2 should be less than num1 */
if(num1 % num2 == 0) return num2; /* num2 is GCD */
/* Recursive case */
return ge... |
53308662-b6f4-41a9-939b-7080bdf22f96 | {
"language": "C++"
} | ```c++
```
Add a C++ linkage example. | ```c++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 https://mozilla.org/MPL/2.0/. */
#include <cassert>
#includ... |
4a0dbc22-6aed-443f-9e33-aa9b512106f6 | {
"language": "C++"
} | ```c++
```
Add specific header to help find boost location. | ```c++
/*
* Copyright (C) 2009, Gostai S.A.S.
*
* This software is provided "as is" without warranty of any kind,
* either expressed or implied, including but not limited to the
* implied warranties of fitness for a particular purpose.
*
* See the LICENSE file for more information.
*/
// This file is used by t... |
2dd149a2-e03d-48fb-934d-d8af8f886b87 | {
"language": "C++"
} | ```c++
```
Print 2-D matrix in clockwise spiral order. | ```c++
/*
* Written by Nitin Kumar Maharana
* nitin.maharana@gmail.com
*/
//Print 2-D matrix in clockwise spiral order.
#include <iostream>
#include <vector>
using namespace std;
void printSpiral(vector<vector<int>>& input)
{
int top, bottom, left, right, direction;
top = left = 0;
bottom = input.size()-1;
... |
5fdcb290-d0fb-49af-a399-a4620f726c46 | {
"language": "C++"
} | ```c++
```
Test for interaction between explicit instantiations and specializations | ```c++
// RUN: clang-cc -fsyntax-only -verify %s
template<typename T>
struct X0 {
struct MemberClass {
T member; // expected-error{{with function type}}
};
T* f0(T* ptr) {
return ptr + 1; // expected-error{{pointer to function}}
}
static T* static_member;
};
template<typename T>
T* X0<T>::st... |
94cd9dde-b026-499f-babf-da7b21d007c3 | {
"language": "C++"
} | ```c++
```
Add test for enum definition macro | ```c++
#include <mart-common/enum/EnumDefinitionMacro.h>
MART_UTILS_DEFINE_ENUM( Airplains, int, 5, F114, A380, F22, Eurofighter, Cessna );
``` |
ad08869a-0bf2-44cd-8a1b-1239b9ac9d02 | {
"language": "C++"
} | ```c++
```
Check whether given tree satisfies children sum property. | ```c++
#include <stdio.h>
typedef struct _NODE {
int data;
_NODE* left;
_NODE* right;
} NODE;
NODE* newNode(int data) {
NODE* node = new NODE();
node->data = data;
node->left = nullptr;
node->right = nullptr;
return node;
}
bool isSumProperty(NODE* root) {
int left_node_data = 0;
int right_node_... |
c2029bfb-946a-4ba4-8d11-f814486d39b5 | {
"language": "C++"
} | ```c++
```
Add a test for "external" API that checks the dup suppression is based on the caller PC | ```c++
// RUN: %clangxx_tsan %s -o %t
// RUN: %deflake %run %t 2>&1 | FileCheck %s
#include <thread>
#import "../test.h"
extern "C" {
void *__tsan_external_register_tag(const char *object_type);
void *__tsan_external_assign_tag(void *addr, void *tag);
void __tsan_external_read(void *addr, void *caller_pc, void *tag)... |
e2522ffc-fe8b-469b-8d74-4f62479edaa3 | {
"language": "C++"
} | ```c++
```
Add Chapter 23, exercise 8 | ```c++
// Chapter 23, exercise 8: modify program from 23.8.7 to take as input a pattern
// and a file name, then output numbered lines (line-number: line) that contain
// a match of the pattern. No match - no output
#include<regex>
#include<iostream>
#include<iomanip>
#include<string>
#include<fstream>
#include<sstrea... |
d4b69159-62a9-426c-94bc-fd8794b1ee6d | {
"language": "C++"
} | ```c++
```
Add test skeleton for HttpInterface | ```c++
#include <catch.hpp>
#define private public
#include <libgearbox_http_interface_p.h>
#include <libgearbox_http_interface.cpp>
TEST_CASE("Test libgearbox_http_interface", "[http]")
{
SECTION("")
{
}
}
``` |
505d350b-8d23-494b-8bd5-72c9fed0d0bd | {
"language": "C++"
} | ```c++
```
Migrate from llvm/test/FrontendC++ and FileCheckize. | ```c++
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
// CHECK-NOT: ZN12basic_stringIcEC1Ev
// CHECK: ZN12basic_stringIcED1Ev
// CHECK: ZN12basic_stringIcED1Ev
template<class charT>
class basic_string
{
public:
basic_string();
~basic_string();
};
template <class charT>
__attribute__ ((__visibility__("hidden")... |
23e24bf2-29ac-4d2e-8476-de844e308f0a | {
"language": "C++"
} | ```c++
```
Add new file for crash testing. | ```c++
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
static void CrashCatcher(int sig)
{
const char *msg;
switch (sig) {
case SIGILL: msg = "CRASHED: SIGILL\n"; break;
case SIGTRAP: msg = "CRASHED: SIGTRAP\n"; break;
case SIGABRT: msg = "CRASHED: SIGABRT\n"; break;
... |
aa546565-4723-42da-94f5-be35af8a5d64 | {
"language": "C++"
} | ```c++
```
Update origin for the entire destination range on memory store. | ```c++
// Check that 8-byte store updates origin for the full store range.
// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %run %t >%t... |
9688fc90-fdea-471a-b5f2-356b5cf53a05 | {
"language": "C++"
} | ```c++
```
Add Solution for 1 Two Sum | ```c++
//1. Two Sum
/**
* Given an array of integers, return indices of the two numbers such that they add up to a specific target.
* You may assume that each input would have exactly one solution.
*
* Example:
* Given nums = [2, 7, 11, 15], target = 9,
* Because nums[0] + nums[1] = 2 + 7 = 9,
* return [0, 1].
... |
7ef9bf21-a5f5-425c-b1e8-3fa1b63dea37 | {
"language": "C++"
} | ```c++
```
Add test for antique effect | ```c++
#include <gtest/gtest.h>
#include "photoeffects.hpp"
using namespace cv;
TEST(photoeffects, AntiqueTest)
{
Mat image(10, 10, CV_8UC1);
EXPECT_EQ(10, antique(image).cols);
}
``` |
7edd1942-d04a-4398-82e8-9931e55e9c14 | {
"language": "C++"
} | ```c++
```
Add a test for clang-tidy using the clang-cl driver. | ```c++
// RUN: clang-tidy -checks=-*,modernize-use-nullptr %s -- --driver-mode=cl /DTEST1 /DFOO=foo /DBAR=bar | FileCheck -implicit-check-not="{{warning|error}}:" %s
int *a = 0;
// CHECK: :[[@LINE-1]]:10: warning: use nullptr
#ifdef TEST1
int *b = 0;
// CHECK: :[[@LINE-1]]:10: warning: use nullptr
#endif
#define foo 1
... |
1be302fd-8b21-4a54-a08e-71a2b2085487 | {
"language": "C++"
} | ```c++
```
Add 82 Remove Duplicates from Sorted List II | ```c++
// 82 Remove Duplicates from Sorted List II
/**
* Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
*
* For example,
* Given 1->2->3->3->4->4->5, return 1->2->5.
* Given 1->1->1->2->3, return 2->3.
*
* Tag: Linked List
*
* Author:... |
fc687a42-f9e8-481f-92c8-15ccca2a98e3 | {
"language": "C++"
} | ```c++
```
Print all path from root to leaf. | ```c++
#include <stdio.h>
typedef struct _NODE {
int data;
_NODE* left;
_NODE* right;
} NODE;
NODE* newnode(int data) {
NODE* node = new NODE();
node->data = data;
node->left = nullptr;
node->right = nullptr;
return node;
}
void printPathUtil(int* path, int len) {
for (int i = 0; i < len; i++) {
... |
13eb312b-f9a2-4c23-98c1-22a150232e02 | {
"language": "C++"
} | ```c++
```
Add C++ Bindings to Lua | ```c++
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "RtMidi.h"
static RtMidiOut midi;
int midi_send(lua_State* L)
{
double status = lua_tonumber(L, -3);
double data1 = lua_tonumber(L, -2);
double data2 = lua_tonumber(L, -1);
std::vector<unsigned char> ... |
a9ad6a60-c0c9-4e0a-9089-d814ad8f4d88 | {
"language": "C++"
} | ```c++
```
Test to ensure stack allocations can be reused. | ```c++
#include <stdio.h>
#include <Halide.h>
using namespace Halide;
int main(int argc, char **argv) {
Func f, g, h;
Var x;
// Create a simple function computed at root.
f(x) = x;
f.compute_root();
// Create a function that uses an undefined buffer after f is
// freed.
g(x) = undef<... |
8916e574-e55a-4c14-b65c-5652c96fc722 | {
"language": "C++"
} | ```c++
```
Add unit tests for omp::Schedule | ```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/core/OmpSchedule... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.