doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
02e76bb5-aec0-478c-a253-2488f3055cc6
{ "language": "C++" }
```c++ ``` Convert Binary Number in a Linked List to Integer
```c++ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ class Solution { public: int getDecimal...
76f616e0-6ce4-47ce-98f9-120104e65996
{ "language": "C++" }
```c++ ``` Add 004 Median of Two Sorted Array
```c++ // 4 Median of Two Sorted Array /** * There are two sorted arrays nums1 and nums2 of size m and n respectively. * Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). * * Tag: Divide and Conquer, Array, Binary Search * * Author: Yanbin Lu */ #include <stddef.h>...
6b90bcf9-71a3-4b6a-8de4-ff5288d242fa
{ "language": "C++" }
```c++ ``` Implement solution Longest increasing subsequence.
```c++ #include <bits/stdc++.h> using namespace std; //Compute the largest increasing subsequence int lis( int arr[], int n ){ int *lis, i, j, max = 0; lis = (int*) malloc ( sizeof( int ) * n ); for (i = 0; i < n; i++ ) lis[i] = 1; for (i = 1; i < n; i++ ) for (j = 0; j < i; j++ ) if ( arr[i] > arr[j] && lis...
c62d0871-cfa7-4785-a859-13370cffd9d9
{ "language": "C++" }
```c++ ``` Add negotiator plugin prototype for ODS contrib
```c++ /* * Copyright 2009-2011 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
dc8896fd-b649-4d9a-a088-e3add4a2a7af
{ "language": "C++" }
```c++ ``` Add a testcase for start+end implementations of std::initializer_list.
```c++ // RUN: %clang_cc1 -std=c++11 -S -emit-llvm -o - %s | FileCheck %s namespace std { typedef decltype(sizeof(int)) size_t; // libc++'s implementation with __size_ replaced by __end_ template <class _E> class initializer_list { const _E* __begin_; const _E* __end_; initializer_list(const _E...
e91798dd-cf96-4329-aff3-d8b568835a60
{ "language": "C++" }
```c++ ``` Add Chapter 25, exercise 8
```c++ // Chapter 25, exercise 8: write out the numerical values of each character on // your keyboard #include<iostream> using namespace std; void print(char ch) { cout << ch << ": " << int(ch) << '\t'; } int main() { print(''); print('+'); print('"'); print('*'); print(''); print('%');...
290e1ea6-973f-4c41-a46a-b10e15700cd3
{ "language": "C++" }
```c++ ``` Add Chapter 23, exercise 13
```c++ // Chapter 23, exercise 13: test if the reuglar expression '.' matches the // newline character '\n' #include<iostream> //#include<string> #include<regex> using namespace std; int main() { string s = "\n"; regex pat("."); smatch matches; if (regex_match(s,matches,pat)) cout << "'.' mat...
f081f15a-9110-4bd3-918c-5dd9574071dd
{ "language": "C++" }
```c++ ``` Add test missed from r278983.
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit 2 %s template<int N, typename T> struct X : X<N+1, T*> {}; // expected-error-re@3 {{recursive template instantiation exceeded maximum depth of 1024{{$}}}} // expected-note@3 {{instantiation of template class}} // expected-note@3 {{skipping 1023...
383054bc-61d8-4146-a034-c78dbbd614b1
{ "language": "C++" }
```c++ ``` Connect nodes at same level
```c++ /******************************************************************************* Connect nodes at same level =========================== Ref - http://www.geeksforgeeks.org/connect-nodes-at-same-level/ -------------------------------------------------------------------------------- Problem ======= Connect a c...
a3c9d67f-2925-43c2-9879-b367262386a2
{ "language": "C++" }
```c++ ``` Add code to insert node in linked list
```c++ #include<iostream> using namespace std; class Node{ public: int data; Node *next; Node(){} Node(int d){ data=d; next=NULL; } Node *insertElement(Node *head,int d){ Node *np=new Node(d); Node *tmp=head; if(head==NULL) return np; else while(tmp->next) tmp=tmp->next...
93208e22-a9b6-4845-8ebe-581de4865dc2
{ "language": "C++" }
```c++ ``` Add a test for r261425.
```c++ // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -fexceptions -fcxx-exceptions -fexternc-nounwind | FileCheck %s namespace test1 { struct Cleanup { ~Cleanup(); }; extern "C" void never_throws(); void may_throw(); void caller() { Cleanup x; never_throws(); may_throw(); } } // CHECK-LABEL: defin...
191132d6-bc34-4068-906f-62e6ec402864
{ "language": "C++" }
```c++ ``` Set Zeroes in a Matrix
```c++ #include <iostream> #include <set> #include <vector> using namespace std; void setZeroes(vector<vector<int> > &matrix) { set<int> rows; set<int> columns; int noRows = matrix.size(); int noColumns = matrix.at(0).size(); for (int i = 0; i < noRows; ++i) { for (int j = 0; j < noColum...
594994a1-ff6d-4ec8-9fcd-ac80a9c68798
{ "language": "C++" }
```c++ ``` Add ex8.5 and result of performance testing
```c++ /* Ex 8.5: Write two functions that reverse the order of elements in a vector<int>. For example, 1, 3, 5, 7, 9 becomes 9, 7, 5, 3, 1. The first reverse function should produce a new vector with the reversed sequence, leaving its original vector unchanged. The other reverse function should reverse the elements of...
f4d2d2b5-3475-45cd-9c27-5fe7fba8bf14
{ "language": "C++" }
```c++ ``` Add program to test quicksort
```c++ /* This program tests Quick sort */ #include<iostream> #include<vector> #include "quicksort.h" // My implementation of Quick sort // Displays vector void printVector(std::vector<int> A){ for(auto x: A){ std::cout<<x<<" "; } std::cout<<std::endl; } // Tests Quick sort on vector A void testQuickSort(...
e5133b5b-28be-476e-b157-f4571b248e76
{ "language": "C++" }
```c++ ``` Add unit test to ensure that inserting the same name twice raises an error
```c++ // This file is part of the HörTech Open Master Hearing Aid (openMHA) // Copyright © 2020 HörTech gGmbH // // openMHA is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, version 3 of the License. /...
d5e71ea6-fd96-4152-bb47-d78d9c0e01d3
{ "language": "C++" }
```c++ ``` Add and test cookie tracking to microhttpd.
```c++ #include <thread> #include <iostream> #include <silicon/mhd_serve.hh> #include <silicon/api.hh> #include <silicon/client.hh> using namespace sl; int main() { auto api = make_api( @my_tracking_id = [] (tracking_cookie c) { return D(@id = c.id()); } ); // Start server. std::thread ...
353e6850-eee7-4a6a-87ec-d0d60079dbaa
{ "language": "C++" }
```c++ ``` Add a solution for problem 23: Merge k Sorted Lists.
```c++ // Naive solution would iterate all lists to take the smallest head every time to // add to the merged list. Actually we have a efficient data structure to retrieve // the smallest element from a bunch of elements. That is a "min heap". // In the implementation below, I created a wrapper for list so that we coul...
204d5ba1-5ff0-4170-9a43-49a5599658f6
{ "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/app/mojo/mojo_init.h" #include "base/memory/scoped_ptr.h" #include "mojo/edk/embedder/embedder.h" #include "mojo/edk/embedder/si...
```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/app/mojo/mojo_init.h" #include "base/memory/scoped_ptr.h" #include "mojo/edk/embedder/configuration.h" #include "mojo/edk/embedd...
bfaac525-ac36-48df-905d-131ae9643470
{ "language": "C++" }
```c++ ``` Add fixed solution to fast tast "Kozichki"
```c++ #include<iostream> int main() { unsigned N,K; unsigned Ai[1000],VarAi[1000]; unsigned max=0,capacity,varIndx,v_capacity; unsigned big,hasMoreValues,flag=1; do { std::cin>>N; }while(N<1 || N>1000); do { std::cin>>K; }while(K<1 || K>1000); for...
56f1ba53-1f29-4cff-8fb2-a9ba30bf73d2
{ "language": "C++" }
```c++ ``` Add qsort with lambda function in c++11 standard.
```c++ #include <iostream> #include <vector> #include <algorithm> #include <random> using namespace std; int main() { vector<int> vec(10000); generate(vec.begin(), vec.end(), rand); sort(vec.begin(), vec.end(), [](int a, int b) -> bool { return a > b; }); for (auto &a : vec) { cout << a << " "; } cout << e...
1a7c60fd-3b87-44ee-93c2-dd448720f011
{ "language": "C++" }
```c++ ``` Add functions up to elaboration (Ed Carter)
```c++ #include "PTask.h" PFunction::PFunction(svector<PWire*>*p, Statement*s) : ports_(p), statement_(s) { } PFunction::~PFunction() { } ```
9552a708-54f5-4001-830c-c2fde5017e9d
{ "language": "C++" }
```c++ ``` Enable to pass mjpeg stream from node to c++
```c++ #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> using namespace cv; #if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \ || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) # include <io.h> # include <fcntl.h> # define SET_BINARY_MODE(h...
85945555-5a04-437e-803f-457cefe1a544
{ "language": "C++" }
```c++ ``` Add a solution for task 4a
```c++ #include <cstdio> #include <cctype> using namespace std; int a[10]; void print_number(int a[]) { for (int i = 9; i >= 0; i--) { while (a[i] > 0) { printf("%d", i); a[i]--; } } printf("\n"); } int main() { char x; while (scanf("%c", &x) != EOF) { if (x == ' ') { ...
cdc98668-db7e-4cc4-bd5f-8ad0ed89d640
{ "language": "C++" }
```c++ ``` Add Solution for Problem 005
```c++ // 005. Longest Palindromic Substring /** * Given a string S, find the longest palindromic substring in S. * You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. * * Tags: String * * Author: Kuang Qin */ #include "stdafx.h" #include <string> #in...
f0a78218-ab79-4d8a-b8e6-b2c4699f6a6b
{ "language": "C++" }
```c++ ``` Allow specific files and multiple inputs for picture testing tools.
```c++ /* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "Test.h" #include "picture_utils.h" #include "SkString.h" static void test_filepath_creation(skiatest::Reporter* reporter) { SkString result; SkString ...
9c6f8316-1723-41e5-90bd-f869789b09a0
{ "language": "C++" }
```c++ ``` Add Solution for 459 Repeated Substring Pattern
```c++ // 459. Repeated Substring Pattern /** * Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. * You may assume the given string consists of lowercase English letters only and its length will not exceed 10000. * * Exampl...
360feae1-e8d3-4866-b324-e3bae588953c
{ "language": "C++" }
```c++ ``` Add test file missed from r341097.
```c++ // RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++14-compat-pedantic -verify %s // RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++14-compat-pedantic -verify %s #if __cplusplus < 201402L // expected-no-diagnostics // FIXME: C++11 features removed or changed in C++14? #else static_assert(true); // expected-warni...
6a55151f-fd7f-49de-8d5c-57a876af6422
{ "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 "athena/content/content_activity_factory.h" #include "athena/activity/public/activity_manager.h" #include "athena/content/app_activity.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 "athena/content/content_activity_factory.h" #include "athena/activity/public/activity_manager.h" #include "athena/content/app_activity.h"...
cf3ca6ec-a217-495f-9ef9-c4b156858812
{ "language": "C++" }
```c++ ``` Add solution for chapter 17 test 28
```c++ #include <iostream> #include <random> using namespace std; int generate_random_number(const int a = 0, const int b = 9) { static default_random_engine e; static uniform_int_distribution<unsigned> u(a, b); return u(e); } int main() { for(int i = 0; i != 20; ++ i) { cout <...
f45e3d83-20c3-4230-a868-4c166d7080b2
{ "language": "C++" }
```c++ // Copyright Daniel Wallin 2009. Use, modification and distribution is // subject to 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) #include "test.hpp" #include <luabind/luabind.hpp> #include <luabind/detail/shared_ptr_converte...
```c++ // Copyright Daniel Wallin 2009. Use, modification and distribution is // subject to 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) #include "test.hpp" #include <luabind/luabind.hpp> #include <luabind/shared_ptr_converter.hpp> ...
fa295dd0-eb5c-47d9-a7d7-301150c30b60
{ "language": "C++" }
```c++ ``` Call substr only once to check isRotation of strings
```c++ /* Assume you have a method isSubstring which checks if one word is a substring of another string. Given two strings s1, and s2. write code to check if s2 is a rotation of s1 using only one call to isSubstring (i.e., “waterbottle” is a rotation of “erbottlewat”). */ # include <iostream> using namespace std; ...
4fc470bf-ebd7-4dc1-bd7b-5f7163022a49
{ "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/common/chrome_version_info.h" #include "base/android/build_info.h" #include "base/logging.h" #include "base/strings/string_ut...
```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/common/chrome_version_info.h" #include "base/android/build_info.h" #include "base/logging.h" #include "base/strings/string_ut...
1cc8c06a-fc79-446e-8b9d-806154cbafad
{ "language": "C++" }
```c++ ``` Add dllexport default ctor closure PCH regression test for PR31121
```c++ // Make sure we emit the MS ABI default ctor closure with PCH. // // Test this without pch. // RUN: %clang_cc1 -fms-extensions -triple x86_64-windows-msvc -std=c++11 -include %s -emit-llvm -o - %s | FileCheck %s // Test with pch. // RUN: %clang_cc1 -fms-extensions -triple x86_64-windows-msvc -std=c++11 -emit-pc...
09249322-6d73-47db-8fab-85e0d243710e
{ "language": "C++" }
```c++ ``` Add Chapter 19, exercise 10
```c++ // Chapter 19, exercise 10: implement a simple auto_ptr supporting only a // constructor, destructor, ->, * and release() - don't try assignment or copy // constructor #include "../lib_files/std_lib_facilities.h" //------------------------------------------------------------------------------ struct Tracer { ...
82c13b18-39ad-4919-805d-4f8828dba03a
{ "language": "C++" }
```c++ ``` Test case to check CommonTime and DayTime compatability
```c++ #include "DayTime.hpp" #include "CommonTime.hpp" #include <iostream> using namespace gpstk; using namespace std; int main() { CommonTime common = CommonTime(); DayTime day = DayTime(); day = common; common = day; day = CommonTime(); common = DayTime(); return 0; } ```
e3648459-2f12-49a0-8cd4-998cac01e47f
{ "language": "C++" }
```c++ ``` Test for non-canonical decl and vtables.
```c++ // RUN: clang-cc %s -emit-llvm-only class Base { public: virtual ~Base(); }; Base::~Base() { } class Foo : public Base { public: virtual ~Foo(); }; Foo::~Foo() { } ```
1925f57e-be57-4ea3-882a-c3a2ca7b3799
{ "language": "C++" }
```c++ ``` Add a solution for problem 219: Contains Duplicate II.
```c++ // https://leetcode.com/problems/contains-duplicate-ii/ // Compared to 'contains duplicate i', now we also need to know the index of number for // query. So we use a number to index map. class Solution { public: bool containsNearbyDuplicate(vector<int>& nums, int k) { unordered_map<int, size_t> val...
38433e98-6a31-4cbe-aaa5-33999feee564
{ "language": "C++" }
```c++ ``` Add the solution to "Phone Patterns".
```c++ #include <iostream> #include <string> #include <list> #include <map> using namespace std; char convert(char x) { if (x >= 'A' && x <= 'P') { return ((x - 'A') / 3 + 2) + '0'; } if (x >= 'R' && x <= 'Y') { return ((x - 'A' - 1) / 3 + 2) + '0'; } else { return x; } } string mapper(string s) { string...
3a3d5c40-ec4e-43f7-aef3-33d3207bedee
{ "language": "C++" }
```c++ ``` Add 3101 astronomy cpp version, which doesn't handle the big integer and WA. JAVA was used instead to AC
```c++ #include <stdio.h> #include <stdlib.h> #include <string.h> unsigned long long p[3]; unsigned long long* gcdEx(unsigned long long a, unsigned long long b, unsigned long long *p) { if (b == 0) { p[0] = 1, p[1] = 0, p[2] = a; return p; } else { p = gcdEx(b, b%a, p); unsigne...
2425e046-3a20-48b2-af43-1d48550f60fe
{ "language": "C++" }
```c++ ``` Add Solution for Problem 134
```c++ // 134. Gas Station /** * There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. * * You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its next station (i+1). You begin the journey with an empty tank at one of the gas s...
3c6457aa-9b71-409f-8373-ef2004dedf92
{ "language": "C++" }
```c++ ``` Print the file name and file extension name of all arguments
```c++ #include <string> #include <cstdio> std::string GetFilenameExt(std::string filename) { std::string ext_name(""); std::string::size_type index = filename.rfind('.'); if(index != std::string::npos) ext_name = filename.substr(index+1); return ext_name; } int main (int argc, char *argv[]) { for(unsign...
5df7bc44-2c30-4370-9513-a33f7c872935
{ "language": "C++" }
```c++ ``` Add solution for chapter 16 test 35
```c++ #include <iostream> using namespace std; template <typename T> T calc(T a, int i) { return a; } template <typename T> T fcn(T a, T b) { return a; } int main() { double d; float f; char c = 'a'; calc(c, 'c');//good calc(d, f);//good cout << fcn(c, 'c'); // ...
f8c95ed2-764a-4a69-8936-eed36afd37e7
{ "language": "C++" }
```c++ ``` Add solution for chapter 17 test 20
```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 || m[4].str() == " "); } else { return m[3].matched == 0 && m[4].str() == m[6].str(); } } int main() ...
a562831a-308f-4e00-8781-1697156b1605
{ "language": "C++" }
```c++ ``` Add initial foundation cpp file.
```c++ // Copyright (c) 1997-2018 The CSE Authors. All rights reserved. // Use of this source code is governed by a BSD-style license // that can be found in the LICENSE file. /////////////////////////////////////////////////////////////////////////////// // Foundation.cpp -- interface to Kiva ////////////////////////...
da9fc604-9f54-4665-bd85-b9f179cf4397
{ "language": "C++" }
```c++ ``` Add a solution for task 3a
```c++ #include <iostream> #include <vector> #include <string> #include <sstream> using namespace std; int taken[22]; int n, k; bool found = false; vector<int> numbers; void rec(int i) { if (found) return; if (i == n) { int sum = 0; for (int j = 0; j < n; j++) { // cout << taken[j] << " "; ...
055caa1c-d50e-472b-b7df-648200e5b779
{ "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...
4270bd2f-90c4-433c-a7f0-e7ea2a6ca020
{ "language": "C++" }
```c++ ``` Migrate test from llvm/test/FrontendC++ and FileCheckize.
```c++ // RUN: %clang_cc1 -g -emit-llvm %s -o - | FileCheck %s // Do not use function name to create named metadata used to hold // local variable info. For example. llvm.dbg.lv.~A is an invalid name. // CHECK-NOT: llvm.dbg.lv.~A class A { public: ~A() { int i = 0; i++; } }; int foo(int i) { A a; return 0; } ``...
0950cf0d-de5d-46a8-bbfb-24a42edac44f
{ "language": "C++" }
```c++ //#include "InstructionParser.h" #include <string> #include <stdexcept> #include "gtest/gtest.h" class InstructionParser { public: class UnknownInstruction : public std::runtime_error { public: UnknownInstruction(const std::string& msg) : std::runtime_error{msg} {} }; void parseInstructions...
```c++ //#include "InstructionParser.h" #include <string> #include <stdexcept> #include "gtest/gtest.h" class InstructionParser { public: class UnknownInstruction : public std::runtime_error { public: UnknownInstruction(const std::string& msg) : std::runtime_error{msg} {} }; void parseInstructions...
be8d2e78-d4e7-4f90-810f-95de5d0cbcf2
{ "language": "C++" }
```c++ ``` Add test for the graphnode.
```c++ #include "graph_node.h" #include "gtest\gtest.h" /* This file will includ all the test for the GraphNode class. */ /* This test will check if neighbors can be added. */ TEST(GraphNodeTest, Add) { //Initialize a node with some children GraphNode<int> root1; GraphNode<int> neighbor1; Grap...
c36cd3df-5da3-49be-a6ca-262e0a1cfa09
{ "language": "C++" }
```c++ ``` Check if given binary tree is BST or not.
```c++ // Program to check if given tree is a BST or not. #include <iostream> #define MAX 1000 using namespace std; int A[MAX]; int index = 0; struct Node{ int data; struct Node *left; struct Node *right; }; struct Node *newNode(int x){ struct Node *newptr = new Node; newptr->data = x; newptr->left = NULL; n...
2ccdb065-9a35-4ff3-b9ff-613a9f34ea0c
{ "language": "C++" }
```c++ ``` Add solution to the second problem - 'Triangle'
```c++ #include <iostream> #include <cmath> using namespace std; class Point3D { double x; double y; double z; public: double getX() { return x; } double getY() { return y; } double getZ() { return z; } void setX(double newX) { x = newX; } void setY(double newY) { y =...
2577ee9a-2811-403c-bb3d-d9fc421ea985
{ "language": "C++" }
```c++ ``` Add minimum template for programming contest
```c++ #include <cstdlib> #include <iostream> int main(void) { std::cin.tie(0); std::ios::sync_with_stdio(false); int n; while (std::cin >> n) { std::cout << n << std::endl; } return EXIT_SUCCESS; } ```
ea59ed4b-d744-45af-98ba-1cb1a6472396
{ "language": "C++" }
```c++ ``` Implement android specific logging calls
```c++ // Copyright (c) 2018 The Gulden developers // Authored by: Malcolm MacLeod (mmacleod@webmail.co.za) // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <string> #include <android/log.h> void OpenDebugLog() { } int...
9bf67b00-944b-4715-a2c5-b67007e6fb39
{ "language": "C++" }
```c++ ``` Add solution for chapter 18, test 23
```c++ #include <iostream> using namespace std; class A { public: A() { cout << "A()" << endl; } }; class B : public A { public: B() { cout << "B()" << endl; } }; class C : public B { public: C() { cout << "C()" << endl; } }; class X { publi...
75919b67-6470-4208-90e3-626c356c242e
{ "language": "C++" }
```c++ ``` Add Coverity Scan model file.
```c++ /** * Coverity Scan model * * Manage false positives by giving coverity some hints. * * Updates to this file must be manually submitted by an admin to: * * https://scan.coverity.com/projects/1222 * */ // When tag is 1 or 2, let coverity know that execution is halting. Those // tags correspond to INT_...
f77dc1aa-8552-4850-9772-d2358405ecf5
{ "language": "C++" }
```c++ ``` Test that linetables work with variadic virtual thunks
```c++ // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -gline-tables-only %s -o - | FileCheck %s // Crasher for PR22929. class Base { virtual void VariadicFunction(...); }; class Derived : public virtual Base { virtual void VariadicFunction(...); }; void Derived::VariadicFunction(...) { } // CHECK-LABE...
c82a0ec9-10ac-4428-937d-af3e26d41743
{ "language": "C++" }
```c++ ``` Add Solution for Problem 122
```c++ // 122. Best Time to Buy and Sell Stock II /** * Say you have an array for which the ith element is the price of a given stock on day i. * * Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times). * Howev...
0cb93675-b770-4f9f-90ce-91355dbe8399
{ "language": "C++" }
```c++ ``` Add solution for chapter 16 test 65 66 67
```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; ...
35091c0e-3184-46d3-b5d5-240177a020b8
{ "language": "C++" }
```c++ ``` Add additional test case for multiline comments
```c++ #include <iostream> #include <cstdlib> /* This is our main function */ int main() { // print Hello world! std::cout << "HELLO WORLD!" << std::endl; return 1; /* TESTING MULTILINE COMMENTS YAY */ } ```
6177b5d1-494a-4af4-a04d-0146a117dead
{ "language": "C++" }
```c++ ``` Add solution for chapter 17 test 14
```c++ #include <iostream> #include <regex> #include <string> using namespace std; int main() { try { //[z-a]+\\.(cpp|cxx|cc)$ code 4 // string pattern("[[:alnum:]]+\\.cpp|cxx|cc)$", regex::icase); regex r(pattern); smatch results; } catch(regex_error e) ...
0bfa18ca-96c5-409e-8c9c-b3269a3990b8
{ "language": "C++" }
```c++ ``` Add solution for chapter 17 test 27
```c++ #include <iostream> #include <regex> #include <string> using namespace std; int main() { string pattern("(\\d{5})(\\d{4})"); regex r(pattern); smatch m; string s; string fmt = "$1-$2"; while(getline(cin, s)) { cout << regex_replace(s, r, fmt) << endl; } ...
9665e061-9fa0-4772-acb8-7a5274754093
{ "language": "C++" }
```c++ ``` Print linked list in reverse
```c++ /* Print elements of a linked list in reverse order as standard output head pointer could be NULL as well for empty list Node is defined as struct Node { int data; struct Node *next; } */ void ReversePrint(Node *head) { if (head != NULL) { ReversePrint(head->next); cout...
38175ad6-b466-4741-ac07-7c8a8cb38339
{ "language": "C++" }
```c++ ``` Add hack to allow ubsan to work w/o compiler-rt (__muloti4 is undefined)
```c++ /*===-- int128_builtins.cpp - Implement __muloti4 --------------------------=== * * 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. * * ===---------------------------------...
f1d130e6-7ffd-4f08-a2ab-129c33bfcf7f
{ "language": "C++" }
```c++ #include <iostream> #include <string> #include <clang/Tooling/Tooling.h> #include <clang/Tooling/CommonOptionsParser.h> #include <llvm/Support/CommandLine.h> using namespace llvm; using namespace clang::tooling; using std::string; static cl::OptionCategory OptionsCategory("Options"); int main(int argc, const...
```c++ #include <iostream> #include <string> #include <clang/Tooling/Tooling.h> #include <clang/Tooling/CommonOptionsParser.h> #include <clang/Frontend/FrontendActions.h> #include <clang/AST/ASTConsumer.h> #include <llvm/Support/CommandLine.h> using namespace llvm; using namespace clang; using namespace clang::toolin...
515654de-0c7c-488f-9f0b-7aac7f245afc
{ "language": "C++" }
```c++ #include <string> #include <iostream> #include <fstream> #include <streambuf> #include <evm2wasm.h> using namespace std; int main(int argc, char **argv) { if (argc < 2) { cerr << "Usage: " << argv[0] << " <EVM file> [--wast]" << endl; return 1; } bool wast = false; if (argc ==...
```c++ #include <string> #include <iostream> #include <fstream> #include <streambuf> #include <algorithm> #include <evm2wasm.h> using namespace std; int main(int argc, char **argv) { if (argc < 2) { cerr << "Usage: " << argv[0] << " <EVM file> [--wast]" << endl; return 1; } bool wast = f...
8ea24e50-6749-4589-a464-a2fd0c091ea9
{ "language": "C++" }
```c++ /* * The MIT License (MIT) * * Copyright (c) 2014 Pavel Strakhov * * 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 the rights ...
```c++ /* * The MIT License (MIT) * * Copyright (c) 2014 Pavel Strakhov * * 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 the rights ...
ee02774c-ff2f-49dc-bcad-54035f74616c
{ "language": "C++" }
```c++ #include "Moves/En_Passant.h" #include "Moves/Direction.h" #include "Moves/Pawn_Capture.h" #include "Game/Board.h" //! Create an en passant move. // //! \param color The color of the moving pawn. //! \param dir The direction of the capture. //! \param file_start The file of the square where the pawn starts. En...
```c++ #include "Moves/En_Passant.h" #include "Moves/Direction.h" #include "Moves/Pawn_Capture.h" #include "Game/Board.h" //! Create an en passant move. // //! \param color The color of the moving pawn. //! \param dir The direction of the capture. //! \param file_start The file of the square where the pawn starts. En...
942a20e4-52a1-4806-97da-87862e4273fb
{ "language": "C++" }
```c++ #include <iostream> int main () { std::cout << "Hello word!" << std::endl; }``` Add a dummy for testing Boost dependencies within CMake
```c++ #include <iostream> #include <boost/asio.hpp> int main () { boost::asio::io_service io_dummy; boost::asio::deadline_timer t(io_dummy, boost::posix_time::seconds(5)); t.wait(); std::cout << "Hello word!" << std::endl; }```
5c6cfda4-11b4-404b-a83e-34f66aa7bdc5
{ "language": "C++" }
```c++ /* * Copyright 2014-2015 Adrián Arroyo Calle <adrian.arroyocalle@gmail.com> * All rights reserved. Distributed under the terms of the MIT license. */ #include "App.hpp" #include "Window.hpp" SuperFreeCell::SuperFreeCell() : BApplication("application/x-vnd.adrianarroyocalle.SuperFreeCell") { Window* wi...
```c++ /* * Copyright 2014-2015 Adrián Arroyo Calle <adrian.arroyocalle@gmail.com> * All rights reserved. Distributed under the terms of the MIT license. */ #include "App.hpp" #include "Window.hpp" SuperFreeCell::SuperFreeCell() : BApplication("application/x-vnd.adrianarroyocalle.SuperFreeCell") { Window* wi...
72b5a8cb-1a0b-46ab-9a38-6068c9aac472
{ "language": "C++" }
```c++ #include "mpage.h" PageItemProxy & PageItemProxy::operator=(const uint8_t & value) { MemoryPage & page = reinterpret_cast<MemoryPage&>(*this); page.m_Data[page.m_ProxyIndex] = value; page.m_Dirty = true; return *this; } PageItemProxy::operator uint8_t() { MemoryPage & page = reinterpret_ca...
```c++ #include "mpage.h" PageItemProxy & PageItemProxy::operator=(const uint8_t & value) { MemoryPage & page = reinterpret_cast<MemoryPage&>(*this); if (value == page.m_Data[page.m_ProxyIndex]) { return *this; } page.m_Data[page.m_ProxyIndex] = value; page.m_Dirty = true; return *thi...
c839fec5-7191-4586-9294-e02f93e75f00
{ "language": "C++" }
```c++ /****************************************************************************** This source file is part of the Avogadro project. Copyright 2012 Kitware, Inc. This source code is released under the New BSD License, (the "License"). Unless required by applicable law or agreed to in writing, software ...
```c++ /****************************************************************************** This source file is part of the Avogadro project. Copyright 2012 Kitware, Inc. This source code is released under the New BSD License, (the "License"). Unless required by applicable law or agreed to in writing, software ...
48f2cf5a-4ffd-4391-8620-7971cc962c89
{ "language": "C++" }
```c++ #include "main_window.hpp" #include <QApplication> #include <iostream> using namespace std; using namespace datavis; int main(int argc, char *argv[]) { QApplication app(argc, argv); auto main_win = new MainWindow; auto args = app.arguments(); if (args.size() > 1) { auto file_pat...
```c++ #include "main_window.hpp" #include <QApplication> #include <iostream> using namespace std; using namespace datavis; namespace datavis { enum File_Type { Unknown_File_Type, Data_File_Type, Project_File_Type }; } int main(int argc, char *argv[]) { QApplication app(argc, argv); auto args ...
32f92a94-e8ac-423a-b35c-7bd7c75069b6
{ "language": "C++" }
```c++ #include "mem/Compiler.hpp" int main (int argc, char** argv) { opt::Options opts; opts.addStrOpt("--dump-ast-xml", "", "Dump the Abstract Syntax Tree as XML"); opts.addStrOpt("--emit-llvm-bc", "", "Emit LLVM bytecode"); opts.addStrOpt("--log-formatter", "", "Set the log formatter"...
```c++ #include "mem/Compiler.hpp" int main (int argc, char** argv) { opt::Options opts; opts.addStrOpt("--dump-ast-xml", "", "Dump the Abstract Syntax Tree as XML"); opts.addStrOpt("--emit-llvm-bc", "", "Emit LLVM bytecode"); opts.addStrOpt("--log-formatter", "", "Set the log formatter"...
c6277470-4c2f-4743-bb98-99c75c42bc28
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct X0 { typedef T* type; void f0(T); void f1(type); }; template<> void X0<char>::f0(char); template<> void X0<char>::f1(type); namespace PR6161 { template<typename _CharT> class numpunct : public locale::facet // expected-error{{...
```c++ // RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct X0 { typedef T* type; void f0(T); void f1(type); }; template<> void X0<char>::f0(char); template<> void X0<char>::f1(type); namespace PR6161 { template<typename _CharT> class numpunct : public locale::facet // expected-error{{...
282d6f29-f9a0-47db-a973-6891d5e1ace5
{ "language": "C++" }
```c++ #include <cstdio> long int f[39]; long int r[39]; long int fib(long int n) { if (f[n] != -1) return f[n]; if (n <= 1) { f[n] = n; r[n] = 0; } else { f[n] = fib(n - 1) + fib(n - 2); r[n] = r[n - 1] + r[n - 2] + 2; } return f[n]; } int main() { i...
```c++ #include <cstdio> #include <cstring> long int f[39]; long int r[39]; long int fib(long int n) { if (f[n] != -1) return f[n]; if (n <= 1) { f[n] = n; r[n] = 0; } else { f[n] = fib(n - 1) + fib(n - 2); r[n] = r[n - 1] + r[n - 2] + 2; } return f[n]; } ...
8720f5bf-7963-4020-a017-a0f8f1ee19b2
{ "language": "C++" }
```c++ #include "ros/ros.h" #include "pattern_posture_generator_node.hpp" int main(int argc, char* argv[]) { ros::init(argc, argv, "pattern_posture_generator"); ros::NodeHandle nh; PatternPostureGenerator ppg(nh); ros::spin(); return 0; } PatternPostureGenerator::PatternPostureGenerator(){} PatternPostu...
```c++ #include "ros/ros.h" #include "pattern_posture_generator_node.hpp" int main(int argc, char* argv[]) { ros::init(argc, argv, "pattern_posture_generator"); ros::NodeHandle nh; PatternPostureGenerator ppg(nh); ROS_INFO("Ready. getPostureKey"); ros::spin(); return 0; } PatternPostureGenerator::Patte...
51f837ca-cd83-4397-bf09-6985a5b433f3
{ "language": "C++" }
```c++ #include <sdf/sdf.hh> #include "gazebo/gazebo.hh" #include "gazebo/common/Plugin.hh" #include "gazebo/msgs/msgs.hh" #include "gazebo/physics/physics.hh" #include "gazebo/transport/transport.hh" #include <iostream> using namespace std; namespace gazebo { class SetupWorld : public WorldPlugin { public: v...
```c++ #include <sdf/sdf.hh> #include "gazebo/gazebo.hh" #include "gazebo/common/Plugin.hh" #include "gazebo/msgs/msgs.hh" #include "gazebo/physics/physics.hh" #include "gazebo/transport/transport.hh" #include <iostream> using namespace std; namespace gazebo { class SetupWorld : public WorldPlugin { public: v...
426d2ea6-4c45-4434-b2fc-08b39ed19c60
{ "language": "C++" }
```c++ #include <stdexcept> #include <iostream> int opt_parse(int argc, char** argv) { // implement option parsing and call the real main // with everything ready to use return 0; } int main(int argc, char** argv) { try { return opt_parse(argc, argv); } catch (std::exception& e) { ...
```c++ #include <stdexcept> #include <iostream> int opt_parse(int argc, char** argv) { // implement option parsing and call the real main // with everything ready to use return 0; } int main(int argc, char** argv) { //unless one needs C-style I/O std::ios_base::sync_with_stdio(false); try {...
e0719a3e-d307-402a-bf4a-10636adf03c7
{ "language": "C++" }
```c++ /* * ========================================================================================= * Name : eventLib.cpp * Author : Duc Dung Nguyen * Email : nddung@hcmut.edu.vn * Copyright : Faculty of Computer Science and Engineering - Bach Khoa University * Description : library for Assi...
```c++ /* * ========================================================================================= * Name : eventLib.cpp * Author : Duc Dung Nguyen * Email : nddung@hcmut.edu.vn * Copyright : Faculty of Computer Science and Engineering - Bach Khoa University * Description : library for Assi...
f579210c-42a9-41cd-bc02-f69a56fe9987
{ "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 "net/base/network_change_notifier_win.h" #include <iphlpapi.h> #include <winsock2.h> #pragma comment(lib, "iphlpapi.lib") namespace...
```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 "net/base/network_change_notifier_win.h" #include <iphlpapi.h> #include <winsock2.h> #pragma comment(lib, "iphlpapi.lib") namespace...
f52bfedf-a906-403c-a6f8-b7000384492e
{ "language": "C++" }
```c++ #include <bulk.hpp> #include <iostream> int main() { bulk::spawn(bulk::available_processors(), [](int s, int p) { for (int t = 0; t < p; ++t) { bulk::send<int, int>(t, s, s); } bulk::sync(); if (s == 0) { for (auto message : bulk::messages<int, int>(...
```c++ #include <bulk.hpp> #include <iostream> int main() { auto center = bulk::center(); center.spawn(center.available_processors(), [&center](int s, int p) { for (int t = 0; t < p; ++t) { center.send<int, int>(t, s, s); } center.sync(); if (s == 0) { ...
b915b315-688d-4d8c-8eca-c62c8e09c638
{ "language": "C++" }
```c++ // Copyright 2015 Las Venturas Playground. All rights reserved. // Use of this source code is governed by the MIT license, a copy of which can // be found in the LICENSE file. #include "bindings/script_prologue.h" namespace bindings { // NOTE: Line breaks will be removed from these scripts before their execut...
```c++ // Copyright 2015 Las Venturas Playground. All rights reserved. // Use of this source code is governed by the MIT license, a copy of which can // be found in the LICENSE file. #include "bindings/script_prologue.h" namespace bindings { // NOTE: Line breaks will be removed from these scripts before their execut...
50ee131f-5326-434a-8c5a-3532e6c00862
{ "language": "C++" }
```c++ // Copyright © 2017 Dmitriy Khaustov // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or...
```c++ // Copyright © 2017 Dmitriy Khaustov // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or...
aedf5ade-83f6-43ba-8032-eaadaf44d130
{ "language": "C++" }
```c++ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: void deleteNode(ListNode* node) { node->val = node->next->val; node->next = node->next->next; } }; ``` D...
```c++ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: void deleteNode(ListNode* node) { node->val = node->next->val; node->next = node->next->next; } }; ```
15b0dd37-34df-4517-9971-aecd2bd1997f
{ "language": "C++" }
```c++ //Copyright (c) 2020 Ultimaker B.V. //CuraEngine is released under the terms of the AGPLv3 or higher. #include "OuterWallInsetBeadingStrategy.h" #include <algorithm> namespace cura { BeadingStrategy::Beading OuterWallInsetBeadingStrategy::compute(coord_t thickness, coord_t bead_count) const { ...
```c++ //Copyright (c) 2020 Ultimaker B.V. //CuraEngine is released under the terms of the AGPLv3 or higher. #include "OuterWallInsetBeadingStrategy.h" #include <algorithm> namespace cura { BeadingStrategy::Beading OuterWallInsetBeadingStrategy::compute(coord_t thickness, coord_t bead_count) const { ...
654eb369-f70a-4094-9e2c-af52dc39327e
{ "language": "C++" }
```c++ #include "frames.h" frameGPUi::frameGPUi (int w, int h, bool full) { glGenTextures (1, &plane); glBindTexture (GL_TEXTURE_2D, plane); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); //glTexImage2D (GL_TEXTURE_2D, 0, ful...
```c++ #include "frames.h" frameGPUi::frameGPUi (int w, int h, bool full) { glGenTextures (1, &plane); glBindTexture (GL_TEXTURE_2D, plane); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D (GL_TEXTURE_2D, 0, full ...
50d1a9c4-8db6-4e78-abde-20b60e05cdf8
{ "language": "C++" }
```c++ /* * Part of HTTPP. * * Distributed under the 3-clause BSD licence (See LICENCE.TXT file at the * project root). * * Copyright (c) 2013 Thomas Sanchez. All rights reserved. * */ #include "httpp/http/HttpCode.hpp" std::string HTTPP::HTTP::getDefaultMessage(HttpCode code) { switch (code) { ...
```c++ /* * Part of HTTPP. * * Distributed under the 3-clause BSD licence (See LICENCE.TXT file at the * project root). * * Copyright (c) 2013 Thomas Sanchez. All rights reserved. * */ #include "httpp/http/HttpCode.hpp" std::string HTTPP::HTTP::getDefaultMessage(HttpCode code) { switch (code) { ...
6b325d32-fb51-4e7c-a256-4eea5cb1a503
{ "language": "C++" }
```c++ #include "ros/ros.h" #include "servo_msgs/KrsServoDegree.h" #include <string> #include "krs_servo_driver.hpp" class KrsServoNode { public: KrsServoNode(); explicit KrsServoNode(ros::NodeHandle& nh, const char* path); private: void krsServoDegreeCallback(const servo_msgs::KrsServoDegree::ConstPtr& msg);...
```c++ #include "ros/ros.h" #include "servo_msgs/KrsServoDegree.h" #include <string> #include "krs_servo_driver.hpp" class KrsServoNode { public: KrsServoNode(); KrsServoNode(ros::NodeHandle& nh, const char* path); private: void krsServoDegreeCallback(const servo_msgs::KrsServoDegree::ConstPtr& msg); ros::...
8471b061-50dd-49f6-981e-2f0a22942879
{ "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 "core/animation/css/CSSTransitionData.h" #include "core/animation/Timing.h" namespace blink { CSSTransitionData::CS...
```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 "core/animation/css/CSSTransitionData.h" #include "core/animation/Timing.h" namespace blink { CSSTransitionData::CS...
0ab1f1f8-c0a5-4277-994f-076a9f15140d
{ "language": "C++" }
```c++ #include <iostream> using namespace std; int main() { cout << "TODO" << endl; return -1; } ``` Implement ranking system based on web, title, and pageindex.
```c++ #include <iostream> #include <string> #include <fstream> #include <array> #include <utility> #include <map> #include <vector> #include <algorithm> #include "IndexHelper.hpp" using namespace std; const array<pair<int, string>, 3> INDEXWEIGHTS {{ {16, "titleindex"}, {4, "webindex"}, {1, "pageindex"} }}; stri...
941e734b-2a46-4ab6-846a-47c23e476861
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s // Crasher for PR22929. class Base { virtual void VariadicFunction(...); }; class Derived : public virtual Base { virtual void VariadicFunction(...); }; void Derived::VariadicFunction(...) { }...
```c++ // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s // Crasher for PR22929. class Base { virtual void VariadicFunction(...); }; class Derived : public virtual Base { virtual void VariadicFunction(...); }; void Derived::VariadicFunction(...) { }...
01871b81-3641-4cc6-b317-868ef162ba97
{ "language": "C++" }
```c++ #include <iostream> int main() { std::cout << "Hello, world!" << std::endl; } ``` Change space 8 to 4
```c++ #include <iostream> int main() { std::cout << "Hello, world! \n"; } ```
fbf8f8d8-72b7-4570-a756-bf5ea11b0216
{ "language": "C++" }
```c++ // RUN: %clang_cc1 %s -fsyntax-only -verify // PR11179 template <short T> class Type1 {}; template <short T> void Function1(Type1<T>& x) {} // expected-note{{candidate function [with T = -42] not viable: no known conversion from 'Type1<-42>' to 'Type1<-42> &' for 1st argument;}} template <unsigned short T> cla...
```c++ // RUN: %clang_cc1 %s -fsyntax-only -verify // PR11179 template <short T> class Type1 {}; template <short T> void Function1(Type1<T>& x) {} // expected-note{{candidate function [with T = -42] not viable: no known conversion from 'Type1<-42>' to 'Type1<-42> &' for 1st argument;}} template <unsigned short T> cla...
738fba28-8de2-4187-8c14-1cfbdba9197f
{ "language": "C++" }
```c++ // MathLib.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <unittest.h> int _tmain(int /*argc*/, _TCHAR* /*argv[]*/) { run_tests(); return 0; } ``` Test change to test both branch functionality and approval process
```c++ // MathLib.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <unittest.h> int _tmain(int /*argc*/, _TCHAR* /*argv[]*/) { //test change run_tests(); return 0; } ```
a8998986-9986-4194-af67-37543a8e465d
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -std=c++11 -ast-dump %s 2>&1 | FileCheck %s char c8[] = u8"test\0\\\"\t\a\b\234"; // CHECK: char c8[12] = (StringLiteral {{.*}} lvalue u8"test\000\\\"\t\a\b\234") char16_t c16[] = u"test\0\\\"\t\a\b\234\u1234"; // CHECK: char16_t c16[13] = (StringLiteral {{.*}} lvalue u"test\000\\\"\t\a\b\2...
```c++ // RUN: %clang_cc1 -std=c++11 -ast-dump %s | FileCheck %s char c8[] = u8"test\0\\\"\t\a\b\234"; // CHECK: char c8[12] = (StringLiteral {{.*}} lvalue u8"test\000\\\"\t\a\b\234") char16_t c16[] = u"test\0\\\"\t\a\b\234\u1234"; // CHECK: char16_t c16[13] = (StringLiteral {{.*}} lvalue u"test\000\\\"\t\a\b\234\u1...
e4c365ed-9443-49ff-9d8d-b6a29fbcfac9
{ "language": "C++" }
```c++ #if(GUI == 0) #include <ace/console/eapplication.h> #else #include <ace/gui/eapplication.h> #endif #include "core/analyticfactory.h" #include "core/datafactory.h" using namespace std; int main(int argc, char *argv[]) { EApplication application("" ,"kinc" ...
```c++ #if(GUI == 0) #include <ace/console/eapplication.h> #else #include <ace/gui/eapplication.h> #endif #include "core/analyticfactory.h" #include "core/datafactory.h" using namespace std; int main(int argc, char *argv[]) { EApplication application("SystemsGenetics" ,"kinc" ...
c0a1ed1b-061a-4b8e-aa24-754f47e5e618
{ "language": "C++" }
```c++ #include <ncurses.h> #include <string> #include "game.h" using namespace std; int main(int argc, char **argv) { int initStatus = init(); if (initStatus == 0) run(); close(); printf("GAME OVER\n"); return 0; } ``` Remove unnecessary variable assignment (is implicit return, imho)
```c++ #include <ncurses.h> #include <string> #include "game.h" using namespace std; int main(int argc, char **argv) { if (init() == 0) run(); close(); printf("GAME OVER\n"); return 0; } ```
1cd6a6c4-37f7-47e2-96dc-9b4d0fc6e163
{ "language": "C++" }
```c++ #include "HumbugWindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); HumbugWindow w; if (argc == 3 && QString(argv[1]) == QString("--site")) { w.setUrl(QUrl(argv[2])); } w.show(); return a.exec(); } ``` Declare an application name and...
```c++ #include "HumbugWindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setApplicationName("Humbug Desktop"); a.setApplicationVersion("0.1"); HumbugWindow w; if (argc == 3 && QString(argv[1]) == QString("--site")) { w.setUrl(QUrl(argv[2]));...
88b20d63-60dd-4f75-802f-3a5fd33416fe
{ "language": "C++" }
```c++ #include <Pith/Config.hpp> #include <Pith/Page.hpp> #include <gtest/gtest.h> using namespace Pith; TEST(TestPage, stackAllocate) { [[gnu::unused]] Page p; } TEST(TestPage, mapOnePage) { Span<Page> pages{nullptr, 1}; auto result = Page::map(pages); EXPECT_TRUE(result); EXPECT_NE(result(), nullptr); pages...
```c++ #include <Pith/Config.hpp> #include <Pith/Page.hpp> #include <gtest/gtest.h> using namespace Pith; TEST(TestPage, pageSize) { Process::init(); EXPECT_NE(Page::size(), std::size_t{0}); Process::kill(); } TEST(TestPage, mapOnePage) { Process::init(); auto size = Page::size(); auto addr = Page::map(size); ...
edd5f6fd-e190-4432-894f-0129050c6736
{ "language": "C++" }
```c++ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE JPetTaskLoaderTest #include <boost/test/unit_test.hpp> #define private public #include "../../JPetTaskLoader/JPetTaskLoader.h" BOOST_AUTO_TEST_SUITE(FirstSuite) BOOST_AUTO_TEST_CASE( my_test1 ) { BOOST_REQUIRE(1==0); } BOOST_AUTO_TEST_SUITE_END() ``` C...
```c++ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE JPetTaskLoaderTest #include <boost/test/unit_test.hpp> #define private public #include "../../JPetTaskLoader/JPetTaskLoader.h" BOOST_AUTO_TEST_SUITE(FirstSuite) BOOST_AUTO_TEST_CASE(defaultConstrutocTest) { /*JPetOptions::Options options = { {"in...