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 |
|---|---|---|---|---|---|---|---|---|---|
37abdddb8ea07d25502980bd1bb9b257297c5402 | utils/benchmark/Strings/CPPStringBench.cpp | utils/benchmark/Strings/CPPStringBench.cpp | #include <mach/mach_time.h>
#include <string>
#include <stdio.h>
#define LAPS 10000000
std::wstring s = L"siebenhundertsiebenundsiebzigtausendsiebenhundertsiebenundsiebzig";
int
main(void) {
uint64_t count = 0;
uint64_t start = mach_absolute_time();
for (auto i = 0; i < LAPS; i++) {
for (auto c : s) {
... | #include <mach/mach_time.h>
#include <string>
#include <stdio.h>
#define LAPS 10000000
std::wstring s = L"siebenhundertsiebenundsiebzigtausendsiebenhundertsiebenundsiebzig";
int
main(void) {
uint64_t count = 0;
uint64_t start = mach_absolute_time();
for (auto i = 0; i < LAPS; i++) {
for (auto c : s) {
... | Print the total execution time. | Print the total execution time.
Swift SVN r15385
| C++ | apache-2.0 | return/swift,kentya6/swift,kentya6/swift,hooman/swift,jopamer/swift,manavgabhawala/swift,LeoShimonaka/swift,slavapestov/swift,nathawes/swift,OscarSwanros/swift,natecook1000/swift,karwa/swift,tkremenek/swift,Ivacker/swift,johnno1962d/swift,swiftix/swift,JGiola/swift,jopamer/swift,tjw/swift,karwa/swift,jtbandes/swift,dev... |
71d5dcb79e834860d42837a0993fcffea74809e0 | solution026.cpp | solution026.cpp | /**
* Remove Duplicates from Sorted Array
*
* cpselvis (cpselvis@gmail.com)
* August 23th, 2016
*/
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int prev, len = 0;
for (int i = 0; i < nums.size(); ) {
if (nums[i] != p... | Remove duplicate elements of an array. | Remove duplicate elements of an array.
| C++ | mit | cpselvis/leetcode | |
7e23219ce141134a35170677f9a2bbe11788459c | week09/solutions/problem1/dynamic-array/main.cpp | week09/solutions/problem1/dynamic-array/main.cpp | #include <iostream>
using namespace std;
class DynamicArray {
int* elements;
int size;
int capacity;
void resize() {
// increase capacity
capacity *= 2;
// allocate new memory
int* newElements = new int[capacity];
// copy old array
for (int i = 0; i < size; ++i) {
newElements[... | Add solution to the dynamic array problem | Add solution to the dynamic array problem
| C++ | mit | dimitaruzunov/oop-practicum-2015-16 | |
4ac3232a2cbe4753466ab4679f44229987f959e9 | libkcal/tests/testvcalexport.cpp | libkcal/tests/testvcalexport.cpp | /*
This file is part of libkcal.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as pub... | Test application to read in an .ics file and export it to .vcs. | Test application to read in an .ics file and export it to .vcs.
svn path=/trunk/KDE/kdepim/; revision=416686
| C++ | lgpl-2.1 | lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi | |
3cfdf8f3026a320273215f0f9148f2b417f39279 | features/frameworks/greentea-client/source/greentea_serial.cpp | features/frameworks/greentea-client/source/greentea_serial.cpp | #include "greentea-client/greentea_serial.h"
SingletonPtr<GreenteaSerial> greentea_serial;
GreenteaSerial::GreenteaSerial() : mbed::RawSerial(USBTX, USBRX) {};
| #include "greentea-client/greentea_serial.h"
SingletonPtr<GreenteaSerial> greentea_serial;
GreenteaSerial::GreenteaSerial() : mbed::RawSerial(USBTX, USBRX, MBED_CONF_PLATFORM_STDIO_BAUD_RATE) {};
| Make GreenTea respect STDIO baud rate | Make GreenTea respect STDIO baud rate
| C++ | apache-2.0 | karsev/mbed-os,nvlsianpu/mbed,screamerbg/mbed,HeadsUpDisplayInc/mbed,adustm/mbed,kl-cruz/mbed-os,fahhem/mbed-os,HeadsUpDisplayInc/mbed,andcor02/mbed-os,mikaleppanen/mbed-os,mikaleppanen/mbed-os,mazimkhan/mbed-os,andcor02/mbed-os,NXPmicro/mbed,theotherjimmy/mbed,mmorenobarm/mbed-os,nvlsianpu/mbed,karsev/mbed-os,Archcady... |
823481023204cb23605c91a9190f0942ed931ebd | chapter25/chapter25_ex03.cpp | chapter25/chapter25_ex03.cpp | // Chapter 25, exercise 3: initialize a 32-bit signed int with the bit patterns
// and print the result:
// - all zeros
// - all ones
// - alternating ones and zeros (starting with leftmost one)
// - alternating zeros and ones (starting with leftomst zero)
// - 110011001100...
// - 001100110011...
// - all-one bytes an... | Add Chapter 25, exercise 3 | Add Chapter 25, exercise 3
| C++ | mit | bewuethr/stroustrup_ppp,bewuethr/stroustrup_ppp | |
58366e5d2ab4ea784011243a25744af8ee35dfe6 | test/forces/test_label_collision_force.cc | test/forces/test_label_collision_force.cc | #include "../test.h"
#include "../../src/forces/label_collision_force.h"
#include "../../src/forces/label_state.h"
namespace Forces
{
TEST(Test_LabelCollisionForce, NoForceIfLabelsDontCollide)
{
LabelCollisionForce force;
Eigen::Vector2f size(0.1f, 0.1f);
LabelState label(1, "Tested label", Eigen::Vector3f(0, ... | Add first test for LabelCollisionForce. | Add first test for LabelCollisionForce.
| C++ | mit | Christof/voly-labeller,Christof/voly-labeller,Christof/voly-labeller,Christof/voly-labeller | |
86d8c2a183d481e1224ef81496634ea87c9634cf | 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
| C++ | bsd-3-clause | csulmone/skia,csulmone/skia,csulmone/skia,csulmone/skia | |
e7ef36a30a3895ddda974083a14caf70cc7059f1 | test/contents_tests.cc | test/contents_tests.cc | /* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
#include "contents.hh"
#include "catch.hpp"
using namespace vick;
TEST_CASE("contents construction coordinates", "[contents]") {
#define TESTS \
/* al... | Add tests for `class contents` | Add tests for `class contents`
| C++ | mpl-2.0 | czipperz/vick,czipperz/vick | |
5a9dd498743374ed1192632b418ade7e3556b5ae | test/t/varint/runtest.cpp | test/t/varint/runtest.cpp |
#include <test.hpp>
TEST_CASE("varint") {
std::string buffer;
mapbox::util::pbf_writer pw(buffer);
SECTION("encode/decode int32") {
pw.add_int32(1, 17);
mapbox::util::pbf item(buffer.data(), buffer.size());
REQUIRE(item.next());
REQUIRE(17 == item.get_int32());
}
... | Test various varint encoding/decoding cases with failure modes. | Test various varint encoding/decoding cases with failure modes.
| C++ | bsd-2-clause | mapbox/pbf.hpp,mapbox/pbf.hpp,mapbox/pbf.hpp | |
2617f5e022b8eaaaf9f051e0c1f249c276e3e9fc | src/option_types.cc | src/option_types.cc | #include "option_types.hh"
#include "unit_tests.hh"
namespace Kakoune
{
UnitTest test_option_parsing{[]{
auto check = [](auto&& value, StringView str)
{
auto repr = option_to_string(value);
kak_assert(repr == str);
std::decay_t<decltype(value)> parsed;
option_from_string(str, p... | Add unit test for option parsing | Add unit test for option parsing
| C++ | unlicense | Somasis/kakoune,alexherbo2/kakoune,casimir/kakoune,jjthrash/kakoune,alexherbo2/kakoune,danr/kakoune,jkonecny12/kakoune,alexherbo2/kakoune,lenormf/kakoune,danr/kakoune,jjthrash/kakoune,danr/kakoune,casimir/kakoune,Somasis/kakoune,lenormf/kakoune,occivink/kakoune,occivink/kakoune,Somasis/kakoune,mawww/kakoune,jkonecny12/... | |
0d0ebc6f272446ea35ceda34301581ce7f156f7e | src/20151005-funcvarref.cpp | src/20151005-funcvarref.cpp | #include <cstdlib>
#include <iostream>
#include <cmath>
using namespace std;
void pow2(int& x) {
x = pow(x, 2);
}
int pow3(int x) {
return pow(x, 3);
}
int main() {
int x, y;
cin >> x >> y;
pow2(x);
y = pow3(y);
cout << x << " " << y << endl;
return 0;
}
| Add wshop form 05 Oct 2015 | Add wshop form 05 Oct 2015
| C++ | mit | pandres95/UN2015734-CompProgramming,pandres95/UN2015734-CompProgramming,pandres95/UN2015734-CompProgramming | |
78c7e6e21fa50295d1756d7b3d16a4db00186c70 | test/benchmark/engine_util_spatial_benchmark_test.cc | test/benchmark/engine_util_spatial_benchmark_test.cc | // Copyright 2021 DeepMind Technologies Limited
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable la... | Add an example benchmark for methods in `engine_util_spatial`. | Add an example benchmark for methods in `engine_util_spatial`.
PiperOrigin-RevId: 453609626
Change-Id: I4986196ea3573bc22669c146ab6a311566035b73
| C++ | apache-2.0 | deepmind/mujoco,deepmind/mujoco,deepmind/mujoco,deepmind/mujoco,deepmind/mujoco | |
2c1dba17023f1051977817c33d04bac3ce10a993 | metaprogramming_examples/metaprogramming_examples.cpp | metaprogramming_examples/metaprogramming_examples.cpp | #include <utility>
template <std::size_t I, typename T> struct holder { T t; };
template <typename Sequence, typename... Ts> struct tuple_impl;
template <std::size_t... I, typename... Ts>
struct tuple_impl<std::index_sequence<I...>, Ts...> : holder<I, Ts>... {};
template <typename... Ts>
using tuple = tuple_impl<st... | Add some short metaprogramming examples | Add some short metaprogramming examples
| C++ | apache-2.0 | google/cpp-from-the-sky-down,google/cpp-from-the-sky-down,google/cpp-from-the-sky-down | |
f801dcff43b49509bf758e213de56288bd3e2a2e | test/SemaCXX/decltype.cpp | test/SemaCXX/decltype.cpp | // RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
// PR5290
int const f0();
void f0_test() {
decltype(0, f0()) i = 0; // expected-warning{{expression result unused}}
i = 0;
}
struct A { int a[1]; A() { } };
typedef A const AC;
int &f1(int*);
float &f2(int const*);
void test_f2() {
float &fr = f2(AC().a);
... | Add test case for PR5290; this bug was fixed with the non-class rvalue de-cv-qualification fixes. | Add test case for PR5290; this bug was fixed with the non-class rvalue
de-cv-qualification fixes.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@108437 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | apple/swift-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,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/cl... | |
20acbb92892a88c6ce88e475b02669af728c0b41 | test/msan/mul_by_const.cc | test/msan/mul_by_const.cc | // RUN: %clangxx_msan -m64 -O2 %s -o %t && %run %t
#include <sanitizer/msan_interface.h>
struct S {
S(int a0) : a(a0) {}
int a;
int b;
};
// Here S is passed to FooRun as a 64-bit integer.
// This triggers an optimization where 10000 * s.a is transformed into
// ((*(uint64_t *)&s) * (10000 * 2**32)) >> 32
// T... | Fix handling of multiplication by a constant with a number of trailing zeroes. | [msan] Fix handling of multiplication by a constant with a number of trailing zeroes.
Multiplication by an integer with a number of trailing zero bits leaves
the same number of lower bits of the result initialized to zero.
This change makes MSan take this into account in the case of multiplication by
a compile-time co... | C++ | apache-2.0 | llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt | |
de7c91b6ef78957b9d8776b0460790c2ae8d18b4 | script/main.cpp | script/main.cpp | #include <stdio.h>
#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string.h>
/*
1000 in 9 seconds
so each one takes ~0.01s - fine
10x faster than haskell
*/
std::string readFile(const char* file)
{
std::ifstream f;
std::stringstream ss;
f.open(file, std:... | Add a test of searching in order | Add a test of searching in order
| C++ | bsd-3-clause | ndmitchell/hoogle,wolftune/hoogle,ndmitchell/hogle-dead,BartAdv/hoogle,ndmitchell/hoogle,ndmitchell/hogle-dead,wolftune/hoogle,BartAdv/hoogle,wolftune/hoogle,ndmitchell/hoogle,wolftune/hoogle,BartAdv/hoogle,BartAdv/hoogle | |
88829d0f1ac3f959aa0cfd1a663d6d9842088ea1 | chapter25/chapter25_ex09.cpp | chapter25/chapter25_ex09.cpp | // Chapter 25, exercise 9: without using standard headers such as <limits>,
// compute the number of bits in an int and determine wether char is signed or
// unsigned
#include<iostream>
using namespace std;
int main()
{
int n = 0;
int i = 1;
while (true) {
cout << "1 at bit " << n << ": " << (i<<... | Add Chapter 25, exercise 9 | Add Chapter 25, exercise 9
| C++ | mit | bewuethr/stroustrup_ppp,bewuethr/stroustrup_ppp | |
668075468e1f3f292ad62ad860a4f7e8df074783 | chrome/browser/chromeos/extensions/wallpaper_apitest.cc | chrome/browser/chromeos/extensions/wallpaper_apitest.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 "chrome/browser/extensions/extension_apitest.h"
#include "net/dns/mock_host_resolver.h"
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Wallpaper) {
... | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/extension_apitest.h"
#include "net/dns/mock_host_resolver.h"
// Disabled due to flakiness. See http://crbug.com/46863... | Disable ExtensionApiTest.Wallpaper as it's flaky. | Disable ExtensionApiTest.Wallpaper as it's flaky.
TBR=bshe@chromium.org
BUG=468632
Review URL: https://codereview.chromium.org/1004533003
Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#321309}
| C++ | bsd-3-clause | PeterWangIntel/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk,Fireblend/chromium-crosswalk,Chilledheart/chromium,Pluto-tv/chromium-crosswalk,axinging/chromium-crosswalk,hgl888/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Chilledheart/chromium,TheTypoMaster/chromium-crosswalk,chuan... |
bdeb995ec6e5c4f2831222599e3f4929edabcc7e | test/asan/TestCases/Windows/iostream_sbo.cc | test/asan/TestCases/Windows/iostream_sbo.cc | // RUN: %clang_cl_asan -O0 %s -Fe%t
// RUN: echo "42" | %run %t 2>&1 | FileCheck %s
#include <iostream>
int main() {
int i;
std::cout << "Type i: ";
std::cin >> i;
return 0;
// CHECK: Type i:
// CHECK-NOT: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
}
| Add a test case for r208215 [stack buffer overflow in <iostream>] | [ASan/Win] Add a test case for r208215 [stack buffer overflow in <iostream>]
The issue re-appears if one uses the -fsanitize-blacklist= flag,
so it's time to have a test case.
git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@227799 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 | |
665c4e57375b7edf3c90f71018d5df2461e9f887 | Algorithms/Graph_Algorithms/BFS/BFS.cpp | Algorithms/Graph_Algorithms/BFS/BFS.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> G[MAX];
/* this visited array should be initialized with false
eg.: memset(visited, false, sizeof visited) */
bool visited[MAX];
void BFS(int first) {
queue<int>Q;
Q.push(first);
while (!Q.empty()) {
int act = Q.front();
visit... | Add bfs source code in c++ | Add bfs source code in c++
| C++ | mit | salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook | |
2f746fff5b59d7892a47a2f1365e6f9790183d43 | test/dbn.cpp | test/dbn.cpp | #include "catch.hpp"
#include "dll/rbm.hpp"
#include "dll/dbn.hpp"
#include "dll/vector.hpp"
#include "dll/labels.hpp"
#include "dll/test.hpp"
#include "mnist/mnist_reader.hpp"
#include "mnist/mnist_utils.hpp"
TEST_CASE( "dbn/mnist_1", "rbm::simple" ) {
typedef dll::dbn<
dll::layer<28 * 28, 100, dll::in_... | Add test case for DBN | Add test case for DBN
| C++ | mit | wichtounet/dll,wichtounet/dll,wichtounet/dll | |
ecf05ca83ee919973395ade965d95e9afdcd3c1b | test/C++Frontend/2007-04-31-TryCatch.cpp | test/C++Frontend/2007-04-31-TryCatch.cpp | // RUN: %llvmgxx -S %s -o /dev/null
#include <locale>
namespace std
{
codecvt<char, char, mbstate_t>::
codecvt(size_t __refs)
: __codecvt_abstract_base<char, char, mbstate_t>(__refs),
_M_c_locale_codecvt(_S_get_c_locale())
{ }
}
| Test handling of TRY_CATCH_EXPRs for which the handler is a sequence of ordinary statements, rather than a list of CATCH_EXPRs or an EH_FILTER_EXPR. | Test handling of TRY_CATCH_EXPRs for which the handler is a sequence of
ordinary statements, rather than a list of CATCH_EXPRs or an EH_FILTER_EXPR.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@36629 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap,apple/swift-llvm,chubbymaggie/asap,dslab-epfl/asap,llvm-mirror/llvm,chubbymaggie/asap,apple/swift-llvm,dslab-epfl/asap,dslab-epfl/asap,llvm-mirror/llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,GPUOpen-Driver... | |
f5de6c95c935e7d03803e8aa84373cc06d9cb6ab | test/CodeGenCXX/debug-info-vla-range.cpp | test/CodeGenCXX/debug-info-vla-range.cpp | // RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
// CHECK: DW_TAG_subrange_type
struct StructName {
int member[];
};
struct StructName SN;
| Test that we emit a subrange type for vlas. | Test that we emit a subrange type for vlas.
Part of rdar://11457152
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@157269 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | apple/swift-clang,llvm-mirror/clang,apple/swift-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,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/cl... | |
8bda2e66fa8050a6b3eef745628873eef4b683d8 | test/CXX/temp/temp.decls/temp.fct/temp.over.link/p6.cpp | test/CXX/temp/temp.decls/temp.fct/temp.over.link/p6.cpp | // RUN: clang-cc -fsyntax-only -verify %s
// XFAIL
template<int N, int M>
struct A0 {
void g0();
};
template<int X, int Y> void f0(A0<X, Y>) { } // expected-note{{previous}}
template<int N, int M> void f0(A0<M, N>) { }
template<int V1, int V2> void f0(A0<V1, V2>) { } // expected-error{{redefinition}}
template<int ... | Add a template test that requires canonical expression comparison | Add a template test that requires canonical expression comparison
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@77325 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | 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,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/cl... | |
dee4c282c39ff302ab9a862bbccb7b60ff979a12 | lms/core/main/extra/backtrace_formatter_win.cpp | lms/core/main/extra/backtrace_formatter_win.cpp | #include "backtrace_formatter.h"
#include <iostream>
namespace lms {
namespace extra {
void BacktraceFormatter::print(){
std::cerr << "BacktraceFormatter::print not implemented on Win32" << std::endl;
}
} // namespace extra
} // namespace lms
| #include "lms/extra/backtrace_formatter.h"
#include <iostream>
#include <Windows.h>
namespace lms {
namespace extra {
void printStacktrace() {
// http://stackoverflow.com/questions/5693192/win32-backtrace-from-c-code
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb204633(v=vs.85).aspx
unsig... | Implement BacktraceFormatter for Win32 (NOT tested) | Implement BacktraceFormatter for Win32 (NOT tested)
| C++ | apache-2.0 | Bitfroest/LMS,smarinov/LMS,lms-org/LMS,Phibedy/LMS,smarinov/LMS,lms-org/LMS,Phibedy/LMS,Bitfroest/LMS,Bitfroest/LMS |
90eb4b933b8b4cd32d11442bef3d43f92c803f44 | array/1886.cc | array/1886.cc | class Solution {
public:
bool findRotation(vector<vector<int>>& mat, vector<vector<int>>& target) {
if (check(mat, target))
return true;
rotate(mat);
if (check(mat, target))
return true;
rotate(mat);
if (check(mat, target))
return t... | Determine Whether Matrix Can Be Obtained By Rotation | Determine Whether Matrix Can Be Obtained By Rotation
| C++ | apache-2.0 | MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode | |
e82a2d723b998f883e0ead9fa16b999947b37f22 | test17_1_2.cpp | test17_1_2.cpp | #include <iostream>
#include <tuple>
#include <vector>
#include <utility>
using namespace std;
int main() {
//test 17.1
auto ituple = make_tuple(10, 20, 30);
size_t sz = tuple_size<decltype(ituple)>::value;
cout << sz << endl;
// for(size_t i = 0; i != sz; ++ i) {
// const s... | Add solution for chapter 17 test 1, test 2 | Add solution for chapter 17 test 1, test 2 | C++ | apache-2.0 | chenshiyang/CPP--Primer-5ed-solution | |
b858b789e44aba32ab532697691d5958b90ae75b | chrome/browser/extensions/window_open_interactive_apitest.cc | chrome/browser/extensions/window_open_interactive_apitest.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 "base/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"
class WindowOpenPa... | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"
class WindowOpenPa... | Disable WindowOpenPanelTest.WindowOpenFocus on Mac debug builds. | Disable WindowOpenPanelTest.WindowOpenFocus on Mac debug builds.
This test is flaking very often and adding a lot of noise to the tree. It
consistently takes 44-45 secs on debug, while taking 4 secs on release.
TBR=jam@chromium.org
BUG=253417
Review URL: https://codereview.chromium.org/17634008
git-svn-id: de016e52... | C++ | bsd-3-clause | PeterWangIntel/chromium-crosswalk,anirudhSK/chromium,krieger-od/nwjs_chromium.src,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Just-D/chromium-1,Pluto-tv/chromium-crosswalk,M4sse/chromium.src,anirudhSK/chromium,fujunwei/chromium-crosswalk,Jonekee/chromium.src,hgl888/chromiu... |
fc30b9f5d53e79ef02dfc3c0fc8e9c797e64a2c9 | cpp/009_Palindrome_Number.cpp | cpp/009_Palindrome_Number.cpp | // 9. Palindrome Number
/**
* Determine whether an integer is a palindrome. Do this without extra space.
*
* Some hints:
* Could negative integers be palindromes? (ie, -1)
*
* If you are thinking of converting the integer to string, note the restriction of using extra space.
*
* You could also try reversing ... | Add Solution for 009 Palindrome Number | Add Solution for 009 Palindrome Number
| C++ | mit | kuangami/LeetCode,kuangami/LeetCode,kuangami/LeetCode | |
5e714a892eb134e47e78f15a872c5d51ea1e390c | lib/union_find.cpp | lib/union_find.cpp | // Verified: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_1_A
struct union_find {
vector<int> par;
vector<int> rank;
union_find (int n) : par(n), rank(n, 0) {
REP(i,n)par[i]=i;
}
int find (int x) {
if (par[x] == x)
return x;
else
return par[x] = find(par[x]);
}
b... | Add library (Union find tree) | Add library (Union find tree)
| C++ | mit | utgw/programming-contest,utgw/programming-contest,utgw/programming-contest | |
1503f18af7b26202a0e48e124c147f78749ba8c8 | variants/platforms/esra_roll_control/indicator_platform.cpp | variants/platforms/esra_roll_control/indicator_platform.cpp | #include "variant/indicator_platform.hpp"
#include <hal.h>
IndicatorPlatform::IndicatorPlatform() {
}
void IndicatorPlatform::set(IndicatorIntent intent, bool value) {
switch(intent) {
case HEARTBEAT:
//palWritePad(GPIOE, GPIOE_LED3_RED, value);
break;
case VEHICLE_ARMED:
//palWritePad(GP... | Add indicator platform to icarus. | Add indicator platform to icarus.
| C++ | mit | OSURoboticsClub/aerial_control,OSURoboticsClub/aerial_control,OSURoboticsClub/aerial_control | |
3f2ffdd009fd2027a4d6f0e766ce677aa37bc0d6 | tests/halideTest.cpp | tests/halideTest.cpp | #include <stdio.h>
#include "Halide.h"
#include <iostream>
#include <string>
#define SIZE 10
void generate_function(std::string f_name, int size, int pos, int val)
{
std::string buff_name = "myOutBuff";
halide_dimension_t *shape = new halide_dimension_t[1];
shape[0].min = 0;
shape[0].extent ... | Add a simple halide file that starts from the low level IR and generates an object file | Add a simple halide file that starts from the low level IR and generates an object file
| C++ | mit | rbaghdadi/tiramisu,rbaghdadi/ISIR,rbaghdadi/tiramisu,rbaghdadi/tiramisu,rbaghdadi/ISIR,rbaghdadi/COLi,rbaghdadi/tiramisu,rbaghdadi/COLi | |
5ed357642cf7c9fa8952477a7874656fee418bd4 | content/renderer/gpu/delegated_compositor_output_surface.cc | content/renderer/gpu/delegated_compositor_output_surface.cc | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/renderer/gpu/delegated_compositor_output_surface.h"
namespace content {
DelegatedCompositorOutputSurface::DelegatedCompositorOutputSur... | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/renderer/gpu/delegated_compositor_output_surface.h"
namespace content {
DelegatedCompositorOutputSurface::DelegatedCompositorOutputSur... | Revert r227195 - aura: Set max pending frames to the default instead of 1 with ubercomp. | Revert r227195 - aura: Set max pending frames to the default instead of 1 with ubercomp.
max_frames_pending>1 isn't properly throttled by the browser. Also, it shouldn't be necessary with SwapCompositorFrame.
BUG=316377
Review URL: https://codereview.chromium.org/64643005
git-svn-id: de016e52bd170d2d4f2344f9bf92d50... | C++ | bsd-3-clause | krieger-od/nwjs_chromium.src,M4sse/chromium.src,chuan9/chromium-crosswalk,fujunwei/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,ChromiumWebApps/chromium,dushu1203/chromium.src,dednal/chromium.src,bright-sparks/chromium-spacewalk,axinging/chromium-crosswalk,hgl888/chromium-crosswalk,PeterWangIntel/chromium-crossw... |
8c7ec4e09711f6bc95739a17c3d4b5755a82d895 | test16_63.cpp | test16_63.cpp | #include <iostream>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
//solution for test 16.63 16.64
template <typename T>
typename vector<T>::size_type countTimes(const vector<T> &vec, const T &target) {
typename vector<T>::size_type time = 0;
for(auto elem : vec) {
... | Add solution for chapter 16 test 63 64 | Add solution for chapter 16 test 63 64 | C++ | apache-2.0 | chenshiyang/CPP--Primer-5ed-solution | |
b6e090ae219e2f4de63c36762c2dd6bc5c0569b7 | snippets/isOdd.cpp | snippets/isOdd.cpp | #include <iostream>
#define isOdd(x) (x & 0x01)
using namespace std;
int main (){
int a =57;
int b= 32;
cout << isOdd(a) << endl;
cout << isOdd(b) << endl;
return 0;
}
| Add useful function to know if a number is even or odd. | Add useful function to know if a number is even or odd.
| C++ | mit | xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book | |
95bb7b82b906bc58e1fcb6b7197ab65b8b308706 | source/board/STM32/STM32F1/NUCLEO-F103RB/NUCLEO-F103RB-lowLevelInitialization.cpp | source/board/STM32/STM32F1/NUCLEO-F103RB/NUCLEO-F103RB-lowLevelInitialization.cpp | /**
* \file
* \brief board::lowLevelInitialization() implementation for NUCLEO-F103RB
*
* \author Copyright (C) 2016 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
*
* \par License
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL ... | Add empty board::lowLevelInitialization() for NUCLEO-F103RB | Add empty board::lowLevelInitialization() for NUCLEO-F103RB | C++ | mpl-2.0 | jasmin-j/distortos,CezaryGapinski/distortos,DISTORTEC/distortos,jasmin-j/distortos,CezaryGapinski/distortos,jasmin-j/distortos,DISTORTEC/distortos,CezaryGapinski/distortos,DISTORTEC/distortos,CezaryGapinski/distortos,DISTORTEC/distortos,jasmin-j/distortos,jasmin-j/distortos,CezaryGapinski/distortos | |
8096170d6fb2da1caa7fcb6aaee1e2290b3d7c28 | test16_49.cpp | test16_49.cpp | #include <iostream>
using namespace std;
template <typename T>
void f(T t) {
cout << "f(T)" << endl;
}
template <typename T>
void f(const T* t) {
cout << "f(const T*)" << endl;
}
template <typename T>
void g(T t) {
cout << "g(T)" << endl;
}
template <typename T>
void g(T* t) {
... | Add solution for chapter 16 test 49. | Add solution for chapter 16 test 49. | C++ | apache-2.0 | chenshiyang/CPP--Primer-5ed-solution | |
484badfa096db4c001f66eccbe00b70471f2e767 | src/libutil/tests/chunked-vector.cc | src/libutil/tests/chunked-vector.cc | #include "chunked-vector.hh"
#include <gtest/gtest.h>
namespace nix {
TEST(ChunkedVector, InitEmpty) {
auto v = ChunkedVector<int, 2>(100);
ASSERT_EQ(v.size(), 0);
}
TEST(ChunkedVector, GrowsCorrectly) {
auto v = ChunkedVector<int, 2>(100);
for (auto i = 1; i < 20; i++) {
... | Add some tests for ChunkedVector | Add some tests for ChunkedVector
| C++ | lgpl-2.1 | NixOS/nix,NixOS/nix,NixOS/nix,NixOS/nix,NixOS/nix | |
27b1b292049ec5cef1508252892bee5cd0e20c14 | graphs/tarjan.cpp | graphs/tarjan.cpp | // TODO: retest this code. It was tested once, but had to be pushed for backup purposes.
// DO TEST IT BEFORE PROPER USE.
// Tarjan for SCC and Edge Biconnected Componentes - O(n + m)
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
vector<int> adj[N], st;
int num[N], low[N], vis[N], cnt, scc[N], s... | Add Tarjan for SCC + binconnected components. Needs further testing. | Add Tarjan for SCC + binconnected components. Needs further testing.
| C++ | mit | IMEplusplus/ICPC-Notebook | |
d31a80b30dd59a2b08b10dcd83489c8952dfe456 | Arrays/operations.cpp | Arrays/operations.cpp | #include <stdio.h>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;
typedef vector <int > vi;
inline void show(vi &data, int &size){
for (int i=0; i<size; i++)
printf("%d \t", data[i]);
printf("\n");
}
inline void permutation(vi data, int size){
sort(data.be... | Add simple algorithm over c++ to get the permutations. | Add simple algorithm over c++ to get the permutations.
| C++ | mit | xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book | |
5ea815f1fe7a95d000f7877a2cceb56315f98598 | voice_engine/test/auto_test/standard/voe_base_misc_test.cc | voice_engine/test/auto_test/standard/voe_base_misc_test.cc | /*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contribut... | /*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contribut... | Fix MaxChannels test; 32 -> 100. | Fix MaxChannels test; 32 -> 100.
TBR=henrika
Review URL: https://webrtc-codereview.appspot.com/1060010
git-svn-id: 03ae4fbe531b1eefc9d815f31e49022782c42458@3460 4adac7df-926f-26a2-2b94-8c16560cd09d
| C++ | bsd-3-clause | xhook/webrtc,jchavanton/webrtc,lukeweber/webrtc-src-override,Omegaphora/external_chromium_org_third_party_webrtc,geekboxzone/lollipop_external_chromium_org_third_party_webrtc,sippet/webrtc,MIPS/external-chromium_org-third_party-webrtc,jchavanton/webrtc,Alkalyne/webrtctrunk,krieger-od/webrtc,geekboxzone/lollipop_externa... |
8824a49e8956c4e548ca47f26cc73e2e91899d80 | cpp/016_3Sum_Closest.cpp | cpp/016_3Sum_Closest.cpp | // 16. 3Sum Closest
/**
* Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
*
* For example, given array S = {-1 2 1 -4}, and target = 1.
*
* ... | Add Solution for 016 3Sum Closest | Add Solution for 016 3Sum Closest
| C++ | mit | kuangami/LeetCode,kuangami/LeetCode,kuangami/LeetCode | |
0ad737e9bd690cb3cdfddfbfa057cb988dca8351 | test/CodeGenCXX/scoped-enums-debug-info.cpp | test/CodeGenCXX/scoped-enums-debug-info.cpp | // RUN: %clang_cc1 -std=c++11 -emit-llvm -g -o - %s | FileCheck %s
// Test that we are emitting debug info and base types for scoped enums.
// CHECK: [ DW_TAG_enumeration_type ] [Color] {{.*}} [from int]
enum class Color { gray };
void f(Color);
void g() {
f(Color::gray);
}
// CHECK: [ DW_TAG_enumeration_type ] [C... | Move debug info tests for scoped enums into a separate file. | Move debug info tests for scoped enums into a separate file.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@180026 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/clang,apple/swift-clang,llvm-mirror/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,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-cl... | |
bf360480149e7436eafd64e0583dde830d87ce33 | arangod/Aql/Types.cpp | arangod/Aql/Types.cpp | ////////////////////////////////////////////////////////////////////////////////
/// @brief fundamental types for the optimisation and execution of AQL
///
/// @file arangod/Aql/Types.cpp
///
/// DISCLAIMER
///
/// Copyright 2010-2014 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.... | Add the forgotten file. splice is only a stub. | Add the forgotten file. splice is only a stub.
| C++ | apache-2.0 | mujiansu/arangodb,morsdatum/ArangoDB,aurelijusb/arangodb,pekeler/arangodb,nvoron23/arangodb,pekeler/arangodb,nekulin/arangodb,morsdatum/ArangoDB,pekeler/arangodb,nvoron23/arangodb,kkdd/arangodb,aurelijusb/arangodb,morsdatum/ArangoDB,morsdatum/ArangoDB,aurelijusb/arangodb,aurelijusb/arangodb,abaditsegay/arangodb,razvanp... | |
9698e46c7804a957cff1bcf0fe7656e4b13bc62c | others/DS/LinkedList/delete_double_linked_list.cc | others/DS/LinkedList/delete_double_linked_list.cc | #include <stdio.h>
#include <stdlib.h>
typedef struct _NODE {
int data;
_NODE* next;
_NODE* prev;
} NODE;
void push(NODE** head_ref, int data) {
NODE* node = new NODE();
node->data = data;
node->next = *head_ref;
node->prev = NULL;
if (*head_ref != nullptr) {
(*head_ref)->prev = node;
}
*hea... | Delete Doubly Linked List Node. | Delete Doubly Linked List Node.
| C++ | apache-2.0 | pshiremath/practice,pshiremath/practice | |
53a95133ccdf71c499dbed080ccb0e5a57243cb6 | Leetcode2/082.cpp | Leetcode2/082.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
if(NULL == head || NULL == head->next) return head;
ListNode *prev = he... | Remove Duplicates from Sorted List II | Remove Duplicates from Sorted List II | C++ | mit | nolink/algorithm,nolink/algorithm | |
36ccdd49f50535b74ce4d54561e426907629270a | test/FrontendC++/m64-ptr.cpp | test/FrontendC++/m64-ptr.cpp | // RUN: %llvmgxx %s -S -o - | FileCheck %s
// Make sure pointers are passed as pointers, not converted to int.
// The first load should be of type i8** in either 32 or 64 bit mode.
// This formerly happened on x86-64, 7375899.
class StringRef {
public:
const char *Data;
long Len;
};
void foo(StringRef X);
void bar... | Test for llvm-gcc checkin 89898. | Test for llvm-gcc checkin 89898.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@89899 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | GPUOpen-Drivers/llvm,chubbymaggie/asap,apple/swift-llvm,apple/swift-llvm,llvm-mirror/llvm,chubbymaggie/asap,dslab-epfl/asap,llvm-mirror/llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,dslab-epfl/asap,llvm-mirror/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm... | |
c24d3d728b76243a54d6f7eb35a4d5d4b80d14f4 | tutorial/gpio-led.cpp | tutorial/gpio-led.cpp | #include <gpio.h> // gpio pin controllling
int main()
{
// defines the variable ledPin and refers it to an GPIO-Pin
auto ledPin = gpio::output_pin(15);
// loop 10 times
for (int i = 0; i < 10; i++) {
// pin is set true, pin is HIGH, LED is on
ledPin.set_state(true);
// pause fo... | Add simple led tutorial code | Add simple led tutorial code
| C++ | mit | stormarnschule/example-code | |
57ac4439874d57d01a020e99a13db6f0bde867a4 | test17_24.cpp | test17_24.cpp | #include <iostream>
#include <string>
#include <regex>
using namespace std;
int main() {
string phone = "(\\()?(\\d{3})(\\))?([-. ])?(\\d{3})([-. ])?(\\d{4})";
regex r(phone);
string s;
string fmt = "$2.$5.$7";
while(getline(cin, s)) {
cout << regex_replace(s, r, fmt) << endl;
... | Add solution for chapter 17 test 24 | Add solution for chapter 17 test 24 | C++ | apache-2.0 | chenshiyang/CPP--Primer-5ed-solution | |
0d391c2888ba6837f03a3d710cc6b78c8e9d3da2 | src/common/debug.cpp | src/common/debug.cpp | //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// debug.cpp: Debugging utilities.
#include "common/debug.h"
#include <stdio.h>
#include <stdarg.h>
namespace gl
{
void trace(const... | //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// debug.cpp: Debugging utilities.
#include "common/debug.h"
#include <stdio.h>
#include <stdarg.h>
static bool trace_on = true;
n... | Make it easier to disable tracing | Make it easier to disable tracing
TRAC #11979
Signed-off-by: Shannon Woods
Signed-off-by: Daniel Koch
Author: Andrew Lewycky
git-svn-id: 947ae547afacb859f3991e003b9d6feb04be57d7@178 736b8ea6-26fd-11df-bfd4-992fa37f6226
| C++ | bsd-3-clause | spurious/angle-mirror,jgcaaprom/android_external_chromium_org_third_party_angle,MIPS/external-chromium_org-third_party-angle,spurious/angle-mirror,geekboxzone/lollipop_external_chromium_org_third_party_angle,dumganhar/angleproject,dumganhar/angleproject,adobe/angle.js,jgcaaprom/android_external_chromium_org_third_party... |
2c50749f2f8f3207bbd695a50ae8c0f6feeb76cf | cpp/371_Sum_of_Two_Integers.cpp | cpp/371_Sum_of_Two_Integers.cpp | // 371. Sum of Two Integers
/**
* Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.
*
* Example:
* Given a = 1 and b = 2, return 3.
*
* Tags: Bit Manipulation
*
* Similar Problems: (M) Add Two Numbers
*
* Author: Kuang Qin
*/
#include <iostream>
using name... | Add Solution for 371 Sum of Two Integers | Add Solution for 371 Sum of Two Integers
| C++ | mit | kuangami/LeetCode,kuangami/LeetCode,kuangami/LeetCode | |
7b8a3d81bc80b75d197edca6099f037e984f6784 | Geometry/center_circle.cpp | Geometry/center_circle.cpp | #include <bits/stdc++.h>
using namespace std;
// Constants
const double PI = acos(-1);
struct point {
double x;
double y;
point (){}
point (double _x, double _y){
x = _x;
y = _y;
}
};
inline point get_center(point A, point B, point C){
float yDelta_a = B.y - A.y;
float xDe... | Add algorithm for computing the center of a circle based on three points. | Add algorithm for computing the center of a circle based on three points.
| C++ | mit | xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book | |
5933907fa147edf1bef20f08386c8a273a74ad7b | ch08/8.exercise.04.cpp | ch08/8.exercise.04.cpp | // 8.exercise.04.cpp
//
// An int can hold integers only up to a maximum number. Find an approximation
// of that maximum number by using fibonacci().
//
// COMMENTS
#include "std_lib_facilities.h"
void print(const string& label, const vector<int>& data)
// Only read arguments, so it safe to pass them by const-ref... | Prepare exercise 4 from chapter 8. | Prepare exercise 4 from chapter 8.
| C++ | mit | 0p3r4t4/PPPUCPP2nd,0p3r4t4/PPPUCPP2nd,0p3r4t4/PPPUCPP2nd | |
f38634bef562ff962f15671970ab89c4e104f3ac | chrome/browser/download/download_completion_blocker.cc | chrome/browser/download/download_completion_blocker.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 "chrome/browser/download/download_completion_blocker.h"
#include "base/logging.h"
DownloadCompletionBlocker::DownloadCompletionBlocker()
... | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/download/download_completion_blocker.h"
#include "base/logging.h"
DownloadCompletionBlocker::DownloadCompletionBlocker()
... | Fix crasher in DownloadCompletionBlocker BUG=130324 | Fix crasher in DownloadCompletionBlocker
BUG=130324
Review URL: https://chromiumcodereview.appspot.com/10667016
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@143969 0039d316-1c4b-4281-b951-d872f2087c98
| C++ | bsd-3-clause | axinging/chromium-crosswalk,hujiajie/pa-chromium,chuan9/chromium-crosswalk,patrickm/chromium.src,Chilledheart/chromium,Just-D/chromium-1,littlstar/chromium.src,M4sse/chromium.src,Fireblend/chromium-crosswalk,Fireblend/chromium-crosswalk,Jonekee/chromium.src,axinging/chromium-crosswalk,pozdnyakov/chromium-crosswalk,TheT... |
946fa657a70408719d2cafa542e396b002d61316 | test/SemaCXX/attr-nodebug.cpp | test/SemaCXX/attr-nodebug.cpp | // RUN: %clang_cc1 %s -verify -fsyntax-only
// Note: most of the 'nodebug' tests are in attr-nodebug.c.
// expected-no-diagnostics
class c {
void t3() __attribute__((nodebug));
};
| Add a test showing that nodebug is accepted in methods too. Patch by Paul Robinson. | Add a test showing that nodebug is accepted in methods too. Patch by
Paul Robinson.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@166606 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,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,llvm-mirror/cl... | |
25ecbe0ed6d3fba08e4e62915b67cc335dedc761 | PackageDatagram.cpp | PackageDatagram.cpp | #include "PackageDatagram.h"
// Constructors
PackageDatagram::PackageDatagram(char* data, unsigned int length, char* ip, int port)
{
this->data = new char[length];
memcpy(this->data, data, length);
this->length = length;
memcpy(this->ip, ip, sizeof this->ip);
this->port = port;
}
PackageDatagram::PackageDatag... | Package Datagram Class Behaviour defined | Package Datagram Class Behaviour defined
+ Package Datagram Class added
| C++ | mit | sguerra/dsd-udp-sockets | |
9e9650c44a859e8b3718d0af48bd16bd0129ef4a | test/CodeGenCXX/switch-case-folding.cpp | test/CodeGenCXX/switch-case-folding.cpp | // RUN: %clang_cc1 %s -emit-llvm-only
// CHECK that we don't crash.
int main(void){
int x = 12;
// Make sure we don't crash when constant folding the case 4
// statement due to the case 5 statement contained in the do loop
switch (4) {
case 4: do { case 5: x++;} while (x < 100);
}
return x;
}
| Patch for r148243 which was left behind. | Patch for r148243 which was left behind.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@148244 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-cl... | |
95ae291067e91b505f8a7a6463eeda960c450029 | exo_browser/common/switches.cc | exo_browser/common/switches.cc | // Copyright (c) 2013 Stanislas Polu.
// Copyright (c) 2012 The Chromium Authors.
// See the LICENSE file.
#include "exo/exo_browser/common/switches.h"
namespace switches {
// Makes ExoBrowser use the given path for its data directory.
const char kExoBrowserDataPath[] = "data-path";
// Prevents the launch of Exo and... | // Copyright (c) 2013 Stanislas Polu.
// Copyright (c) 2012 The Chromium Authors.
// See the LICENSE file.
#include "exo/exo_browser/common/switches.h"
namespace switches {
// Makes ExoBrowser use the given path for its data directory.
const char kExoBrowserDataPath[] = "data-path";
// Prevents the launch of Exo and... | Change switch name to "--raw" | Change switch name to "--raw"
| C++ | mit | kingland/thrust,danycoro/thrust,kingland/thrust,danycoro/thrust,kingland/thrust,danycoro/thrust,kingland/thrust,danycoro/thrust |
38d840486d2b4ecafd32af9ad48f594f5cdb6199 | test/CXX/temp/temp.spec/temp.expl.spec/p17.cpp | test/CXX/temp/temp.spec/temp.expl.spec/p17.cpp | // RUN: clang-cc -fsyntax-only -verify %s
template<class T1>
class A {
template<class T2> class B {
void mf();
};
};
template<> template<> class A<int>::B<double>;
template<> template<> void A<char>::B<char>::mf();
template<> void A<char>::B<int>::mf(); // expected-error{{requires 'template<>'}}
| Test explicit specialization involving multiple template<> headers | Test explicit specialization involving multiple template<> headers
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@83914 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-cl... | |
afc55c9610a783c20d8ab51ab5b5e7a5f7fa71ee | DatabasePrint.cpp | DatabasePrint.cpp | #include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
#include <string>
static int callback(void *data, int argc, char **argv, char **azColName){
int i;
fprintf(stderr, "%s: ", (const char*)data);
for(i=0; i<argc; i++){
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
printf("\n");... | Print Users' Database. For testing. | Print Users' Database. For testing. | C++ | mit | taragu/sharefile,taragu/sharefile | |
f5f0ea28777ea4d8c740392fd442240745e969ef | chapter25/chapter25_trythis5.cpp | chapter25/chapter25_trythis5.cpp | // Chapter 25, Try This 5: int, char, unsigned char and signed char example
// using si = 128
#include<iostream>
using namespace std;
template<class T> void print(T i) { cout << i << '\t'; }
void print(char i) { cout << int(i) << '\t'; }
void print(signed char i) { cout << int(i) << '\t'; }
void print(unsigned ch... | Add Chapter 25, Try This 5 | Add Chapter 25, Try This 5
| C++ | mit | bewuethr/stroustrup_ppp,bewuethr/stroustrup_ppp | |
e399564a230846b3a3044855a2b11c4264d2d776 | lib/Driver/HostInfo.cpp | lib/Driver/HostInfo.cpp | //===--- HostInfo.cpp - Host specific information -----------------------*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | Add host info (add new files). | Driver: Add host info (add new files).
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@66603 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | apple/swift-clang,apple/swift-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,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/cl... | |
571e37e2b99edc7e4f7dec7cc75216b02cc67818 | chrome/browser/chromeos/drive/drive_system_service_browsertest.cc | chrome/browser/chromeos/drive/drive_system_service_browsertest.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 "chrome/browser/chromeos/drive/drive_system_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_browser_... | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/drive/drive_system_service.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/prof... | Add a test to verify that the DriveDisabled policy prevents Drive access for realz. | Add a test to verify that the DriveDisabled policy prevents Drive access for realz.
BUG=165490
TEST=browser_tests:DriveSystemServiceBrowserTest.DisableDrivePolicyTest
Review URL: https://chromiumcodereview.appspot.com/12226057
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@181482 0039d316-1c4b-4281-b951-d872f... | C++ | bsd-3-clause | ondra-novak/chromium.src,krieger-od/nwjs_chromium.src,dushu1203/chromium.src,anirudhSK/chromium,patrickm/chromium.src,crosswalk-project/chromium-crosswalk-efl,Fireblend/chromium-crosswalk,dushu1203/chromium.src,markYoungH/chromium.src,Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,hgl888/chromium-crosswalk-ef... |
210b781770e40373fb04e06364e1dc3cd9a5bd9a | C++/104_Maximum_Depth_of_Binary_Tree.cpp | C++/104_Maximum_Depth_of_Binary_Tree.cpp | // 104 Maximum Depth of Binary Tree
/**
* Given a binary tree, find its maximum depth.
*
* The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
*
* Author: Yanbin Lu
*/
#include <stddef.h>
#include <vector>
#include <string.h>
#include <stdio.h>
#include <a... | Add 104 Maximum Depth of Binary Tree | Add 104 Maximum Depth of Binary Tree
| C++ | mit | bssrdf/LeetCode-Sol-Res,FreeTymeKiyan/LeetCode-Sol-Res,FreeTymeKiyan/LeetCode-Sol-Res,bssrdf/LeetCode-Sol-Res | |
d5660b06c3a1f13c00c17b3a147f23b7ba948ac5 | test/CodeGenCXX/PR37481.cpp | test/CodeGenCXX/PR37481.cpp | // RUN: %clang_cc1 -o /dev/null -emit-llvm -std=c++17 -triple x86_64-pc-windows-msvc %s
struct Foo {
virtual void f();
virtual void g();
};
void Foo::f() {}
void Foo::g() {}
template <void (Foo::*)()>
void h() {}
void x() {
h<&Foo::f>();
h<&Foo::g>();
}
| Add missing test case for r332639 | Add missing test case for r332639
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@332646 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/cl... | |
58e743c81889e132e4cfbca833c18c7ff4c53315 | test17_22.cpp | test17_22.cpp | #include <iostream>
#include <string>
#include <regex>
using namespace std;
bool valid(const smatch &m) {
if(m[1].matched) {
return m[3].matched && m[4].matched == 0;
} else {
return m[3].matched == 0 && m[4].str() == m[7].str();
}
}
int main() {
string phone = "(\\()?(... | Add solution for chapter 17 test 22 | Add solution for chapter 17 test 22 | C++ | apache-2.0 | chenshiyang/CPP--Primer-5ed-solution | |
9724d6c63e878e4cbe98cd907c5e5f39175ef1bd | src/mlpack/core/util/version.cpp | src/mlpack/core/util/version.cpp | /**
* @file version.cpp
* @author Ryan Curtin
*
* The implementation of GetVersion().
*/
#include "version.hpp"
#include <sstream>
// If we are not a git revision, just use the macros to assemble the version
// name.
std::string mlpack::util::GetVersion()
{
#ifndef __MLPACK_SUBVERSION
std::stringstream o;
o ... | /**
* @file version.cpp
* @author Ryan Curtin
*
* The implementation of GetVersion().
*/
#include "version.hpp"
#include <sstream>
// If we are not a git revision, just use the macros to assemble the version
// name.
std::string mlpack::util::GetVersion()
{
#ifndef __MLPACK_GIT_VERSION
std::stringstream o;
o... | Add a comment, and fix macro name. | Add a comment, and fix macro name.
| C++ | bsd-3-clause | trungda/mlpack,chenmoshushi/mlpack,stereomatchingkiss/mlpack,bmswgnp/mlpack,lezorich/mlpack,BookChan/mlpack,stereomatchingkiss/mlpack,lezorich/mlpack,theranger/mlpack,chenmoshushi/mlpack,ranjan1990/mlpack,minhpqn/mlpack,ajjl/mlpack,ranjan1990/mlpack,thirdwing/mlpack,palashahuja/mlpack,theranger/mlpack,ersanliqiao/mlpac... |
bdae88f629538afd8504496ed28864d61471db69 | test/SemaCXX/anonymous-union.cpp | test/SemaCXX/anonymous-union.cpp | // RUN: clang -fsyntax-only -verify %s
struct X {
union {
float f3;
double d2;
} named;
union {
int i;
float f;
union {
float f2;
mutable double d;
};
};
void test_unqual_references();
struct {
int a;
float b;
};
void test_unqual_references_const() co... | Test case for anonymous unions in C++ | Test case for anonymous unions in C++
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@61860 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-cl... | |
af8ecc534736fb609c2f22cc349d6329415e03e7 | tests/set_serialise_list_test.cc | tests/set_serialise_list_test.cc | /*
* Copyright (C) 2016 deipi.com LLC and contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* ri... | Add set of tests for SerialiseList | Add set of tests for SerialiseList
| C++ | mit | Kronuz/Xapiand,Kronuz/Xapiand,Kronuz/Xapiand,Kronuz/Xapiand,Kronuz/Xapiand,Kronuz/Xapiand | |
4e4b5c633300c46dbd495bfdb2a3e4931e3cab51 | Search/binary_search.cpp | Search/binary_search.cpp | #include <bits/stdc++.h>
using namespace std;
const int TAM = 5;
int arr[TAM];
/* Recursive
* l -> left
* r -> right
* x -> element to search
*/
int binary_search(int l, int r, int x){
if (r >= l){
int mid = l + (r - l)/2;
// The element in the middle
if (arr[mid] == x) return mid... | Add beautiful implementation binary search. | Add beautiful implementation binary search.
| C++ | mit | xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book | |
47933a68124210fc771ae29a3b7883d3521d4910 | test/asan/TestCases/closed-fds.cc | test/asan/TestCases/closed-fds.cc | // Check that when the program closed its std(in|out|err), running the external
// symbolizer still works.
// RUN: rm -f %t.log.*
// RUN: %clangxx_asan -O0 %s -o %t 2>&1 && ASAN_OPTIONS=log_path=%t.log:verbosity=2 not %run %t 2>&1
// RUN: FileCheck %s --check-prefix=CHECK-FILE < %t.log.*
#include <assert.h>
#include ... | Add a symbolizer testcase for closed stdin/stdout | Add a symbolizer testcase for closed stdin/stdout
Reviewed at http://reviews.llvm.org/D7973
git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@231429 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 | |
3af187983db30bac12db06b0f372efdc79fa623f | You-DataStore-Tests/datastore_api_test.cpp | You-DataStore-Tests/datastore_api_test.cpp | #include "stdafx.h"
#include "CppUnitTest.h"
using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert;
namespace You {
namespace DataStore {
namespace UnitTests {
TEST_CLASS(DataStoreApiTest) {
public:
//TEST_METHOD(TestMethod1) {
// // TODO: Your test code here
//}
};
} // namespace UnitTests
} //... | Create unit test file for datastore api | Create unit test file for datastore api
| C++ | mit | cs2103aug2014-w10-1c/main,cs2103aug2014-w10-1c/main | |
6052ea872a829aa7434fac74433a784507314176 | test/lsan/TestCases/Linux/fork_and_leak.cc | test/lsan/TestCases/Linux/fork_and_leak.cc | // Test that leaks detected after forking without exec().
// RUN: %clangxx_lsan %s -o %t && not %run %t 2>&1 | FileCheck %s
#include <assert.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
int main() {
pid_t pid = fork();
assert(pid >= 0);
if (pid > 0) {
int status = 0;
waitpid(pid, &st... | Check that leak sanitizer works in the forked process | [lsan] Check that leak sanitizer works in the forked process
Regression test for PR38698
git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@340769 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 | |
4452eee527121e1fc838018176634b815332c925 | 725.cpp | 725.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
vector<ListNode*> splitListToParts(ListNode* root, int k) {
int d=depth(root);
vector<int> ls;
while(k>0){
... | Split Linked List in Parts | Split Linked List in Parts | C++ | mit | zfang399/LeetCode-Problems | |
f98a2b68b77fa356af25e44b30a76b3b1ce8c8f6 | Strings/allpossibleSubstrSizek.cpp | Strings/allpossibleSubstrSizek.cpp | #include<bits/stdc++.h>
#define debug(x) cout << #x << " = "<< x << endl
#define pb push_back
/*
Algorithm to find all possible substrings of size k given a set of values
*/
using namespace std;
set<string> subs;
//print all possible substrings of size k
void substringSizek(char set[], string prefix, int n, int k){
... | Add useful algorithm to find all possible substrings of size k of a set of characters. | Add useful algorithm to find all possible substrings of size k of a set of characters.
| C++ | mit | xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book | |
bd6e3e8ac8b6f94ff4151a84c9907cd3c85f0126 | DataStructures/Strings/remove_chars_s1_from_s2.cpp | DataStructures/Strings/remove_chars_s1_from_s2.cpp | // remove chars in s1 which are present in the s2
#include <iostream>
#include <string>
using namespace std;
void removeChars(string &s1, string &s2) {
int map[256] = {0};
int s2_len = s2.length();
for (int i = 0; i < s2_len; i++) {
map[s2[i]] = 1;
}
int s1_len = s1.length();
string result;
for (int i = 0; i ... | Remove chars in s2 from s1 | Remove chars in s2 from s1
Signed-off-by: WajahatSiddiqui <3c3ea4adfdf19decee174766aef6add34b32b7f0@gmail.com>
| C++ | apache-2.0 | WajahatSiddiqui/Workspace,WajahatSiddiqui/Workspace,WajahatSiddiqui/Workspace | |
fcb344799a5548850155bbfdc0085044f43b43e0 | src/rustllvm/RustWrapper.cpp | src/rustllvm/RustWrapper.cpp | //===- RustWrapper.cpp - Rust wrapper for core functions --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | //===- RustWrapper.cpp - Rust wrapper for core functions --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | Add a hack to force the linker to fetch Object.o | Add a hack to force the linker to fetch Object.o
| C++ | apache-2.0 | andars/rust,XMPPwocky/rust,barosl/rust,aturon/rust,richo/rust,zachwick/rust,krzysz00/rust,defuz/rust,stepancheg/rust-ide-rust,mdinger/rust,ruud-v-a/rust,aturon/rust,graydon/rust,jbclements/rust,omasanori/rust,AerialX/rust-rt-minimal,untitaker/rust,hauleth/rust,jashank/rust,servo/rust,shepmaster/rand,bombless/rust,andar... |
7f3f80a944d25d3fc505d1c5c026f658a1756c47 | test/util/point3_test.cc | test/util/point3_test.cc | /*
* Unit tests for the Point3 class.
* Author: Dino Wernli
*/
#include <gtest/gtest.h>
#include "util/point3.h"
TEST(Point3, Distance) {
Point3 p(1, 2, 3);
EXPECT_DOUBLE_EQ(0, Point3::Distance(p, p));
Point3 q(1, 2, 4);
EXPECT_DOUBLE_EQ(1, Point3::Distance(p, q));
Point3 r(1, 2, 1);
EXPECT_DOUBLE_E... | Add unit tests for point. | Add unit tests for point.
| C++ | mit | dinowernli/raytracer,dinowernli/raytracer,dinowernli/raytracer,dinowernli/raytracer | |
58a7b635bf5488abf1ba4680dae686a6ebdf879e | practice03/04.cpp | practice03/04.cpp | #include <stdio.h>
int get_gcd(const int num1, const int num2)
{
/* Euclidean algorithm */
/* Base case */
if(num1 < num2) return get_gcd(num2, num1); /* Swap two numbers; num2 should be less than num1 */
if(num1 % num2 == 0) return num2; /* num2 is GCD */
/* Recursive case */
return get_gcd(n... | Add a solution of prob 4 | Add a solution of prob 4
| C++ | mit | kdzlvaids/problem_solving-pknu-2016,kdzlvaids/problem_solving-pknu-2016 | |
a07eddcacfb4196cd646f247718c2b8b625af3f6 | examples/dump.cc | examples/dump.cc | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#include <cassert>
#include <cstd... | Add a C++ linkage example. | Add a C++ linkage example.
| C++ | mpl-2.0 | kinetiknz/mp4parse-rust,mozilla/mp4parse-rust,kinetiknz/mp4parse-rust | |
56566065eed61578f5728cd631710d4d1a5146dd | sdk-remote/src/utils/find-boost.cc | sdk-remote/src/utils/find-boost.cc | /*
* Copyright (C) 2009, Gostai S.A.S.
*
* This software is provided "as is" without warranty of any kind,
* either expressed or implied, including but not limited to the
* implied warranties of fitness for a particular purpose.
*
* See the LICENSE file for more information.
*/
// This file is used by the pack... | Add specific header to help find boost location. | Add specific header to help find boost location.
Previously urbi-launch.cc was used, which is fragile because it will break if
anyone stops including boost::foreach there. Which I did.
* src/utils/find-boost.cc: New.
| C++ | bsd-3-clause | urbiforge/urbi,urbiforge/urbi,aldebaran/urbi,urbiforge/urbi,aldebaran/urbi,aldebaran/urbi,aldebaran/urbi,urbiforge/urbi,urbiforge/urbi,urbiforge/urbi,urbiforge/urbi,aldebaran/urbi,urbiforge/urbi,aldebaran/urbi,aldebaran/urbi,aldebaran/urbi,urbiforge/urbi | |
07d3a74649032beba101d6c1677c87b4dbde9fe4 | 8.cpp | 8.cpp | /*
* Written by Nitin Kumar Maharana
* nitin.maharana@gmail.com
*/
//Print 2-D matrix in clockwise spiral order.
#include <iostream>
#include <vector>
using namespace std;
void printSpiral(vector<vector<int>>& input)
{
int top, bottom, left, right, direction;
top = left = 0;
bottom = input.size()-1;
right =... | Print 2-D matrix in clockwise spiral order. | Print 2-D matrix in clockwise spiral order.
| C++ | mit | nitin-maharana/CODE | |
7d5ba55f58c070e5b9f8cee3a172e2da1fcd02af | test/CXX/temp/temp.spec/temp.explicit/p7.cpp | test/CXX/temp/temp.spec/temp.explicit/p7.cpp | // RUN: clang-cc -fsyntax-only -verify %s
template<typename T>
struct X0 {
struct MemberClass {
T member; // expected-error{{with function type}}
};
T* f0(T* ptr) {
return ptr + 1; // expected-error{{pointer to function}}
}
static T* static_member;
};
template<typename T>
T* X0<T>::static_me... | Test for interaction between explicit instantiations and specializations | Test for interaction between explicit instantiations and specializations
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@85244 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-cl... | |
c62abb4b6e08f7f5a3b6881d02bf9c6b828a3982 | tests/src/enum/tests_EnumDefinitionMacro.cpp | tests/src/enum/tests_EnumDefinitionMacro.cpp | #include <mart-common/enum/EnumDefinitionMacro.h>
MART_UTILS_DEFINE_ENUM( Airplains, int, 5, F114, A380, F22, Eurofighter, Cessna );
| Add test for enum definition macro | [Test] Add test for enum definition macro
| C++ | mit | tum-ei-rcs/mart-common,tum-ei-rcs/mart-common | |
4dc6032ce6a09be8dd80f46dd3df080af19bb131 | others/DS/BT/child_sum_property.cc | others/DS/BT/child_sum_property.cc | #include <stdio.h>
typedef struct _NODE {
int data;
_NODE* left;
_NODE* right;
} NODE;
NODE* newNode(int data) {
NODE* node = new NODE();
node->data = data;
node->left = nullptr;
node->right = nullptr;
return node;
}
bool isSumProperty(NODE* root) {
int left_node_data = 0;
int right_node_data = ... | Check whether given tree satisfies children sum property. | Check whether given tree satisfies children sum property.
| C++ | apache-2.0 | pshiremath/practice,pshiremath/practice | |
f94bfbbbbb7189d9e50ddf589a7567770859d0c0 | test/tsan/Darwin/external-dups.cc | test/tsan/Darwin/external-dups.cc | // RUN: %clangxx_tsan %s -o %t
// RUN: %deflake %run %t 2>&1 | FileCheck %s
#include <thread>
#import "../test.h"
extern "C" {
void *__tsan_external_register_tag(const char *object_type);
void *__tsan_external_assign_tag(void *addr, void *tag);
void __tsan_external_read(void *addr, void *caller_pc, void *tag);
void ... | Add a test for "external" API that checks the dup suppression is based on the caller PC | [tsan] Add a test for "external" API that checks the dup suppression is based on the caller PC
We need to make sure that the "external" API isn't dup'ing all data races into a single one (because the stack might look the same) and suppressing all external races. This works now, so just adding a test for that.
Differe... | C++ | apache-2.0 | llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt | |
18c56a7bd8cd8c0f69382d5ca33cc50ce7ebe1cf | chapter23/chapter23_ex08.cpp | chapter23/chapter23_ex08.cpp | // Chapter 23, exercise 8: modify program from 23.8.7 to take as input a pattern
// and a file name, then output numbered lines (line-number: line) that contain
// a match of the pattern. No match - no output
#include<regex>
#include<iostream>
#include<iomanip>
#include<string>
#include<fstream>
#include<sstream>
#inc... | Add Chapter 23, exercise 8 | Add Chapter 23, exercise 8
| C++ | mit | bewuethr/stroustrup_ppp,bewuethr/stroustrup_ppp | |
d2a6dc04355ca833faa55fe50e3dde5c9c9f4de4 | tests/src/test_http_interface.cpp | tests/src/test_http_interface.cpp | #include <catch.hpp>
#define private public
#include <libgearbox_http_interface_p.h>
#include <libgearbox_http_interface.cpp>
TEST_CASE("Test libgearbox_http_interface", "[http]")
{
SECTION("")
{
}
}
| Add test skeleton for HttpInterface | Add test skeleton for HttpInterface
| C++ | mit | kicsyromy/libremotetransmission,kicsyromy/libGearBox,kicsyromy/libGearBox | |
1c8346cebe574d07f94322de2e87739907f09c56 | test/CodeGenCXX/2010-05-11-alwaysinlineinstantiation.cpp | test/CodeGenCXX/2010-05-11-alwaysinlineinstantiation.cpp | // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
// CHECK-NOT: ZN12basic_stringIcEC1Ev
// CHECK: ZN12basic_stringIcED1Ev
// CHECK: ZN12basic_stringIcED1Ev
template<class charT>
class basic_string
{
public:
basic_string();
~basic_string();
};
template <class charT>
__attribute__ ((__visibility__("hidden"), __alw... | Migrate from llvm/test/FrontendC++ and FileCheckize. | Migrate from llvm/test/FrontendC++ and FileCheckize.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@137772 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | apple/swift-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,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-cl... | |
d619d82388afb41f5c84bf8430085c83c862438d | test/stdlib/Inputs/CatchCrashes.cpp | test/stdlib/Inputs/CatchCrashes.cpp | #include <stdio.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
static void CrashCatcher(int sig)
{
const char *msg;
switch (sig) {
case SIGILL: msg = "CRASHED: SIGILL\n"; break;
case SIGTRAP: msg = "CRASHED: SIGTRAP\n"; break;
case SIGABRT: msg = "CRASHED: SIGABRT\n"; break;
case ... | Add new file for crash testing. | [test] Add new file for crash testing.
Swift SVN r17305
| C++ | apache-2.0 | alblue/swift,slavapestov/swift,Jnosh/swift,mightydeveloper/swift,IngmarStein/swift,Ivacker/swift,felix91gr/swift,kentya6/swift,Jnosh/swift,OscarSwanros/swift,kstaring/swift,airspeedswift/swift,aschwaighofer/swift,sschiau/swift,felix91gr/swift,benlangmuir/swift,glessard/swift,MukeshKumarS/Swift,mightydeveloper/swift,swi... | |
18422b49071ba5ea813d1b065458d6b81c6ef115 | test/msan/origin-store-long.cc | test/msan/origin-store-long.cc | // Check that 8-byte store updates origin for the full store range.
// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %run %t >%t.out 2>... | Update origin for the entire destination range on memory store. | [msan] Update origin for the entire destination range on memory store.
Previously we always stored 4 bytes of origin at the destination address
even for 8-byte (and longer) stores.
This should fix rare missing, or incorrect, origin stacks in MSan reports.
git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@226658 ... | C++ | apache-2.0 | llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt | |
80270dba5735c7dd03f8f1c65b90380f9f93ac02 | cpp/001_Two_Sum.cpp | cpp/001_Two_Sum.cpp | //1. Two Sum
/**
* Given an array of integers, return indices of the two numbers such that they add up to a specific target.
* You may assume that each input would have exactly one solution.
*
* Example:
* Given nums = [2, 7, 11, 15], target = 9,
* Because nums[0] + nums[1] = 2 + 7 = 9,
* return [0, 1].
*
* T... | Add Solution for 1 Two Sum | Add Solution for 1 Two Sum
| C++ | mit | kuangami/LeetCode,kuangami/LeetCode,kuangami/LeetCode | |
b56bee23f377d3518075453b6bbc7c3a17af04a1 | photoeffects/test/antique_test.cpp | photoeffects/test/antique_test.cpp | #include <gtest/gtest.h>
#include "photoeffects.hpp"
using namespace cv;
TEST(photoeffects, AntiqueTest)
{
Mat image(10, 10, CV_8UC1);
EXPECT_EQ(10, antique(image).cols);
}
| Add test for antique effect | Add test for antique effect
| C++ | bsd-3-clause | ITLab-Vision/itlab-vision,ITLab-Vision/itlab-vision | |
fd1908ce445eba4544d64cc68b3c03249e4bf614 | test/clang-tidy/clang-cl-driver.cpp | test/clang-tidy/clang-cl-driver.cpp | // RUN: clang-tidy -checks=-*,modernize-use-nullptr %s -- --driver-mode=cl /DTEST1 /DFOO=foo /DBAR=bar | FileCheck -implicit-check-not="{{warning|error}}:" %s
int *a = 0;
// CHECK: :[[@LINE-1]]:10: warning: use nullptr
#ifdef TEST1
int *b = 0;
// CHECK: :[[@LINE-1]]:10: warning: use nullptr
#endif
#define foo 1
#define... | Add a test for clang-tidy using the clang-cl driver. | Add a test for clang-tidy using the clang-cl driver.
Reviewed By: alexfh
Differential Revision: https://reviews.llvm.org/D23480
git-svn-id: a34e9779ed74578ad5922b3306b3d80a0c825546@278968 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/clang-tools-extra,llvm-mirror/clang-tools-extra,llvm-mirror/clang-tools-extra,llvm-mirror/clang-tools-extra | |
9fd513de5f0982bac97a02ec948cd2b8ad4ba4f1 | C++/082_Remove_Duplicates_From_Sorted_Lists_II.cpp | C++/082_Remove_Duplicates_From_Sorted_Lists_II.cpp | // 82 Remove Duplicates from Sorted List II
/**
* Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
*
* For example,
* Given 1->2->3->3->4->4->5, return 1->2->5.
* Given 1->1->1->2->3, return 2->3.
*
* Tag: Linked List
*
* Author: Yanb... | Add 82 Remove Duplicates from Sorted List II | Add 82 Remove Duplicates from Sorted List II
| C++ | mit | bssrdf/LeetCode-Sol-Res,bssrdf/LeetCode-Sol-Res,FreeTymeKiyan/LeetCode-Sol-Res,FreeTymeKiyan/LeetCode-Sol-Res | |
1bb281733784c237d0a8c613cd7d533777de8a62 | others/DS/BT/root_to_leaf_print.cc | others/DS/BT/root_to_leaf_print.cc | #include <stdio.h>
typedef struct _NODE {
int data;
_NODE* left;
_NODE* right;
} NODE;
NODE* newnode(int data) {
NODE* node = new NODE();
node->data = data;
node->left = nullptr;
node->right = nullptr;
return node;
}
void printPathUtil(int* path, int len) {
for (int i = 0; i < len; i++) {
prin... | Print all path from root to leaf. | Print all path from root to leaf.
| C++ | apache-2.0 | pshiremath/practice,pshiremath/practice | |
bf072280e350f30a4710874dc33e2968a53ecf22 | player/play.cpp | player/play.cpp | extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "RtMidi.h"
static RtMidiOut midi;
int midi_send(lua_State* L)
{
double status = lua_tonumber(L, -3);
double data1 = lua_tonumber(L, -2);
double data2 = lua_tonumber(L, -1);
std::vector<unsigned char> message... | Add C++ Bindings to Lua | Add C++ Bindings to Lua
| C++ | mit | MartinSeeler/lua-playground | |
dec31fbc935d9e678cf5fb6f275211dac5ebba5a | test/correctness/reuse_stack_alloc.cpp | test/correctness/reuse_stack_alloc.cpp | #include <stdio.h>
#include <Halide.h>
using namespace Halide;
int main(int argc, char **argv) {
Func f, g, h;
Var x;
// Create a simple function computed at root.
f(x) = x;
f.compute_root();
// Create a function that uses an undefined buffer after f is
// freed.
g(x) = undef<int>() ... | Test to ensure stack allocations can be reused. | Test to ensure stack allocations can be reused.
Former-commit-id: 7631661161decaac505c7e019450ed6df78d2932 | C++ | mit | darkbuck/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide | |
d5cd2a1d99771a60d95ed1039dfaa849559faec3 | test/unit/core/src/OmpScheduleTest.cpp | test/unit/core/src/OmpScheduleTest.cpp | /* Copyright 2020 Sergei Bastrakov
*
* This file is part of alpaka.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <alpaka/core/OmpSchedule.hpp>
#... | Add unit tests for omp::Schedule | Add unit tests for omp::Schedule
| C++ | mpl-2.0 | BenjaminW3/alpaka,BenjaminW3/alpaka |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.