commit stringlengths 40 40 | old_file stringlengths 4 264 | new_file stringlengths 4 264 | old_contents stringlengths 0 4.24k | new_contents stringlengths 1 5.44k | subject stringlengths 14 778 | message stringlengths 15 9.92k | lang stringclasses 277
values | license stringclasses 13
values | repos stringlengths 5 127k |
|---|---|---|---|---|---|---|---|---|---|
e6201d8c06f4451df2bc2226afde605181adf00e | week3/problem1/person_with_dog_cstring.cpp | week3/problem1/person_with_dog_cstring.cpp | #include <iostream>
#include <cstring>
using namespace std;
class Dog {
char name[30];
public:
Dog(const char _name[] = "") {
strcpy(name, _name);
}
void greet() {
cout << "Bark, bark! I am " << name << ", a talking dog." << endl;
}
};
class Person {
char name[30];
int age... | Add solution to task one using cstring Use char[] instead of string for demonstration | Add solution to task one using cstring
Use char[] instead of string for demonstration
| C++ | mit | dimitaruzunov/oop-practicum-2015-16 | |
a00c5c66b8f445d033b4f9efd9bef4e2f192d8bb | tests/test-nndt/test-nndt.cpp | tests/test-nndt/test-nndt.cpp |
#include "humlib.h"
using namespace std;
using namespace hum;
void processFile(HumdrumFile& infile);
int main(int argc, char** argv) {
Options options;
options.process(argc, argv);
HumdrumFileStream instream(options);
HumdrumFile infile;
while (instream.read(infile)) {
processFile(infile);
}
return 0;
}
... | Add test for getting the next non-null data token. | Add test for getting the next non-null data token.
| C++ | bsd-2-clause | craigsapp/humlib,craigsapp/minHumdrum,craigsapp/humlib,craigsapp/humlib,craigsapp/minHumdrum,craigsapp/minHumdrum | |
81a364f82740640dbcbdc76e548401511f7a2e7d | test/test_timing.cpp | test/test_timing.cpp | // This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <thread>
#include <cassert>
#include <iostream>
#include "../include/analyzer/Timer.hpp"
int main(void)
{
analyzer::diagnostic::Timer timer(true... | Add new test for timer class | Add new test for timer class
| C++ | mit | Vitaliy-Grigoriev/Protocol-Analyzer,Vitaliy-Grigoriev/http2-analyzer,Vitaliy-Grigoriev/Protocol-Analyzer,Vitaliy-Grigoriev/http2-analyzer | |
c8f35ccb131f966870bf1d199d0666bd3385129e | src/RawTextGraphInput.cc | src/RawTextGraphInput.cc | #include <string>
#include <iostream>
#include "Graph.hh"
#include "GraphInput.hh"
using namespace std;
template <typename V>
class RawTextGraphInput : public GraphInput<string, V> {
public:
RawTextGraphInput(Graph<V>& g) : GraphInput<string, V>(g) {}
void input(string path) {
cout << "Fetching graph ... | Add a first choice for a GraphInput | Add a first choice for a GraphInput
| C++ | unlicense | Thooms/yolo-graphs,Thooms/yolo-graphs,Thooms/yolo-graphs | |
982e347c8c357568ddc2831aad25b9e77ae50111 | 1-common-tasks/random/flip-a-biased-coin.cpp | 1-common-tasks/random/flip-a-biased-coin.cpp | // Flip a biased coin
#include <random>
int main()
{
std::random_device random_device;
std::mt19937 random_engine{random_device()};
std::bernoulli_distribution coin_distribution{0.25};
bool outcome = coin_distribution(random_engine);
}
// Generate a random boolean value according to a bernoulli
// distribution.... | Add "flip a biased coin" sample | Add "flip a biased coin" sample
| C++ | cc0-1.0 | brunotag/CppSamples-Samples,darongE/CppSamples-Samples,rollbear/CppSamples-Samples,tmwoz/CppSamples-Samples,vjacquet/CppSamples-Samples,mnpk/CppSamples-Samples,thatbrod/CppSamples-Samples,sftrabbit/CppSamples-Samples | |
07e8cf9d0e4374fd2693859e7173284c6c7d4961 | test_utils/supersonic_test_main.cc | test_utils/supersonic_test_main.cc | // Copyright 2012, Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | // Copyright 2012, Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | Make sure to parse gtest_* flags before other flags when running tests. | Make sure to parse gtest_* flags before other flags when running tests.
| C++ | apache-2.0 | mtanski/supersonic,adfin/supersonic,adfin/supersonic,mtanski/supersonic,mtanski/supersonic |
d07e66d8c4f32281bc94653eefa992b8e35580fc | chrome/browser/ui/proximity_auth/proximity_auth_error_bubble.cc | chrome/browser/ui/proximity_auth/proximity_auth_error_bubble.cc | // Copyright 2015 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/ui/proximity_auth/proximity_auth_error_bubble.h"
#include "base/logging.h"
#if !defined(TOOLKIT_VIEWS)
void ShowProximityAuthEr... | // Copyright 2015 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/ui/proximity_auth/proximity_auth_error_bubble.h"
#include "base/logging.h"
#if !defined(TOOLKIT_VIEWS) || !defined(USE_AURA)
vo... | Fix compile regression after SmartLock error bubble in r313408 | MacViews: Fix compile regression after SmartLock error bubble in r313408
toolkit-views builds on mac are getting:
Undefined symbols for architecture x86_64:
ShowProximityAuthErrorBubble
To fix, move proximity_auth_error_bubble.cc to mac_sources. This works
because the symbol is only referenced on platforms with ex... | C++ | bsd-3-clause | fujunwei/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,fujunwei/chromium-crosswalk,ltilve/chromium,axinging/chromium-crosswalk,Just-D/chromium-1,Pluto-tv/chromium-crosswalk,ltilve/chromium,hgl888/chromium-crosswalk,ltilve/chromium,Pluto-tv/chromium-crosswalk,Fireblend/chromium-crosswalk,Pluto-tv/chromium-crosswal... |
418f73cbaa77470f3546c0acc64cefccedfba991 | lib/Support/IsInf.cpp | lib/Support/IsInf.cpp | //===-- IsInf.cpp ---------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===--------... | Add platform-independent wrapper function for isinf(). Patch contributed by Bill Wendling. | Add platform-independent wrapper function for isinf().
Patch contributed by Bill Wendling.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@15050 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | GPUOpen-Drivers/llvm,apple/swift-llvm,dslab-epfl/asap,chubbymaggie/asap,llvm-mirror/llvm,apple/swift-llvm,chubbymaggie/asap,GPUOpen-Drivers/llvm,chubbymaggie/asap,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,apple/swift-llvm,GPUOpen-Drivers/l... | |
a764f618ef3b3d4bc26aa8509dc5f284c2084ca8 | template_sort.cpp | template_sort.cpp | #include <array>
#include <iostream>
template<typename T, std::size_t N>
typename std::enable_if<N < 128 && std::is_integral<T>::value, void>::type insertion_sort(std::array<T, N>& array) {
for (std::size_t i = 0; i < N; i++) {
for (std::size_t j = i; j > 0 && array[j] < array[j-1]; j--) {
std::swap(array[j], ar... | Add template insertion sort implementation. | Add template insertion sort implementation.
| C++ | apache-2.0 | tisma/ctorious,tisma/ctorious | |
da26470d9cee6d2f90f297b490ab0c6a6bbb6f1a | test/error/cannot_schedule_inlined_stages.cpp | test/error/cannot_schedule_inlined_stages.cpp | #include "Halide.h"
#include <stdio.h>
using namespace Halide;
int main(int argc, char **argv) {
Func f, g;
Var x, y;
f(x) = x;
f(x) += x;
g(x) = f(x);
// f is inlined, so this schedule is bad.
f.vectorize(x, 4);
g.realize(10);
printf("There should have been an error\n");
r... | Add error test for inlined stages | Add error test for inlined stages
Former-commit-id: af3d38c75bfc1411ff46d64446da37878bee33e7 | C++ | mit | Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide | |
98badb84a01314ed6433640584a9ccd9c1d3528c | tree/109.cc | tree/109.cc | /**
* 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) {}
* };
*/
/**
* Definition for a binary tree node.
* struc... | Convert Sorted List to Binary Search Tree | Convert Sorted List to Binary Search Tree
| C++ | apache-2.0 | MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode | |
7e729ebdd6e177b7617266fa1bd07fc9e1e9417e | ios/web/web_state/credential.cc | ios/web/web_state/credential.cc | // Copyright 2015 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 "ios/web/public/web_state/credential.h"
namespace web {
Credential::Credential() = default;
Credential::~Credential() = default;
} // namesp... | // Copyright 2015 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 "ios/web/public/web_state/credential.h"
namespace web {
Credential::Credential() : type(CREDENTIAL_TYPE_EMPTY) {
}
Credential::~Credential() =... | Initialize primitive member of web::Credential. | Initialize primitive member of web::Credential.
BUG=none
Review URL: https://codereview.chromium.org/1149103002
Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#331083}
| C++ | bsd-3-clause | Pluto-tv/chromium-crosswalk,chuan9/chromium-crosswalk,Just-D/chromium-1,Chilledheart/chromium,axinging/chromium-crosswalk,chuan9/chromium-crosswalk,Just-D/chromium-1,Just-D/chromium-1,hgl888/chromium-crosswalk,axinging/chromium-crosswalk,Just-D/chromium-1,Chilledheart/chromium,Pluto-tv/chromium-crosswalk,hgl888/chromiu... |
38d4f6b0fc809255cc6d3870f1ac412b5e2431f4 | chapter21/chapter21_ex04.cpp | chapter21/chapter21_ex04.cpp | // Chapter 21, Exercise 4: implement count_if() yourself and test it
#include "../lib_files/std_lib_facilities.h"
//------------------------------------------------------------------------------
template<class In, class Pred>
int my_count_if(In first, In last, const Pred& p)
{
int ctr = 0;
while (first != l... | Add Chapter 21, exercise 4 | Add Chapter 21, exercise 4
| C++ | mit | bewuethr/stroustrup_ppp,bewuethr/stroustrup_ppp | |
4ea3c680e1ea2fafcf32e14488fb7807bcfe7f38 | topcoder/SRM/145/ImageDithering/ImageDithering/main.cpp | topcoder/SRM/145/ImageDithering/ImageDithering/main.cpp | #include <iostream>
#include <vector>
#include <assert.h>
using namespace std;
class ImageDithering {
public:
int count(string dithered, vector<string> screen) {
unsigned d[26];
for (int i = 0; i < 26; i++) {
d[i] = 0;
}
for (unsigned i = 0; i < dithered.length(); i++) {
d[dithered[i] - '... | Solve SRM 144, Div 2, Problem ImageDithering | Solve SRM 144, Div 2, Problem ImageDithering
| C++ | mit | mathemage/CompetitiveProgramming,mathemage/CompetitiveProgramming,mathemage/CompetitiveProgramming,mathemage/CompetitiveProgramming,mathemage/CompetitiveProgramming,mathemage/CompetitiveProgramming | |
653606d3c8282966a05bc7973fe5e876410dda3c | src/testThrottleCurve.cpp | src/testThrottleCurve.cpp | #include "testHooks.h"
#include "math/Algebra.h"
/**
* Built from a cubic function (a*x^3 + b*x^2 + c*x + d) defined at
* f(-1) = 0
* f( 1) = 1
* f( 0) = hoverPoint
* with the last degree of freedom setting the x^3 vs x balance
* which corresponds to how "linear" the curve is
*/
... | Implement tests and benchmarks for throttleCurve | Implement tests and benchmarks for throttleCurve
| C++ | apache-2.0 | MINDS-i/Drone-Tests,MINDS-i/Drone-Tests,MINDS-i/Drone-Tests | |
cb39ee645a32b7e15a813672ac0acfd7e8dc114b | src/ports/SkMemory_mozalloc.cpp | src/ports/SkMemory_mozalloc.cpp | /*
* 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_throw()... | Add a new SkMemory implementation that uses mozalloc instead of malloc | Add a new SkMemory implementation that uses mozalloc instead of malloc
git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@5292 2bbb7eff-a529-9590-31e7-b0007b416f81
| C++ | bsd-3-clause | VRToxin-AOSP/android_external_skia,Pure-Aosp/android_external_skia,android-ia/platform_external_skia,android-ia/platform_external_skia,Samsung/skia,MinimalOS/external_skia,DiamondLovesYou/skia-sys,Fusion-Rom/external_chromium_org_third_party_skia,TeslaOS/android_external_skia,google/skia,TeamBliss-LP/android_external_s... | |
a61254aead81df894c2eece38fa2fcba881aeed2 | Snippets/foreach.cpp | Snippets/foreach.cpp | #include <iterator>
#define foreach (x,v) for (typeof(v).begin() x=(v).begin(); x!=(v).end(); ++x)
using namespace std;
int main(){
return 0;
}
| Implement good macro for iterate over an array. | Implement good macro for iterate over an array.
| C++ | mit | xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book | |
116b218cb2801870602512dd93c82fadd1b4d1b8 | src/unittest/dijkstra.cpp | src/unittest/dijkstra.cpp | /// \file dijkstra.cpp
///
/// Unit tests for the Dijkstra algorithm
///
#include <iostream>
#include <string>
#include "../algorithms/dijkstra.hpp"
#include "../handle.hpp"
#include "catch.hpp"
#include <sglib/hash_graph.hpp>
namespace vg {
namespace unittest {
using namespace std;
using sglib::HashGraph;
TEST... | Add some tests for Dijkstra search | Add some tests for Dijkstra search
| C++ | mit | ekg/vg,ekg/vg,ekg/vg | |
05fa2b7f82c2440a21e2327ea47196e002cc6d59 | string_view_exception.cpp | string_view_exception.cpp | #include <iostream>
#include <stdexcept>
#include <string_view>
void* operator new(std::size_t n) {
std::cout << "new() " << n << " bytes\n";
return malloc(n);
}
int main() {
std::string_view str_view("abcdef");
try {
for (std::size_t i = 0; true; i++) {
std::cout << i << ": " << str_view.at(i) << '\n';
}... | Add string_view c++17 feature example. Compile with -std=c++17 flags. | Add string_view c++17 feature example.
Compile with -std=c++17 flags.
| C++ | apache-2.0 | tisma/ctorious,tisma/ctorious | |
97edcb639347a4770e59af66d20abcd2b37bb4e5 | test/CodeGenCXX/debug-info-this.cpp | test/CodeGenCXX/debug-info-this.cpp | // RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s
// Radar 9239104
class Class
{
public:
//CHECK: DW_TAG_const_type
int foo (int p) const {
return p+m_int;
}
protected:
int m_int;
};
Class c;
| Add a test case for r128957. It fixed a bug! | Add a test case for r128957. It fixed a bug!
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@128966 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/cl... | |
f8ffdc9d8ceb1dc575df4acbb4fd66ceabd802cb | examples/dump_nested.cc | examples/dump_nested.cc | /*
*
* Example of dumping a map, containing values which are phmap maps or sets
* building this requires c++17 support
*
*/
#include <iostream>
#include <parallel_hashmap/phmap_dump.h>
template <class K, class V>
class MyMap : public phmap::flat_hash_map<K, phmap::flat_hash_set<V>>
{
public:
using Set = phma... | Add example demonstrating saving nested hashmaps to binary file. | Add example demonstrating saving nested hashmaps to binary file.
| C++ | apache-2.0 | greg7mdp/parallel-hashmap | |
2c317b5f2d8a51ea0009caf1256d6355e9188842 | chapter25/chapter25_trythis1.cpp | chapter25/chapter25_trythis1.cpp | // Chapter 25, Try This 1: demonstrate free store fragmentation... not much
// to be seen here!
#include<iostream>
using namespace std;
// type that requires a little more space than a Node
struct Message {
int a;
int b;
int c;
};
// somewhat smaller type, but not half as small as a Message
struct Node ... | Add Chapter 25, Try This 1 | Add Chapter 25, Try This 1
| C++ | mit | bewuethr/stroustrup_ppp,bewuethr/stroustrup_ppp | |
aab25b43767214922f8020261e251e6934164e90 | src/ch03/postexpr.cpp | src/ch03/postexpr.cpp | ///////////////////////////////////////
/// file: postexpr.cpp
/// 计算后缀表达式
///////////////////////////////////////
#include <iostream>
#include "sqstack.h"
using namespace std;
///
/// 执行计算
///
int Operate(int a, char theta, int b)
{
switch(theta) {
case '+': return a+b;
case '-': return a-b;
case '*'... | Add evaluation for postfix expression | Add evaluation for postfix expression
| C++ | mit | zhuangbo/ds-cpp,zhuangbo/ds-cpp,zhuangbo/ds-cpp,zhuangbo/ds-cpp | |
d6e7fae82b857eaeb487ceb591942b8969afdd96 | test/SemaCXX/cxx11-gnu-attrs.cpp | test/SemaCXX/cxx11-gnu-attrs.cpp | // RUN: %clang -cc1 -std=c++11 -verify %s
// Error cases.
[[gnu::this_attribute_does_not_exist]] int unknown_attr;
// expected-warning@-1 {{unknown attribute 'this_attribute_does_not_exist' ignored}}
int [[gnu::unused]] attr_on_type;
// expected-warning@-1 {{attribute 'unused' ignored, because it is not attached to a... | Add extra tests for [[gnu::...]] attributes, missed from r172382. | Add extra tests for [[gnu::...]] attributes, missed from r172382.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@172391 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-cl... | |
b97091c7886bba9d982ab05ac2493536866b2484 | linkedlist/2095.cc | linkedlist/2095.cc | /**
* 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:
ListNode* deleteMiddl... | Delete the Middle Node of a Linked List | Delete the Middle Node of a Linked List
| C++ | apache-2.0 | MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode | |
4dbd088fd7bf72c9c58bebc929256d635e526582 | modules/modpython/compiler.cpp | modules/modpython/compiler.cpp | /*
* Copyright (C) 2004-2011 See the AUTHORS file for details.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <Python.h>
void fail(PyObject* py, int n) {
// Do... | /*
* Copyright (C) 2004-2011 See the AUTHORS file for details.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <Python.h>
#include <string>
void fail(PyObject* p... | Support compiling python modules in cwd | Support compiling python modules in cwd
| C++ | apache-2.0 | znc/znc,kashike/znc,YourBNC/znc,Phansa/znc,Zarthus/znc,jreese/znc,ollie27/znc,markusj/znc,elyscape/znc,Kriechi/znc,aarondunlap/znc,Mkaysi/znc,Phansa/znc,YourBNC/znc,KiNgMaR/znc,Phansa/znc,znc/znc,Phansa/znc,Zarthus/znc,GLolol/znc,trisk/znc,elyscape/znc,Mikaela/znc,aarondunlap/znc,withinsoft/znc,Zarthus/znc,GLolol/znc,m... |
05cb229e58efa052db5acf33be0441f4b4a28e7c | fuzz/oss_fuzz/FuzzPathMeasure.cpp | fuzz/oss_fuzz/FuzzPathMeasure.cpp | /*
* Copyright 2018 Google, LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "../Fuzz.h"
void fuzz_PathMeasure(Fuzz* f);
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
auto fuzz = Fuzz(SkData::MakeWithoutCopy(d... | Add oss-fuzz endpoint for PathMeasure | Add oss-fuzz endpoint for PathMeasure
Bug: skia:
Change-Id: I3e051cefd6861b63bab33a1812674eacf67a35dd
Reviewed-on: https://skia-review.googlesource.com/113748
Reviewed-by: Mike Klein <14574f09dfa9b4e14759b88c3426a495a0e627b0@google.com>
Commit-Queue: Kevin Lubick <7cdab2cfab351f23814786ba39716e90eed69047@google.com>
| C++ | bsd-3-clause | HalCanary/skia-hc,google/skia,HalCanary/skia-hc,google/skia,Hikari-no-Tenshi/android_external_skia,Hikari-no-Tenshi/android_external_skia,rubenvb/skia,HalCanary/skia-hc,google/skia,rubenvb/skia,rubenvb/skia,google/skia,HalCanary/skia-hc,rubenvb/skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,HalCanary/skia-hc... | |
a0d4283d453dfde7b8e6c90090332ffda88b5e0a | test/asan/TestCases/Windows/coverage-dll-stdio.cc | test/asan/TestCases/Windows/coverage-dll-stdio.cc | // Test that coverage and MSVC CRT stdio work from a DLL. This ensures that the
// __local_stdio_printf_options function isn't instrumented for coverage.
// RUN: rm -rf %t && mkdir %t && cd %t
// RUN: %clang_cl_asan -fsanitize-coverage=func -O0 %p/dll_host.cc -Fet.exe
// RUN: %clang_cl_asan -fsanitize-coverage=func -L... | Add a test that uses coverage and printf from a DLL | Add a test that uses coverage and printf from a DLL
This test fails without LLVM r286615
git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@286618 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt | |
12a05bad0e32f9fd591fd8e0978a5efa3aa65a53 | pnumber_loop.cpp | pnumber_loop.cpp | #include <cmath>
#include <ctime>
#include <iostream>
#include <vector>
using namespace std;
vector<long int> primes;
void InitVector(long int s) {
primes.reserve(s/10);
primes.push_back(2);
}
int main(int argc, char const *argv[]) {
clock_t begin = clock();
auto max = 10000000;
auto lprime = 2;
auto b = 1;... | Use addition and multiplication rather than sqrt. Not much to gain. | Use addition and multiplication rather than sqrt. Not much to gain.
| C++ | mit | kometen/pnumber | |
b25df2016c96119fdbd83154498be82e66f320c9 | week2/problem1/point_2d_v1.cpp | week2/problem1/point_2d_v1.cpp | #include <iostream>
#include <cmath>
using namespace std;
struct Point2D {
double x;
double y;
};
Point2D translate(Point2D point, double dx, double dy) {
Point2D translated;
translated.x = point.x + dx;
translated.y = point.y + dy;
return translated;
}
double distanceBetween(Point2D firstPoint, Point... | Add solution to first part of first problem. 2D point structure with outer functions. | Add solution to first part of first problem.
2D point structure with outer functions.
| C++ | mit | dimitaruzunov/oop-practicum-2015-16 | |
294cd8f9a2c97f50c03da4340130984c1eccd83b | dynamic_programing/C++/LongestPalindromeSubsequence.cpp | dynamic_programing/C++/LongestPalindromeSubsequence.cpp | #include <bits/stdc++.h>
#include <stdio.h>
#include <string.h>
using namespace std;
int lps(char *str)
{
int n = strlen(str);
int dp[n][n]; // Create a table to store results of subproblems
// Strings of length 1 are palindrome of length 1
for (int i = 0; i < n; i++)
dp[i][i] = 1;
// Bui... | Add Longest Palindrome Subsequence in DP | Add Longest Palindrome Subsequence in DP
| C++ | cc0-1.0 | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | |
192c4c1d875b2ff146c26d0bb71c703dd429bdda | test/correctness/external_code.cpp | test/correctness/external_code.cpp | #include <stdio.h>
#include "Halide.h"
#include <fstream>
#include <cassert>
#include <iostream>
#include "test/common/halide_test_dirs.h"
using namespace Halide;
int main(int argc, char **argv) {
Var x("x"), y("y");
Func f("f");
f(x, y) = 42;
std::string bitcode_file = Internal::get_test_tmp_dir()... | Add a test for ExternalCode functionality. | Add a test for ExternalCode functionality.
Former-commit-id: 85284b599397bb280d879f9ec99bce9096ed8db4 | C++ | mit | Trass3r/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide | |
1ae8257291afd0ab01c22aecefb07ce2b21922da | 450.cpp | 450.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* deleteNode(TreeNode* root, int key) {
if(!root) return NULL;
if(root-... | Delete Node in a BST | Delete Node in a BST | C++ | mit | zfang399/LeetCode-Problems | |
9efb069926875d7b9177fbfe2bcf91ed8a153543 | DataStructures/Tree/expression_tree.cpp | DataStructures/Tree/expression_tree.cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
struct ExpressionTree {
char expr;
ExpressionTree *left, *right;
ExpressionTree(char opr) : expr(opr) {
left = NULL;
right = NULL;
}
};
bool isOperator(char opr) {
return opr == '+' || opr == '-' || opr == '*'
|| opr == '/' || opr =... | Implement Expression tree to convert post fix expression in to an expression tree | Implement Expression tree to convert post fix expression
in to an expression tree
Signed-off-by: WajahatSiddiqui <3c3ea4adfdf19decee174766aef6add34b32b7f0@gmail.com>
| C++ | apache-2.0 | WajahatSiddiqui/Workspace,WajahatSiddiqui/Workspace,WajahatSiddiqui/Workspace | |
bdf3c4b6d649707bdd98574b41e4d4bd307e0f9e | sky/compositor/opacity_layer.cc | sky/compositor/opacity_layer.cc | // Copyright 2015 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 "sky/compositor/opacity_layer.h"
namespace sky {
namespace compositor {
OpacityLayer::OpacityLayer() {
}
OpacityLayer::~OpacityLayer() {
}
vo... | // Copyright 2015 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 "sky/compositor/opacity_layer.h"
namespace sky {
namespace compositor {
OpacityLayer::OpacityLayer() {
}
OpacityLayer::~OpacityLayer() {
}
vo... | Fix OpacityLayer to blend in the correct direction | Fix OpacityLayer to blend in the correct direction
Fixes #610
| C++ | bsd-3-clause | cdotstout/sky_engine,rmacnak-google/engine,devoncarew/engine,cdotstout/sky_engine,tvolkert/engine,devoncarew/sky_engine,rmacnak-google/engine,lyceel/engine,aam/engine,jason-simmons/flutter_engine,jason-simmons/sky_engine,jamesr/flutter_engine,aam/engine,lyceel/engine,jamesr/sky_engine,jason-simmons/flutter_engine,cdots... |
82bd6a9781a424138e0c607288cf2186f0a8ace3 | problems/multiples-of-3-and-5/multiples-of-3-and-5-2.cpp | problems/multiples-of-3-and-5/multiples-of-3-and-5-2.cpp | #include <iostream>
int sum_of_multiples(int n){
int sum = 0;
for(int i=3;i<n;i++){
if((i%3==0) || (i%5==0))
sum+=i;
}
return sum;
}
int main(){
std::cout << sum_of_multiples(1000);
} | Add C++ solution to multiples of 3 and 5 problem. | Add C++ solution to multiples of 3 and 5 problem.
| C++ | mit | mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-inter... | |
8d873614fd59c8b9d1eb0794d305245559e8bc3b | chapter04/chapter04_ex01.cpp | chapter04/chapter04_ex01.cpp | // 4.1 - determine if a binary tree is balanced, where "balanced" is defined as
// "the subtrees of each node have a height differnce of no more than 1"
// improve to have less calls to height(): have height() return -1 if the Node
// it is called for is not balanced; it knows because it checks the heights of
// both ... | Add Chapter 4, exercise 1 (solution in O(N log N) | Add Chapter 4, exercise 1 (solution in O(N log N)
| C++ | mit | bewuethr/ctci | |
eac6a7c84c35073e97c09536ee9581b0372e13e9 | recursive_algorithms/replace-pi.cpp | recursive_algorithms/replace-pi.cpp | /*
Objective: Given a string, compute recursively a new string where all appearances of "pi" have been replaced by "3.14".
Time Complexity: O(N)
Space Complexity: O(N)
*/
#include <iostream>
using namespace std;
#include <iostream>
using namespace std;
#include <bits/stdc++.h>
void help(char input[], i... | Replace occurrences of "pi" with "3.14" | Replace occurrences of "pi" with "3.14" | C++ | cc0-1.0 | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | |
c1975eb39ac42fe886682b734c0c82e631ff2b95 | test/std2_type_traits_test.cpp | test/std2_type_traits_test.cpp | #include <gtest/gtest.h>
#include "std2_type_traits.hpp"
namespace {
struct NothrowMoveConstructible {
NothrowMoveConstructible(NothrowMoveConstructible&&) noexcept = default;
};
struct ThrowMoveConstructible {
ThrowMoveConstructible(ThrowMoveConstructible&&) {};
};
struct NothrowMoveAssignable {
NothrowMo... | Add std2 type traits tests | Add std2 type traits tests
| C++ | unlicense | KjellKod/concurrent | |
4f03c0b693ea2216959c0336a03114dd4f47cc5b | examples/attributes_example.cpp | examples/attributes_example.cpp | /*
* The MIT License (MIT)
*
* Copyright (c) 2016 Julian Ganz
*
* 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
* to use, ... | Add basic example demonstrating access of attributes | Add basic example demonstrating access of attributes
| C++ | mit | neithernut/cmoh,neithernut/cmoh | |
c6075304cca3d8e48825eda55facaa4d09412a2b | ui/ozone/public/gpu_platform_support.cc | ui/ozone/public/gpu_platform_support.cc | // 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 "ui/ozone/public/gpu_platform_support.h"
#include "base/logging.h"
#include "ui/ozone/ozone_export.h"
namespace ui {
namespace {
// No-op imp... | // 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 "ui/ozone/public/gpu_platform_support.h"
#include "base/logging.h"
#include "ui/ozone/ozone_export.h"
namespace ui {
namespace {
// No-op imp... | Fix Ozone clang build errors | Fix Ozone clang build errors
NOTRY=true
BUG=none
TBR=spang@chromium.org
Review URL: https://codereview.chromium.org/346773005
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@279103 0039d316-1c4b-4281-b951-d872f2087c98
| C++ | bsd-3-clause | littlstar/chromium.src,axinging/chromium-crosswalk,littlstar/chromium.src,TheTypoMaster/chromium-crosswalk,Pluto-tv/chromium-crosswalk,ltilve/chromium,bright-sparks/chromium-spacewalk,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,PeterWangIntel/chromium-crosswalk,littlstar/chromium.src,markYoun... |
9ef0d5220eb9ebd9044b935b62a02b35024f9686 | test/config/main.cc | test/config/main.cc | #include <iostream>
#include <gflags/gflags.h>
DEFINE_string(message, "Hello World!", "The message to print");
int main(int argc, char **argv)
{
gflags::SetUsageMessage("Test CMake configuration of gflags library (gflags-config.cmake)");
gflags::ParseCommandLineFlags(&argc, &argv, true);
std::cout << FLAGS_mess... | #include <iostream>
#include <gflags/gflags.h>
DEFINE_string(message, "Hello World!", "The message to print");
static bool ValidateMessage(const char* flagname, const std::string &message)
{
return !message.empty();
}
DEFINE_validator(message, ValidateMessage);
int main(int argc, char **argv)
{
gflags::SetUsageM... | Add usage of DEFINE_validator to test project | enh: Add usage of DEFINE_validator to test project
| C++ | bsd-3-clause | schuhschuh/gflags,fuchsia-mirror/third_party-gflags,n054/gflags,n054/gflags,fuchsia-mirror/third_party-gflags,gflags/gflags,n054/gflags,gflags/gflags,schuhschuh/gflags,gflags/gflags,fuchsia-mirror/third_party-gflags,schuhschuh/gflags,n054/gflags,gflags/gflags,schuhschuh/gflags,fuchsia-mirror/third_party-gflags |
710118bf5fcf5d6144b680a766015f7625dbb79f | test/asan/TestCases/Windows/use_after_return_linkage.cc | test/asan/TestCases/Windows/use_after_return_linkage.cc | // Make sure LIBCMT doesn't accidentally get added to the list of DEFAULTLIB
// directives. REQUIRES: asan-dynamic-runtime
// RUN: %clang_cl_asan -LD %s | FileCheck %s
// CHECK: Creating library
// CHECK-NOT: LIBCMT
void foo(int *p) { *p = 42; }
__declspec(dllexport) void bar() {
int x;
foo(&x);
}
| Add a test case for r216663 [-Zl vs LIBCMT vs asan_win_uar_thunk] | [ASan/Win] Add a test case for r216663 [-Zl vs LIBCMT vs asan_win_uar_thunk]
git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@216665 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt | |
7a2da6c5a19d7dc43dc981653b3593e4b12f76a2 | test17_31_32.cpp | test17_31_32.cpp | #include <iostream>
#include <random>
#include <string>
using namespace std;
bool play(bool first) {
static default_random_engine e;
static bernoulli_distribution b;
return b(e);
}
int main() {
string resp;
static default_random_engine e;
static bernoulli_distribution b;
... | Add solution for chapter 17 test 31, test 32 | Add solution for chapter 17 test 31, test 32 | C++ | apache-2.0 | chenshiyang/CPP--Primer-5ed-solution | |
0eb24c3dd74c6447d23fed7b51b6a61c43c7a1e6 | math/gss.cpp | math/gss.cpp | double gss(double l, double r) {
double m1 = r-(r-l)/gr, m2 = l+(r-l)/gr;
double f1 = f(m1), f2 = f(m2);
while(fabs(l-r)>EPS) {
if(f1>f2) l=m1, f1=f2, m1=m2, m2=l+(r-l)/gr, f2=f(m2);
else r=m2, f2=f1, m2=m1, m1=r-(r-l)/gr, f1=f(m1);
}
return l;
}
| Add Golden Section Search (Ternary Search) | Add Golden Section Search (Ternary Search)
| C++ | mit | IMEplusplus/ICPC-Notebook | |
4e8bd6e032048b5d634f6f489d869721daccb364 | test/path_aggregation_param.cpp | test/path_aggregation_param.cpp | #include "path_aggregation_test.hpp"
INSTANTIATE_TEST_CASE_P(PathAggregationTest, PathAggregationTest, testing::Combine(
testing::Values(0, 1, 10),
testing::Values(10, 20),
testing::Values(120, 40)
));
| Add file which defines test case | Add file which defines test case
| C++ | apache-2.0 | fixstars/libSGM,fixstars-jp/libSGM | |
ab04a5d06445f09621457df010970aadf86528a0 | Leetcode2/211.cpp | Leetcode2/211.cpp | class Trie{
public:
vector<Trie*> children;
bool wholeWord;
Trie(){
children = vector<Trie*>(26, NULL);
wholeWord = false;
}
};
class WordDictionary {
private:
Trie* root;
public:
WordDictionary(){
root = new Trie();
}
// Adds a word into the data structure.
... | Add and Search Word - Data structure design | Add and Search Word - Data structure design | C++ | mit | nolink/algorithm,nolink/algorithm | |
6b22064bb4d19abff5f53d5f7dcfd721f2208f4d | Tests/UnitTests/Games/GameTests.cpp | Tests/UnitTests/Games/GameTests.cpp | // Copyright (c) 2018 Chris Ohk, Youngjoong Kim, SeungHyun Jeon
// We are making my contributions/submissions to this project solely in our
// personal capacity and are not conveying any rights to any intellectual
// property of any third parties.
#include <Utils/TestUtils.hpp>
#include "gtest/gtest.h"
#include <hsp... | Add unit test for Game to test mulligan process code | test: Add unit test for Game to test mulligan process code
| C++ | mit | Hearthstonepp/Hearthstonepp,Hearthstonepp/Hearthstonepp | |
81358b897a42124f87fa99ef62c50f00c2fd3dc2 | solidutils/test/ConstArray_test.cpp | solidutils/test/ConstArray_test.cpp | /**
* @file ConstArray_test.cpp
* @brief Unit tests for the ConstArray class.
* @author Dominique LaSalle <dominique@solidlake.com>
* Copyright 2018
* @version 1
* @date 2018-11-14
*/
#include "UnitTest.hpp"
#include "ConstArray.hpp"
#include "Array.hpp"
#include <cstdlib>
#include <vector>
namespace sl
{
UNITTE... | Add unit tests for ConstArray | Add unit tests for ConstArray
| C++ | mit | solidlake/solidutils | |
70e875a76998ad02988c9d1e39ac6f6df579815f | src/ports/SkMemory_mozalloc.cpp | src/ports/SkMemory_mozalloc.cpp | /*
* 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_throw()... | Add a new SkMemory implementation that uses mozalloc instead of malloc | Add a new SkMemory implementation that uses mozalloc instead of malloc
git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@5292 2bbb7eff-a529-9590-31e7-b0007b416f81
| C++ | bsd-3-clause | mrobinson/skia,mrobinson/skia,Cue/skia,mrobinson/skia,Cue/skia,Cue/skia,mrobinson/skia,metajack/skia,Cue/skia,metajack/skia,mrobinson/skia,metajack/skia,metajack/skia | |
21124b2f6eb49b5c25f605bff302293ef8b859a1 | tests/bits/find_cell_4.cc | tests/bits/find_cell_4.cc | //---------------------------- find_cell_1.cc ---------------------------
// $Id$
// Version: $Name$
//
// Copyright (C) 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// to the f... | Add a test that presently fails. | Add a test that presently fails.
git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@12882 0785d39b-7218-0410-832d-ea1e28bc413d
| C++ | lgpl-2.1 | naliboff/dealii,angelrca/dealii,andreamola/dealii,flow123d/dealii,gpitton/dealii,sairajat/dealii,spco/dealii,ibkim11/dealii,YongYang86/dealii,ibkim11/dealii,JaeryunYim/dealii,nicolacavallini/dealii,rrgrove6/dealii,EGP-CIG-REU/dealii,rrgrove6/dealii,adamkosik/dealii,mtezzele/dealii,ibkim11/dealii,YongYang86/dealii,jperr... | |
b89baeb06da160467d993b8f0bc3b2284d877eb4 | dynamic_programing/C++/Max_Weighted_Independent_Subseq.cpp | dynamic_programing/C++/Max_Weighted_Independent_Subseq.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int *W, *A, N;
cin >> N;
W = new int[N + 1];
A = new int[N + 1];
for (int i = 1; i < N + 1; i++)
{
cin >> W[i];
}
A[0] = 0;
A[1] = W[1];
for (int i = 2; i < N + 1; i++)
{
A[i] = max(A[i - 1], A[i - 2] + W[i]);
}
... | Add an implementation of Maximum Weight Independent Subsequence in CPP | Add an implementation of Maximum Weight Independent Subsequence in CPP
| C++ | cc0-1.0 | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | |
cf0524e89be2f9d871e1da2ae5d7efb69fa0b660 | boost/two_dim_rand.cpp | boost/two_dim_rand.cpp | // two_dim_rand.cpp
//
#include <iostream>
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/random.hpp>
double on_circle_prob(double x, double y)
{
static const double k_delta = 0.01;
if (std::abs(x*x + y*y - 1) <= k_delta)
return 1.0;
else
return 0;
}
int main(... | Implement a simple two-dimension point generation procedure with regard to certain probability function, with the help of discrete_distribution | Implement a simple two-dimension point generation procedure with regard to certain probability function, with the help of discrete_distribution
| C++ | mit | uwydoc/the-practices,uwydoc/the-practices,uwydoc/the-practices,uwydoc/the-practices,uwydoc/the-practices,uwydoc/the-practices,uwydoc/the-practices | |
8494809f6ade13e44eb53cc9e16b54bf18f23a6f | FastFourierTransform/Inverse_FFT.cpp | FastFourierTransform/Inverse_FFT.cpp | /*
* @author Abhishek Datta
* @github_id abdatta
* @since 15th October, 2017
*
* The following algroithm takes complex coeeficients
* and calculates its inverse discrete fourier transform
*/
#include <complex>
#include <iostream>
#include <iomanip>
#include <valarray>
const double PI = std::acos(-1);
typedef std::... | Add algorithm for Inverse FFT | Add algorithm for Inverse FFT
| C++ | apache-2.0 | Astrophilic/Algorithms_Example,maazsq/Algorithms_Example,alok760/Algorithms_Example,maazsq/Algorithms_Example,AtoMc/Algorithms_Example,xiroV/Algorithms_Example,AtoMc/Algorithms_Example,churrizo/Algorithms_Example,Thuva4/Algorithms_Example,maazsq/Algorithms_Example,pranjalrai/Algorithms_Example,xiroV/Algorithms_Example,... | |
bd48b4b840925e4f2c7190548b6b77472602f630 | f80789_1b.cpp | f80789_1b.cpp | #include <cstdio>
#include <cmath>
using namespace std;
int a[1000010];
bool is_prime(int number)
{
if (number < 2) return false;
double root = sqrt(number);
for (int i = 2; i <= root; i++)
{
if (number % i == 0) return false;
}
return true;
}
int main()
{
for (int i = 1; i <= 1000000; i++)
{
... | Add a solution for task 1b | Add a solution for task 1b
| C++ | mit | ralcho/AdvancedProgrammingNBU | |
1c757f624392c29ffbfb6714f7db75d2985c1c6c | array/80.cc | array/80.cc | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int index = 1;
int cur_count = 1;
int total = nums.size();
for (int i = 1; i < total; ++i) {
if (nums[i] == nums[i-1]) {
++cur_count;
if (cur_count <= 2) {
... | Remove Duplicates from Sorted Array II | Remove Duplicates from Sorted Array II
| C++ | apache-2.0 | MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode | |
9c47146cfe84a5d04144506f7a0802ed8502edac | geometry/intersection/sphere_plane_demo.cc | geometry/intersection/sphere_plane_demo.cc | #include "eigen.hh"
#include "geometry/intersection/sphere_plane.hh"
#include "geometry/rotation_to.hh"
#include "geometry/shapes/circle.hh"
#include "geometry/shapes/halfspace.hh"
#include "geometry/shapes/sphere.hh"
#include "viewer/primitives/simple_geometry.hh"
#include "viewer/window_3d.hh"
namespace geometry {... | Add a simple demo for sphere-plane intersection | Add a simple demo for sphere-plane intersection
| C++ | mit | jpanikulam/experiments,jpanikulam/experiments,jpanikulam/experiments,jpanikulam/experiments | |
2f6c725278ed874d478cf0f9980f5066680bfda7 | 1-common-tasks/input-streams/read-line-of-integers-into-container.cpp | 1-common-tasks/input-streams/read-line-of-integers-into-container.cpp | // Read a line of integers into a container
#include <vector>
#include <sstream>
#include <iterator>
int main()
{
std::istringstream stream{"4 36 72 8"};
std::vector<int> values;
std::copy(std::istream_iterator<int>{stream},
std::istream_iterator<int>{},
std::back_inserter(values));
}
// Re... | Add "read line of integers" sample | Add "read line of integers" sample
| C++ | cc0-1.0 | brunotag/CppSamples-Samples,vjacquet/CppSamples-Samples,tmwoz/CppSamples-Samples,darongE/CppSamples-Samples,mnpk/CppSamples-Samples,thatbrod/CppSamples-Samples,rollbear/CppSamples-Samples,sftrabbit/CppSamples-Samples | |
69067991810a04fe1d36bbcc0abea526eb2e9f3a | tests/compiler/label_address.cpp | tests/compiler/label_address.cpp | //
// Copyright 2013 Jeff Bush
//
// 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 agreed t... | Test for address of label operator. | Test for address of label operator.
| C++ | apache-2.0 | FulcronZ/NyuziProcessor,jbush001/NyuziProcessor,FulcronZ/NyuziProcessor,hoangt/NyuziProcessor,FulcronZ/NyuziProcessor,jbush001/NyuziProcessor,FulcronZ/NyuziProcessor,hoangt/NyuziProcessor,hoangt/NyuziProcessor,jbush001/NyuziProcessor,jbush001/NyuziProcessor,jbush001/NyuziProcessor,hoangt/NyuziProcessor,jbush001/NyuziPr... | |
529d0e528b9a4c8dba6e22e50e10a4b606925f56 | ssh/ssh_algorithm_negotiation.cc | ssh/ssh_algorithm_negotiation.cc | #include <map>
#include <common/buffer.h>
#include <common/endian.h>
#include <ssh/ssh_algorithm_negotiation.h>
#include <ssh/ssh_protocol.h>
namespace {
static uint8_t constant_cookie[16] = {
0x00, 0x10, 0x20, 0x30,
0x40, 0x50, 0x60, 0x70,
0x80, 0x90, 0xa0, 0xb0,
0xc0, 0xd0, 0xe0, 0xf0
};
template<typen... | Add file missed in r884: initial sketching of algorithm negotiation initialization. | Add file missed in r884: initial sketching of algorithm negotiation initialization.
| C++ | bsd-2-clause | wanproxy/wanproxy,wanproxy/wanproxy,wanproxy/wanproxy | |
41bf813c931ad2da335711fd03e26237102f4d8a | tests/formats/xyz.cpp | tests/formats/xyz.cpp | #include "catch.hpp"
#include "Harp.hpp"
using namespace harp;
#define XYZDIR SRCDIR "/files/xyz/"
TEST_CASE("Read files in XYZ format", "[XYZ]"){
auto file = Trajectory(XYZDIR"helium.xyz");
Frame frame;
SECTION("Stream style reading"){
file >> frame;
CHECK(frame.natoms() == 125);
... | Add first test for XYZ format | Add first test for XYZ format
| C++ | bsd-3-clause | lscalfi/chemfiles,Luthaf/Chemharp,chemfiles/chemfiles,lscalfi/chemfiles,chemfiles/chemfiles,chemfiles/chemfiles,Luthaf/Chemharp,lscalfi/chemfiles,lscalfi/chemfiles,Luthaf/Chemharp,chemfiles/chemfiles | |
ec43838babd9d94554121da2cb27748d9e95ebf6 | cpp/003_Longest_Substring_Without_Repeating_Characters.cpp | cpp/003_Longest_Substring_Without_Repeating_Characters.cpp | // 3. Longest Substring Without Repeating Characters
/**
* Given a string, find the length of the longest substring without repeating characters.
*
* Examples:
*
* Given "abcabcbb", the answer is "abc", which the length is 3.
*
* Given "bbbbb", the answer is "b", with the length of 1.
*
* Given "pwwkew", t... | Add Solution for 3. Longest Substring Without Repeating Characters | Add Solution for 3. Longest Substring Without Repeating Characters
| C++ | mit | kuangami/LeetCode,kuangami/LeetCode,kuangami/LeetCode | |
927fec3c3846369a834a15cbf216b5b5fc9a1491 | lib/Analysis/ProfileInfoLoaderPass.cpp | lib/Analysis/ProfileInfoLoaderPass.cpp | //===- ProfileInfoLoaderPass.cpp - LLVM Pass to load profile info ---------===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===--------... | Add skeleton profileinfoloader pass. This will be enhanced to actually LOAD a profile tommorow. :) | Add skeleton profileinfoloader pass. This will be enhanced to actually LOAD
a profile tommorow. :)
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@11318 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | GPUOpen-Drivers/llvm,llvm-mirror/llvm,chubbymaggie/asap,chubbymaggie/asap,GPUOpen-Drivers/llvm,llvm-mirror/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,chubbymaggie/asap,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,apple/swift-llvm,apple/swift-llvm,dslab-epfl/asap,dslab-epfl/asap,a... | |
c0e4184627d833a56301eff2b2ed7629029180ac | chrome/browser/ui/toolbar/test_toolbar_model.cc | chrome/browser/ui/toolbar/test_toolbar_model.cc | // Copyright 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/ui/toolbar/test_toolbar_model.h"
TestToolbarModel::TestToolbarModel()
: ToolbarModel(),
should_replace_url_(false),
... | // Copyright 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/ui/toolbar/test_toolbar_model.h"
#include "grit/theme_resources.h"
TestToolbarModel::TestToolbarModel()
: ToolbarModel(),
... | Use a reasonable default for the icon value in TestToolbarModel. | Use a reasonable default for the icon value in TestToolbarModel.
ToolbarModel's GetIcon method returns a resource ID, so the TestToolbarModel should be initialized with a valid resource ID for |icon_|. This CL updates the TestToolbarModel to return IDR_LOCATION_BAR_HTTP by default instead of 0, which is never valid.
... | C++ | bsd-3-clause | ChromiumWebApps/chromium,hgl888/chromium-crosswalk-efl,Jonekee/chromium.src,crosswalk-project/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,hgl888/chromium-crosswalk-efl,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,hgl888/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,dednal/chromium... |
7bdd1fe8982075c30e423dc04940ad086fed3af2 | src/test/googletests/GooleTestMain.cpp | src/test/googletests/GooleTestMain.cpp | /* ---------------------------------------------------------------------
* Numenta Platform for Intelligent Computing (NuPIC)
* Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
* with Numenta, Inc., for a separate license for this software code, the
* following terms and conditions apply:
*
* This ... | Add the main() for google tests | Add the main() for google tests
| C++ | agpl-3.0 | ywcui1990/nupic.core,lscheinkman/nupic.core,lscheinkman/nupic.core,ywcui1990/nupic.core,numenta/htmresearch-core,brev/nupic.core,EricSB/nupic.core,neuroidss/nupic.core,rcrowder/nupic.core,numenta/htmresearch-core,breznak/nupic.core,sambitgaan/nupic.core,neuroidss/nupic.core,brev/nupic.core,sambitgaan/nupic.core,lschein... | |
7081fc1306676a4bb289c131514cf680a3e4d9c3 | c++/problem_25.cpp | c++/problem_25.cpp | // Copyright 2016 Mitchell Kember. Subject to the MIT License.
// Project Euler: Problem 25
// 1000-digit Fibonacci number
#include <gmpxx.h>
namespace problem_25 {
long solve() {
mpz_class first(1);
mpz_class second(1);
mpz_class power_of_ten(10);
mpz_class* a = &first;
mpz_class* b = &second;
long index = 1... | Solve problem 25 in C++ | Solve problem 25 in C++
| C++ | mit | mk12/euler,mk12/euler | |
8cc6e02b3a689b773cbfe5e2a4a89987e6b54250 | test16_34.cpp | test16_34.cpp | #include <iostream>
#include <string>
using namespace std;
template <typename T>
int compare(const T &l , const T &r) {//remove the &, then works.
if(l > r) return 1;
if(r > l) return -1;
return 0;
}
int main() {
// cout << compare("hi", "world");
cout << compare("bye", "dad");
... | Add solution for chapter 16 test 34 | Add solution for chapter 16 test 34 | C++ | apache-2.0 | chenshiyang/CPP--Primer-5ed-solution | |
85284b599397bb280d879f9ec99bce9096ed8db4 | test/correctness/external_code.cpp | test/correctness/external_code.cpp | #include <stdio.h>
#include "Halide.h"
#include <fstream>
#include <cassert>
#include <iostream>
#include "test/common/halide_test_dirs.h"
using namespace Halide;
int main(int argc, char **argv) {
Var x("x"), y("y");
Func f("f");
f(x, y) = 42;
std::string bitcode_file = Internal::get_test_tmp_dir()... | Add a test for ExternalCode functionality. | Add a test for ExternalCode functionality.
| C++ | mit | kgnk/Halide,psuriana/Halide,psuriana/Halide,psuriana/Halide,kgnk/Halide,kgnk/Halide,kgnk/Halide,kgnk/Halide,psuriana/Halide,kgnk/Halide,kgnk/Halide,psuriana/Halide,kgnk/Halide,psuriana/Halide,psuriana/Halide | |
827eb25a8fff73d41ef99e8c56c0a0e3c14e086f | 2013-05-01-Power_Crisis/kevinwortman.cpp | 2013-05-01-Power_Crisis/kevinwortman.cpp |
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;
const int MAX_N = 100;
// We will put the regions in a circular doubly linked list.
struct Region {
int id;
Region *prev, *next;
};
int main() {
while (true) {
int N;
cin >> N;
if (N == 0)
break;
// Allocate ... | Add linked list based solution | Add linked list based solution
| C++ | mit | acm-csuf/icpc,acm-csuf/icpc,acm-csuf/icpc | |
3f80a036b0059328f5ca5dc89f000df481490f8e | 777.cpp | 777.cpp | class Solution {
public:
bool canTransform(string start, string end) {
int i = 0, j = 0, n = start.length();
while(j < n && i < n){
while(j < n && end[j] == 'X') j++;
while(i < n && start[i] == 'X') i++l
if(i == n && j == n) break;
if(i == n || j == n... | Swap Adjacent in LR String | Swap Adjacent in LR String | C++ | mit | zfang399/LeetCode-Problems | |
3a6d845d0cffc7c4c26bcab5f91965bb6641c721 | src/test/agrad/rev/matrix/inverse_spd_test.cpp | src/test/agrad/rev/matrix/inverse_spd_test.cpp | #include <stan/math/matrix/inverse_spd.hpp>
#include <stan/math/matrix/multiply.hpp>
#include <gtest/gtest.h>
#include <test/agrad/util.hpp>
#include <stan/agrad/agrad.hpp>
#include <stan/agrad/matrix.hpp>
#include <stan/agrad/rev/print_stack.hpp>
TEST(AgradRevMatrix,inverse_spd_val) {
using stan::math::inverse_spd;... | Add unit test for inverse_spd. | Add unit test for inverse_spd.
| C++ | bsd-3-clause | stan-dev/stan,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/stan,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/stan,stan-dev/stan,stan-dev/math,stan-dev/math,stan-dev/stan | |
1851715dd6e2111e4c503f473f7bd4917df0ff7b | test/SemaCXX/cxx1y-init-captures.cpp | test/SemaCXX/cxx1y-init-captures.cpp | // RUN: %clang_cc1 -std=c++1y %s -verify
// expected-no-diagnostics
namespace variadic_expansion {
void f(int &, char &);
template <typename ... T> void g(T &... t) {
f([&a(t)]()->decltype(auto) {
return a;
}() ...);
}
void h(int i, char c) { g(i, c); }
}
| Add extra testing for init-captures. | Add extra testing for init-captures.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@191608 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-cl... | |
258d7f406146fb29b333516105dc285476b52297 | test/SemaCXX/many-template-parameter-lists.cpp | test/SemaCXX/many-template-parameter-lists.cpp | // RUN: %clang_cc1 -fsyntax-only -verify %s
// This is not well-formed C++ but used to crash in sema.
template <class T>
struct X {
template <class U>
struct A { // expected-note {{not-yet-instantiated member is declared here}}
template <class V>
struct B {
template <class W>
struct C {
... | Add a crazy test case for r243987 | [Sema] Add a crazy test case for r243987
It's not valid code (maybe it can be made valid, but I'm not sure how).
To trigger the crash fixed in r243987 requires a friend function with
more than four template parameter lists. With this test we have at least
some coverage.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d... | C++ | apache-2.0 | apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/cl... | |
2a91a30478921b9c69363d6cc5311d24912f8a33 | test/hook_tests.cc | test/hook_tests.cc | /* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
#include "catch.hpp"
#include "hooks.hh"
static int i;
void inc_i(vick::contents&) { ++i; }
TEST_CASE("hook proc", "[hook]") {
vick::hook h;
vick::contents c;
h.add(inc_i);
int li = i;
h.p... | Add tests for hook class | Add tests for hook class
| C++ | mpl-2.0 | czipperz/vick,czipperz/vick | |
55226a225761eaa6978eb3de088baef736e8b82c | t/mock_player.cpp | t/mock_player.cpp | #include "mock_player.hpp"
#include <ctime>
#include <boost/random/discrete_distribution.hpp>
#include "logger.hpp"
#include "walk_move.hpp"
#include "wall_move.hpp"
#include "exception.hpp"
static boost::log::sources::severity_logger<boost::log::trivial::severity_level> lg;
namespace Quoridor {
MockPlayer::MockP... | #include "mock_player.hpp"
#include <ctime>
#include <boost/random/discrete_distribution.hpp>
#include "logger.hpp"
#include "walk_move.hpp"
#include "wall_move.hpp"
#include "exception.hpp"
static boost::log::sources::severity_logger<boost::log::trivial::severity_level> lg;
namespace Quoridor {
MockPlayer::MockP... | Check available moves in MockPlayer | Check available moves in MockPlayer
| C++ | mit | sfod/quoridor |
6dc4c3566bae0f08886fe40628fb27d2761ed289 | problems/integer-length/integer-length.cpp | problems/integer-length/integer-length.cpp | #include <iostream>
//Function to calculate number of integers in a given number.
int integer_length(long long int n){
int length = 0;
while (n!=0){
length++;
n=n/10;
}
return length;
}
//Driver function.
int main(){
std::cout << integer_length(34) << std::endl;
std::cout << in... | Add C++ solution to the interger-length problem. | Add C++ solution to the interger-length problem.
| C++ | mit | mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-inter... | |
cfff213109afa7e1b45ac8a85a96d304541380b3 | C++/017_Letter_Combinations_of_a_Phone_Number.cpp | C++/017_Letter_Combinations_of_a_Phone_Number.cpp | // 17. Letter Combinations of a Phone Number
/**
* Given a digit string, return all possible letter combinations that the number could represent.
*
* A mapping of digit to letters (just like on the telephone buttons) is given below.
*
* 1() 2(abc) 3(def)
* 4(ghi) 5(jkl) 6(mno)
* 7(pqrs) 8(tuv) 9(wxyz)
... | Add Solution for Problem 017 | Add Solution for Problem 017
| C++ | mit | FreeTymeKiyan/LeetCode-Sol-Res,bssrdf/LeetCode-Sol-Res,FreeTymeKiyan/LeetCode-Sol-Res,bssrdf/LeetCode-Sol-Res | |
87d02d07921b608921aac2b1668991d12efedd27 | example/utility.cpp | example/utility.cpp | #include <iostream>
#include <iterator>
#include <vector>
#include <list>
#include <algorithm>
#include "../utility.h"
#include "../random.h"
template<typename IteratorT>
void print(const range<IteratorT>& r)
{
for (auto x : r)
std::cout << x << " ";
std::cout << std::endl;
}
template<typename Iterat... | Add examples on the use of class range | Add examples on the use of class range
| C++ | mit | juroland/maze | |
ef9675783b081755ec75fcf800d8aa03bee52587 | chapter24/chapter24_trythis1.cpp | chapter24/chapter24_trythis1.cpp | // Chapter 23, Try This 1: replace 333 in example with 10
#include<iostream>
#include<iomanip>
int main()
{
float x = 1.0/10;
float sum = 0;
for (int i = 0; i<10; ++i) sum += x;
std::cout << std::setprecision(15) << sum << '\n';
} | Add Chapter 24, Try This 1 | Add Chapter 24, Try This 1
| C++ | mit | bewuethr/stroustrup_ppp,bewuethr/stroustrup_ppp | |
44d2c4d2ad73a1f5dc7d50e7ae31b69c6919136c | unittests/block_tests.cpp | unittests/block_tests.cpp | /**
* @file
* @copyright defined in eos/LICENSE.txt
*/
#include <boost/test/unit_test.hpp>
#include <eosio/testing/tester.hpp>
using namespace eosio;
using namespace testing;
using namespace chain;
BOOST_AUTO_TEST_SUITE(block_tests)
BOOST_AUTO_TEST_CASE(block_with_invalid_tx_test)
{
tester main;
// Firs... | Add push block with invalid transaction test | Add push block with invalid transaction test
| C++ | mit | EOSIO/eos,EOSIO/eos,EOSIO/eos,EOSIO/eos,EOSIO/eos | |
53930f6d0870b65553f663a2094ca39c3f4bdc98 | lib/Support/Hashing.cpp | lib/Support/Hashing.cpp | //===-------------- lib/Support/Hashing.cpp -------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | Add the source file with trivial definitions in it that was missing from r151822, sorry sorry. =[ | Add the source file with trivial definitions in it that was missing from
r151822, sorry sorry. =[
We need 'git svn nothave' or some such...
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@151824 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | apple/swift-llvm,dslab-epfl/asap,llvm-mirror/llvm,chubbymaggie/asap,GPUOpen-Drivers/llvm,chubbymaggie/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,dslab-epfl/asap,dslab-epfl/asap,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,dslab-epfl/a... | |
b154063c70234074ec26e5355adec1aa1ca7382c | test/Driver/clang-exception-flags.cpp | test/Driver/clang-exception-flags.cpp | // RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=DEFAULT
// DEFAULT: "-cc1" {{.*}} "-fcxx-exceptions" "-fexceptions"
//
// RUN: %clang -### -fexceptions %s 2>&1 | FileCheck %s -check-prefix=ON1
// ON1: "-cc1" {{.*}} "-fcxx-exceptions" "-fexceptions"
//
// RUN: %clang -### -fno-exceptions -fcxx-exceptions %s 2>&... | Add a test case that would have caught the bug fixed in r126640. | Add a test case that would have caught the bug fixed in r126640.
I've only covered C++'s flags here, we should probably do something
similar for ObjC flags.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@126641 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-cl... | |
6e7492cd1226d1a698edd81fc2a9b633190b4777 | allocore/examples/simulation/levyFlight.cpp | allocore/examples/simulation/levyFlight.cpp | /*
Allocore Example: Lévy flight
Description:
A Lévy flight is a random walk where the step size is determined by a function
that is heavy-tailed. This example uses a Cauchy distribution.
Author:
Lance Putnam, 9/2011
*/
#include "allocore/io/al_App.hpp"
using namespace al;
class MyApp : public App{
public:
RingBu... | Add Levy flight example back; updated to use al::RingBuffer | Add Levy flight example back; updated to use al::RingBuffer
| C++ | bsd-3-clause | AlloSphere-Research-Group/AlloSystem,AlloSphere-Research-Group/AlloSystem,AlloSphere-Research-Group/AlloSystem,AlloSphere-Research-Group/AlloSystem,AlloSphere-Research-Group/AlloSystem | |
51bf56aa2a095bbe8db8ac9f9839548d650c4779 | cpp/functionPointer.cpp | cpp/functionPointer.cpp | #include <iostream>
#include <cmath>
using namespace std;
double integrate(double (*f)(double x), double a, double b)
{
int N = 10;
double h = (b-a)/N;
double integral = 0.0;
for(int i=0; i<N; i++)
{
double x = a + (i+0.5)*h;
integral += (*f)(x)*h;
}
return integral;
}
int main()
{
cout << integrate(ex... | Add file to demonstrate use of function pointer. | Add file to demonstrate use of function pointer.
| C++ | mit | anushkrish/examples,anushkrish/examples,anushkrish/examples,anushkrish/examples | |
04cae6aaf909ce85305662f49d3b7c83543ac58c | flash-graph/test/test_kmeans_coordinator.cpp | flash-graph/test/test_kmeans_coordinator.cpp | /**
* Copyright 2014 Open Connectome Project (http://openconnecto.me)
* Written by Disa Mhembere (disa)
*
* This file is part of FlashGraph.
*
* 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 Licen... | Test for kmeans coordinator added | [Test]: Test for kmeans coordinator added
| C++ | apache-2.0 | icoming/FlashGraph,icoming/FlashGraph,icoming/FlashGraph,icoming/FlashGraph,icoming/FlashGraph | |
6eef7912616f3d3a8cab2acc070c3a8267bea556 | mp-test.cpp | mp-test.cpp | // Test if message passing works
// Should on x86, not on arm
// Basically always just doesn't see the write at all.
// Probably need to loop.
#include <atomic>
#include <stdio.h>
// Note that writing the test in C++ is kind of bogus, since
// the *compiler* can reorder.
std::atomic<long> data = {0};
std::atomic<long... | Add a test for message passing. | Add a test for message passing.
| C++ | mit | msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler | |
33e0df13d9f9a38938665640ac407006689c48b0 | src/unittest/stream.cpp | src/unittest/stream.cpp | /// \file stream.cpp
///
/// Unit tests for stream functions
#include "../stream.hpp"
#include "vg.pb.h"
#include "catch.hpp"
#include <sstream>
#include <iostream>
namespace vg {
namespace unittest {
using namespace std;
TEST_CASE("Protobuf messages that are all default can be stored and retrieved", "[stream]"... | Add tests showing we discard all-default messages | Add tests showing we discard all-default messages
| C++ | mit | ekg/vg,ekg/vg,ekg/vg | |
7490caa65f86ab51944be20cf00b4a7cf175670a | test/SemaCXX/diagnose_if-ext.cpp | test/SemaCXX/diagnose_if-ext.cpp | // RUN: %clang_cc1 -Wpedantic -fsyntax-only %s -verify
void foo() __attribute__((diagnose_if(1, "", "error"))); // expected-warning{{'diagnose_if' is a clang extension}}
void foo(int a) __attribute__((diagnose_if(a, "", "error"))); // expected-warning{{'diagnose_if' is a clang extension}}
// FIXME: When diagnose_if ge... | Add a test for diagnose_if. | Add a test for diagnose_if.
Forgot to add this file as a part of r291418.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@291493 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-cl... | |
a8ac8beb6218aa000d8abbd61993b85ccaf3be2e | tutorial/profile/StressTest.cc | tutorial/profile/StressTest.cc | #include <ctime>
#include <iostream>
#include "PremModel.h"
#include "PMNS_Fast.h"
using namespace std;
int main(int argc, char **argv){
int minM = 0;
int maxM = 2;
if(argc>1){
string test = argv[1];
if(test=="new") maxM = 1;
if(test=="old") minM = 1;
}
int ntries = 1e4;
if(maxM-minM<2) n... | Add macro to compare old and new propagation methods | Add macro to compare old and new propagation methods
| C++ | mit | joaoabcoelho/OscProb,joaoabcoelho/OscProb | |
1d43f8dfc3396389538cbfa1478bfeabb2f82fd0 | test/PCH/chain-typo-corrections.cpp | test/PCH/chain-typo-corrections.cpp | // RUN: %clang_cc1 -verify -chain-include %s %s
// PR 14044
#ifndef PASS1
#define PASS1
class S {
void f(struct Test);
};
#else
::Tesy *p; // expected-error {{did you mean 'Test'}}
// expected-note@-4 {{'Test' declared here}}
#endif
| Add the test case from PR 14044 to ensure it doesn't regress. | Add the test case from PR 14044 to ensure it doesn't regress.
The test started working at some point, presumably fixed through the
delayed typo correction work.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@236883 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-cl... | |
58d30f1f5d4cf4c12f7bd35730bca12e3901fd07 | chromeos/dbus/ibus/mock_ibus_engine_service.cc | chromeos/dbus/ibus/mock_ibus_engine_service.cc | // 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 "chromeos/dbus/ibus/mock_ibus_engine_service.h"
namespace chromeos {
MockIBusEngineService::MockIBusEngineService() {
}
MockIBusEngineServ... | // 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 "chromeos/dbus/ibus/mock_ibus_engine_service.h"
namespace chromeos {
MockIBusEngineService::MockIBusEngineService() {
}
MockIBusEngineServ... | Add a missing implementation of CommitText in MockIBusEngineService. | chromeos: Add a missing implementation of CommitText in MockIBusEngineService.
BUG=none
Review URL: https://codereview.chromium.org/12668020
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@190731 0039d316-1c4b-4281-b951-d872f2087c98
| C++ | bsd-3-clause | ltilve/chromium,axinging/chromium-crosswalk,patrickm/chromium.src,patrickm/chromium.src,ChromiumWebApps/chromium,bright-sparks/chromium-spacewalk,Just-D/chromium-1,Jonekee/chromium.src,PeterWangIntel/chromium-crosswalk,ltilve/chromium,jaruba/chromium.src,dushu1203/chromium.src,ltilve/chromium,hgl888/chromium-crosswalk,... |
ea43b09e6949c78a487a655be4a82cc6ba693f20 | src/clt.cpp | src/clt.cpp | #include "test.h"
#include "lcg.h"
// By central limiting theorem,
// U ~ [0, 1]
// S = sum U_i for i = 1 to M
// S ~ N(M / 2, M / 12)
// Z = (S - M / 2) / sqrt(M / 12)
// Z ~ N(0, 1)
template <class T, class RNG, int M>
static inline T clt(RNG& r) {
static T inv = 1 / std::sqrt(T(M) / 12);
T sum = 0;
for (int i ... | Add central limiting theorem method | Add central limiting theorem method
| C++ | mit | miloyip/normaldist-benchmark,miloyip/normaldist-benchmark,miloyip/normaldist-benchmark,miloyip/normaldist-benchmark,miloyip/normaldist-benchmark | |
832c0540ba37dc1c1ad7961f4232b2737aafe625 | cpp/fatorial_template.cpp | cpp/fatorial_template.cpp | #include <iostream>
template <int N>
int fat() {
return N * fat<N-1>();
}
template <>
int fat<1>() {
return 1;
}
int main() {
const int fat5 = fat<5>();
std::cout << fat5 << std::endl;
}
| Add c++ fatorial template meta programming example | Add c++ fatorial template meta programming example
| C++ | mit | alexhausen/examples,alexhausen/examples,alexhausen/examples,alexhausen/examples,alexhausen/examples,alexhausen/examples,alexhausen/examples,alexhausen/examples,alexhausen/examples,alexhausen/examples,alexhausen/examples | |
6478f6d6c100576cc03dbfb425d1de015645f124 | test/src/dbn_sgd_perf.cpp | test/src/dbn_sgd_perf.cpp | //=======================================================================
// Copyright (c) 2014-2016 Baptiste Wicht
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
// http://opensource.org/licenses/MIT)
//==================================================================... | Prepare test case for performance test of SGD | Prepare test case for performance test of SGD
| C++ | mit | wichtounet/dll,wichtounet/dll,wichtounet/dll | |
fb41ca2ede8c29a5bc4871edd19e6371f8788674 | leetcode/EditDistance.cpp | leetcode/EditDistance.cpp | #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
using namespace std;
// dist[i][j] = the dist betw... | Edit distance, classic problem, need to recheck | Edit distance, classic problem, need to recheck
| C++ | agpl-3.0 | python27/AlgorithmSolution,python27/AlgorithmSolution,python27/AlgorithmSolution,python27/AlgorithmSolution,python27/AlgorithmSolution | |
ce2dfcc2209c7e6702614768ecb4c61df0abffc8 | ui/base/win/dpi_setup.cc | ui/base/win/dpi_setup.cc | // Copyright (c) 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 "ui/base/win/dpi_setup.h"
#include "ui/base/layout.h"
#include "ui/gfx/display.h"
#include "ui/gfx/win/dpi.h"
namespace ui {
namespace win ... | // Copyright (c) 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 "ui/base/win/dpi_setup.h"
#include "ui/base/layout.h"
#include "ui/gfx/display.h"
#include "ui/gfx/win/dpi.h"
namespace ui {
namespace win ... | Correct bug in InitDeviceScaleFactor - hidden variable. | Correct bug in InitDeviceScaleFactor - hidden variable.
Bug was introduced during refactor in r225722
BUG=306268
Review URL: https://codereview.chromium.org/26444010
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@228107 0039d316-1c4b-4281-b951-d872f2087c98
| C++ | bsd-3-clause | Fireblend/chromium-crosswalk,patrickm/chromium.src,littlstar/chromium.src,Jonekee/chromium.src,hgl888/chromium-crosswalk,ondra-novak/chromium.src,ondra-novak/chromium.src,M4sse/chromium.src,anirudhSK/chromium,chuan9/chromium-crosswalk,ondra-novak/chromium.src,jaruba/chromium.src,hgl888/chromium-crosswalk-efl,patrickm/c... |
cd72f4ac0bfc6ff5ecafb804e6c61c8d2902d6c4 | src/tests/test_asn1.cpp | src/tests/test_asn1.cpp | /*
* (C) 2017 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#include "tests.h"
#if defined(BOTAN_HAS_ASN1)
#include <botan/der_enc.h>
#include <botan/ber_dec.h>
#endif
namespace Botan_Tests {
#if defined(BOTAN_HAS_ASN1)
namespace {
Test::Result test_ber_stack_recursi... | Add test for OSS-Fuzz 813 | Add test for OSS-Fuzz 813
| C++ | bsd-2-clause | randombit/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,Rohde-Schwarz-Cybersecurity/botan,webmaster128/botan,Rohde-Schwarz-Cybersecurity/botan,Rohde-Schwarz-Cybersecurity/botan,webmaster128/botan,randombit/botan,randombit/botan,webmaster128/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,webmaster128/... | |
5d590a99c30b293261dbbf943174a73370f7e07a | ext/testnan.cpp | ext/testnan.cpp | #include <stdio.h>
#include <math.h>
#include <string>
#include <sstream>
template <class T> T from_str(const std::string & str){
std::istringstream sin(str);
T ret;
sin >> ret;
return ret;
}
void print(double a){
printf("%.20f, %llX\n", a, *((unsigned long long *) &a));
}
int main(int argc, char **argv){
dou... | Add some code to output the bit patterns for various ways of generating NaN and Inf, compile with -lm | Add some code to output the bit patterns for various ways of generating NaN and Inf, compile with -lm
| C++ | mit | stormbrew/channel9,stormbrew/channel9,stormbrew/channel9,stormbrew/channel9,stormbrew/channel9 | |
5f6f6e3143f6501f66b05ac4ad00409e179dffbe | test/CPU_assign_test.cpp | test/CPU_assign_test.cpp | #include <catch.hpp>
#include "Chip8.hpp"
#include "CPU.hpp"
namespace {
using namespace Core8;
SCENARIO("CPUs can assign the value of one register to another", "[assign]") {
GIVEN("A CPU with some initialized registers") {
CPU cpu{};
cpu.writeRegister(Chip8::REGISTER::V0, 0x01);
cpu.writeRegister(Chi... | Add unit tests to assign operation | Add unit tests to assign operation
| C++ | mit | benvenutti/core8,benvenutti/core8 | |
056f94a3e17d9d1cdfc00c64d7c97682a31c1975 | test/Core/test_color_conversion.cpp | test/Core/test_color_conversion.cpp | // ========================================================================== //
// This file is part of DO++, a basic set of libraries in C++ for computer
// vision.
//
// Copyright (C) 2014 David Ok <david.ok8@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License v. 2.0. If... | Add stub for unit-testing the color conversion. | Add stub for unit-testing the color conversion.
| C++ | mpl-2.0 | DO-CV/sara,DO-CV/sara,DO-CV/sara,DO-CV/sara,DO-CV/sara,DO-CV/sara |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.