text
string
size
int64
token_count
int64
/******************************************************************************* * Copyright 2019 ROBOTIS CO., LTD. * * 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.o...
1,415
474
#include <stdexcept> #include <common/logging.hpp> #include <lua/error_handler.hpp> #include <lua/script.hpp> #include <thread/scheduler.hpp> namespace SourceLua { namespace Lua { Script::Script(lua_State* L) : _L{L}, _name{"=unknown"} { if (_L == nullptr) throw new std::runtime_error("L must not be ...
1,506
590
/** @file EntityComponent.cpp @author Philip Abbet Implementation of the class 'Athena::Graphics::Visual::EntityComponent' */ #include <Athena-Graphics/Visual/EntityComponent.h> #include <Athena-Graphics/Conversions.h> #include <Athena-Entities/Transforms.h> #include <Athena-Entities/Scene.h> #include <Athe...
8,526
2,505
#include "u32backend.hpp" #include <Lmcons.h> #include <QCursor> #include <QtWin> #include <windows.h> std::tuple<QPoint, QPixmap> PlatformBackend::getCursor() { CURSORINFO cursorInfo; cursorInfo.cbSize = sizeof(cursorInfo); if (GetCursorInfo(&cursorInfo)) { if (cursorInfo.flags == CURSOR_SHOWING)...
1,956
693
//============================================================================ // Name : ARMtest.cpp // Author : Roger Dickerson // Version : // Copyright : MIT License // Description : Hello World in C++, Ansi-style //============================================================================ #incl...
548
147
#include<iostream> #include<vector> using namespace std; struct node { char info; int left; int right; node(char _c,int _left, int _right){ info=_c; left=_left; right=_right; } }; vector<node> postOrder; vector<node> inOrder; int count=-1; int createTreebyPostAndIn(int l...
1,332
512
#include "ROCInterpolator.h" double ROCInterpolator::interpolate(const Array<double> & fps, const Array<double> & tps, double fpVal) { bool success = false; int k; for (k=0; k<fps.size(); k++) { if ( fps[k] > fpVal ) { success = true; break; } } if ( ! success ) { cerr << "Pro...
914
373
// Generated from /POI/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java #include <org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.hpp> #include <java/io/ByteArrayOutputStream.hpp> #include <java/io/EOFException.hpp> #include <java/io/IOException.hpp> #include <java/io/InputStream.hpp> #include...
13,236
4,606
class CNumber : public CNumberFactory { int num; public: CNumber(){} void Add(int number) { num+= number; } void Sub(int number) { num-= number; } int GetValue() { return num; } void SetValue(int number) { num= number; } };
247
113
// Software License for MTL // // Copyright (c) 2007 The Trustees of Indiana University. // 2008 Dresden University of Technology and the Trustees of Indiana University. // 2010 SimuNova UG (haftungsbeschränkt), www.simunova.com. // All rights reserved. // Authors: Peter Gottschling and And...
1,526
601
#define _USE_MATH_DEFINES #include <levelset/levelset.hpp> #include <helperOC/helperOC.hpp> #include <helperOC/DynSys/DynSys/DynSysSchemeData.hpp> #include <helperOC/DynSys/DubinsCar/DubinsCar.hpp> #include <helperOC/DynSys/DubinsCarCAvoid/DubinsCarCAvoid.hpp> #include <helperOC/DynSys/Air3D/Air3D.hpp> #include <sstrea...
33,406
13,400
#include "SVITime.h" #include "../SVICores.h" #include <time.h> #include <stdarg.h> #define SEC_A_DAY 86400 SVIUInt SVITime::currentTimeMillis() { struct timeval t; gettimeofday(&t, NULL); //time is measured as millisecond. SVIUInt currentTime = (SVIUInt)((t.tv_sec % SEC_A_DAY)*1000 + (t.tv_usec / 1000)); retu...
1,086
494
#include "serialization_helpers.h"
35
13
// // Created by ts on 24.03.20. // #include <filesystem> #include <MainFrame.h> #include <IdsDialog.h> #include <PointEntryDialog.h> #include <PointHistoryWindow.h> #include <SettingsWindow.h> #include "main.h" MainFrame::MainFrame(MyApp* app) : MainFrame_B(nullptr), app_(app), timer_(this){ } MainFrame::~MainFra...
5,855
2,159
// Copyright (C) 2018-2019 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once #include <gtest/gtest.h> #include <gmock/gmock-spec-builders.h> #include <thread> #include <mutex> #include <condition_variable> using namespace InferenceEngine; using namespace ::testing; using namespace std; class ...
1,725
557
#include <deque> #include <iostream> #include <sstream> #include <string> #include <vector> struct Patient { int token; std::string id; Patient(int token, std::string id) : token(token), id(id) {} }; std::ostream& operator<<(std::ostream& os, const Patient* p) { os << '(' << p->token << ", " << p->id << ')'; ret...
1,595
679
/* * This file is part of the statismo library. * * Author: Marcel Luethi (marcel.luethi@unibas.ch) * * Copyright (c) 2011 University of Basel * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * ar...
4,328
1,408
#include <experimental/net> #include <chrono> #include <string> #include <iostream> using namespace std::chrono_literals; namespace net = std::experimental::net; int main() { net::ip::tcp::iostream s; s.expires_after(5s); s.connect("www.boost.org", "https"); if(!s) { std::cout << "error: " <...
654
260
#pragma once #include "stdafx.h" #include "CException.h" CException::CException(const char* msg) { this->name = "CException"; this->msg = msg; } void CException::printMsg() { printf("%s:\n\t%s\n", name, msg); exit(-1); } CIndexOutOfBoundsException::CIndexOutOfBoundsException(int index, int bounds, const char* ...
1,436
503
#include "PopUpText.h" void PopUpInfo::Paint(Draw& w) { Size sz = GetSize(); if(!IsTransparent()) w.DrawRect(0, 0, sz.cx, sz.cy, color); PaintLabel(w, 0, 0, sz.cx, sz.cy, !IsShowEnabled(), false, false, VisibleAccessKeys()); } PopUpInfo::PopUpInfo(): color(SColorInfo()) { Transparent(false); NoWantFocus(); ...
405
173
// Copyright (c) 2018 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 "components/password_manager/ios/test_helpers.h" #include "base/strings/utf_string_conversions.h" #include "components/autofill/core/common/...
5,058
1,598
/*************************************************************************** * Copyright (C) 2006-07 by Reinhard Jeschull * rjeschu@fh-landshut.de * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * th...
11,605
4,959
// Check if enhanced enums are supported enum Days: unsigned short {Odd, Even};
80
23
#include "utils/Logger.hpp" #include "utils/Path.hpp" #include "FileReaderManager.hpp" using namespace zhttpd::mod; FileReaderManager::FileReaderManager() : StatefullManager<FileReader>("mod_filereader"), _delay(0) { this->_defaultMimeType = ""; } FileReaderManager::~FileReaderManager() { } unsigned int FileR...
1,629
519
#include <stdio.h> class baseA2 { int dataA; public: void setDataA(int a); virtual int getDataA() const; }; class baseB2 { int dataB; public: void setDataB(int b); virtual int getDataB() const; }; class subBoth2 : public baseA2, public baseB2 { public: virtual int getSum() const; ...
1,269
499
#pragma once #include <vector> #include <GL/glew.h> namespace gl::engine { template <class T> class Buffer { public: Buffer(GLuint mode); Buffer(const std::vector<T> &data, GLuint mode); ~Buffer(); void transferBuffer(); void useBuffer(); voi...
694
213
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: // devide and conquer ListNode* mergeKLists(vector<ListNode*>& lists) { if (lists.size() == 0) return NULL; if (...
1,791
594
/** * Copyright (C) 2018-present MongoDB, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the Server Side Public License, version 1, * as published by MongoDB, Inc. * * This program is distributed in the hope that it will be useful, * but W...
6,880
1,893
// Mono Native Fixture // Assembly: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 // Namespace: System.Runtime.Remoting.Channels // Name: BaseChannelWithProperties // C++ Typed Name: mscorlib::System::Runtime::Remoting::Channels::BaseChannelWithProperties #include <gtest/gtest.h> #includ...
3,225
1,425
#include "pch.h" #include "FileWatcher.h" std::optional<FILETIME> FileWatcher::MyFileTime() { HANDLE hFile = CreateFileW(m_path.c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr); std::optional<FILETIME> result; if (hFile != INVALID_HA...
1,655
563
#include <iostream> // #include<bits/stdc++.h> #include <algorithm> using namespace std; int max_of_four(int a,int b,int c,int d) { return((a>b?a:b)>(c>d?c:d)?(a>b?a:b):(c>d?c:d)); } /* Add `int max_of_four(int a, int b, int c, int d)` here. */ int main() { int a, b, c, d; cin>>a>>b>>c>>d; ...
396
191
#ifndef ALS_ENTITY_HPP #define ALS_ENTITY_HPP #include"rect_shape.hpp" #include<memory> #include<libguile.h> namespace als { class texture; class renderer; class moving_entity; class entity { public: entity(); entity(const rect_shape &shape, const std::string &texture_path); virtual ~entity()=de...
1,053
366
#include<iostream> #include<cmath> using namespace std; int setBit(int n) { int k = (int)(log2(n)); return 1<<k; } int main() { int n; cin >> n; cout << "Most significant bits : " << setBit(n) << '\n'; return 0; }
219
97
// This file is part of comma, a generic and flexible library // Copyright (c) 2011 The University of Sydney // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // 1. Redistributions of source cod...
5,339
1,758
#pragma once #include "moove.tab.h" namespace Moove { using symbol_type = BisonParser::parser::symbol_type; symbol_type parseInteger(const char* text); symbol_type parseReal(const char* text); symbol_type parseObjnum(const char* text); symbol_type parseID(const char* text); symbol_type parse...
345
111
// InstructionTableEntry.cpp: implementation of the CInstructionTableEntry class. // ////////////////////////////////////////////////////////////////////// // Common Includes #include "macros.h" // Custom Includes #include "Declaration.h" #include "InstructionTableEntry.h" ///////////////////////////////////////////...
2,220
867
// Copyright 2016 The Chromium OS 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 "arc-networkd/manager.h" #include <arpa/inet.h> #include <stdint.h> #include <utility> #include <base/bind.h> #include <base/logging.h> #in...
6,085
2,007
/******************************************************************************* * * MIT License * * Copyright 2021-2022 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal *...
21,358
4,616
/* -------------------------------------------------------------------------- * * BHAPI++ Copyright (C) 2017, Stanislaw Stasiak, based on Haiku & ETK++, The Easy Toolkit for C++ programing * Copyright (C) 2004-2006, Anthony Lee, All Rights Reserved * * BHAPI++ library is a freeware; it may be used and distributed ...
3,745
1,438
#pragma once #include <cassert> #include "game/game_entity.hpp" static bool is_object_inside_screen(const component::transform& transform) { if (transform.position.x > 400 + 50 || transform.position.x < -400 - 50 || transform.position.y > 300 + 50 || transform.position.y < -300 - 50) { return...
4,128
1,408
// // iOSAudioDriver.cpp // // Created by Matt Tuttle on 5/31/13. // Copyright (c) 2013 Matt Tuttle. All rights reserved. // #include <iostream> #include "iOSAudioDriver.h" #include "AudioEngine.h" namespace Audaxe { // passes buffer callback to driver void tick(void *userData, AudioQueueRef inAQ, AudioQu...
2,801
901
#include <random> #include <btrc/builtin/renderer/wavefront/soa_buffer.h> BTRC_WFPT_BEGIN RayBuffer::RayBuffer(int state_count) { o_medium_id_.initialize(state_count); d_t1_.initialize(state_count); } RayBuffer::operator RaySOA() { return RaySOA{ .o_med_id_buffer = o_medium_id_, .d_t1_bu...
2,355
874
#include <cstdio> #include <queue> using namespace std; #define MAX 1000001 int f, s, g, u, d; int building[MAX]; queue<int> q; void bfs() { while (!q.empty()) { int here = q.front(); q.pop(); // 올라간다 int next = here + u; if (next <= f && building[next] ...
871
360
#include <iostream> #include <vector> template <typename T> std::istream& operator >>(std::istream& input, std::vector<T>& v) { for (T& a : v) input >> a; return input; } void answer(unsigned v) { std::cout << v << '\n'; } void solve(const std::vector<unsigned>& a) { const size_t n = a.size(...
1,771
875
#include "McRave.h" using namespace BWAPI; using namespace std; using namespace UnitTypes; namespace McRave::Resources { namespace { set<shared_ptr<ResourceInfo>> myMinerals; set<shared_ptr<ResourceInfo>> myGas; set<shared_ptr<ResourceInfo>> myBoulders; bool mineralSat, gasSat, h...
10,513
3,051
//------------------------------------------------------------------------ - // @FileName : NFNoSqlPlugin.cpp // @Author : LvSheng.Huang // @Date : 2017-02-08 // @Module : NFNoSqlPlugin // // ----------------------------------------------------------------------...
1,213
435
#include <bits/stdc++.h> #define lli long long int #define endl "\n" using namespace std; int main() { lli n,k,data1,data2, maxjoy = INT_MIN; cin>>n>>k; vector <lli> f,t; for(int i=0; i<n; i++) { cin>>data1>>data2; lli joy; if(data2 <= k) joy = data1; else joy = data1 - (data2-k); if(joy> maxjoy) ...
370
200
/* * * Created on: 2021年1月1日 * Author: Lzy */ #include "test_object.h" Test_Object::Test_Object(QObject *parent) : QThread(parent) { isRun = false; mPacket = sDataPacket::bulid(); mItem = Cfg::bulid()->item; mPro = mPacket->getPro(); mDev = mPacket->getDev(); mSour = mPacket->getDev(0...
471
202
#include "../fixtures/util.hpp" #include <mbgl/style/style_parser.hpp> #include <mbgl/util/io.hpp> #include <rapidjson/document.h> #include "../fixtures/fixture_log_observer.hpp" #include <iostream> #include <fstream> #include <dirent.h> using namespace mbgl; typedef std::pair<uint32_t, std::string> Message; typ...
3,253
1,063
//----------------------------------------------- // // This file is part of the Siv3D Engine. // // Copyright (c) 2008-2018 Ryo Suzuki // Copyright (c) 2016-2018 OpenSiv3D Project // // Licensed under the MIT License. // //----------------------------------------------- # include <Siv3D/Script.hpp> # include <Siv3D/...
2,883
1,094
// // Created by Max on 2021-01-05. // #include "Transform.h" Transform Transform::viewTransform(const Point& from, const Point& to, const Vector& up) { Tuple forward = (to - from).normalize(); Tuple left = forward.cross(up.normalize()); Tuple trueUp = left.cross(forward); Transform orientation; ...
4,120
1,452
#include <SDL.h> #include <SDL_ttf.h> #include "font.h" #include "../source/application/application.h" #include <algorithm> using namespace isometric::assets; font::font(const std::string& name) : asset(name) { } font::~font() { clear(); } std::unique_ptr<font> font::load(const std::string& name, const std...
2,530
885
/////////////////////////////////////////////////////////////////////////// // C++ code generated with wxFormBuilder (version Dec 8 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #include "GUI.h" //////...
9,798
4,376
// in this program we check if the given LL is a palindrome or not and return 1 for Palindrome and 0 for not palindrome #include <iostream> #include <stack> using namespace std; // linked list structure struct Node { int data; struct Node *next; Node(int x) { data = x; next = NULL; } }; // function t...
1,811
638
/* Copyright (c) 2019, isaponsoft (Isao Shibuya) All rights reserved. * * Use of this source code is governed by a BSD-style license that * * can be found in the LICENSE file. */ #ifndef __libamtrs__filesystem__stdfs__def__hpp #define __libamtrs__filesystem__stdfs__def__hpp #defin...
527
209
// // This file contains the C++ code from Program 16.1 of // "Data Structures and Algorithms // with Object-Oriented Design Patterns in C++" // by Bruno R. Preiss. // // Copyright (c) 1998 by Bruno R. Preiss, P.Eng. All rights reserved. // // http://www.pads.uwaterloo.ca/Bruno.Preiss/books/opus4/programs...
520
183
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define N 20 char s[N], w[N]; char y[N]; int a, b; int T(int x, int n) { int s = 1; for (int i = 1; i <= n; i++) { s *= x; } return s; } int main() { while (scanf("%s%d%d", s, &a, &b) != EOF) { int i, sum = 0, l; l = strlen(s); ...
972
582
// // main.cpp // 463 - Island Perimeter // // Created by ynfMac on 2019/11/26. // Copyright © 2019 ynfMac. All rights reserved. // #include <iostream> #include <vector> using namespace std; class Solution { private: int d[4][2] = {{1,0},{-1,0},{0,1},{0, -1}}; int C,R; bool isInArea(int x, ...
1,504
558
#include "pch-cpp.hpp" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include <limits> #include "vm/CachedCCWBase.h" #include "utils/New.h" template <typename R> struct VirtFuncInvoker0 { typedef R (*Func)(void*, const RuntimeMethod*); static inline R Invoke (Il2Cp...
457,727
239,941
class Solution{ queue<int>q; public: void dfs(Node* root){ if(root==NULL) return; dfs(root->right); q.push(root->data); // storing in descending order dfs(root->left); } void solver(Node* root){ if(root==NULL) return; int val=q.fro...
589
192
/*=================================================================== Microsoft Denali Microsoft Confidential. Copyright 1996 Microsoft Corporation. All Rights Reserved. Component: Server object File: Server.cpp Owner: CGrant This file contains the code for the implementation of the Server object. ===...
29,931
11,476
/* USE THIS FILE ACCORDING TO THE COPYRIGHT RULES IN LICENSE.TXT WHICH IS PART OF THE SOURCE CODE PACKAGE */ #ifndef QTHTTPCLIENT_HPP #define QTHTTPCLIENT_HPP #include "QTHttpClient.h" #include "QTHttpClientI.h" #include <QStack> namespace byps { namespace http { namespace qthttp { using namespace byps; ...
36,478
11,047
#include <memory> #include <iostream> class Man { public: Man() = default; // ~Man() = delete; // error: use of deleted function ‘Man::~Man()’ int age; }; int main() { { auto man = std::make_shared<Man>(); } }
240
87
/* * Copyright 2020 Google LLC * * 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 ...
5,711
2,130
class Solution { public: bool canVisitAllRooms(vector<vector<int>>& rooms) { int N = rooms.size(); vector<bool> vis(N, false); queue<int> tovis; // start from room #0, until we cannot visit any new room tovis.push(0); while(tovis.size()){ int cur_room = t...
824
256
// // CitadelGame.cpp // CitadelEngine // // Created by Norman van der Ploeg on 2020-01-17. // Copyright © 2020 Floating Citadel Games. All rights reserved. // //std includes #include <stdlib.h> #include <memory.h> #include <iostream> #include <unistd.h> //lib includes #include "GLFW/glfw3.h" //Citadel includes ...
2,679
906
/* 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 "SmsMessage.h" #include "MmsMessage.h" #include "MobileMessageThread.h" #include "MobileMessageService.h"...
5,112
1,202
#include "..\..\System\System.h" using namespace Sys; void TestString() { }
81
31
// SPDX-License-Identifier: BSL-1.0 #ifndef YYMP_TUPLE_TRAITS_HPP #define YYMP_TUPLE_TRAITS_HPP #include <type_traits> #include <utility> #include <yymp/dtl/piecewise_reinitializable.hpp> namespace yymp { /** * \brief Determines if all the element types of a \a Tuple have a * constructor that...
2,927
959
// Copyright (c) 2020 OXullo Intersecans <x@brainrapers.org> // // 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, copy...
2,533
1,013
// -*- mode: c++; indent-tabs-mode: nil; -*- // // Paragraph // Copyright (c) 2016-2019 Illumina, Inc. // All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http:...
2,319
783
#include "gempyre_graphics.h" #include "gempyre_utils.h" #include "imageblit_resource.h" #include <iostream> using namespace std::chrono_literals; void writeText(int x, int y, const std::string& text, Gempyre::CanvasElement& el) { el.ui().beginBatch(); const auto width = 1000. / 9.; const auto height = 10...
5,253
2,123
// Copyright snsinfu 2018. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef MD_POTENTIAL_CONSTANT_POTENTIAL_HPP #define MD_POTENTIAL_CONSTANT_POTENTIAL_HPP // This module provides constant_potential. Used as de...
836
285
/**************************************************************************** * ==> PSS_SymbolObserverMsg -----------------------------------------------* **************************************************************************** * Description : Provides a symbol observer message * * Devel...
1,725
376
/* Copyright (c) 2007 Cyrus Daboo. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 ...
4,648
1,583
#include <iostream> using namespace std; int main() { int B; cin >> B; for (int i = 1; i <= 200; i++) { int temp = i * i; int top = 0; int a[20]; while (temp) { a[top++] = temp % B; temp /= B; } bool flag = true; fo...
1,166
389
#pragma once #include "input_binding.hpp" #include "button_bindable_command.hpp" namespace gorc { class keyboard_button_binding : public input_binding { private: keyboard_key bound_key; button_bindable_command &command; public: keyboard_button_binding(button_bindable_command &com...
438
131
#include <memory> #include "app.h" int main(int argc, char **argv) { App application; bool init_success = application.begin(argc, argv); if(!init_success) return 1; application.loop(); return 0; }
220
80
#include "PCH.h" #include "DxbcContainer.h" #include "DxbcChunk.h" #include "InputSignatureChunk.h" #include "InterfacesChunk.h" #include "OutputSignatureChunk.h" #include "PatchConstantSignatureChunk.h" #include "ResourceDefinitionChunk.h" #include "ShaderProgramChunk.h" #include "StatisticsChunk.h" using namespace ...
3,675
1,291
#include <trace3D.h> Trace::Trace (string subTopic, string pubTopic){ // Publishers publisher = nh.advertise<nav_msgs::Path>(pubTopic, 1); subscriber = nh.subscribe(subTopic, 1, &Trace::callback, this); // Set Storage Matrix to Zero for (int i = 0; i < values.rows(); i++){ for (in...
1,703
657
/* Computes the number of k-way merge passes required to sort n items, i.e. the ceiling of the base-k logarithm of n. */ #include <cstddef> int mrg_npasses (size_t n, size_t k) { int m = 1; size_t b = k; while (b < n) { b *= k; ++m; } return m; }
283
123
#include <vector> #include <algorithm> #include <iostream> constexpr struct { template< class X, class Y > auto operator () ( X x, Y y ) -> decltype(x*y) { return x * y; } } multOp{}; int main() { std::vector<int> v{1, 2, 3, 4, 5}; auto prod = std::accumulate(v.begin...
473
167
#include "Graph.hpp" #include <random> #include <iostream> Graph::Graph() { ; } void Graph::set(vector<Point> &virtices, vector<vector<int>> &adjacency) { Graph::virtices_num = virtices.size(); Graph::virtices = virtices; Graph::adjacency = adjacency; } void Graph::set_random(int virtices_num) { Graph::vi...
2,430
1,123
#include "pch.h" #include "HeadTop.h" #include "Actor.h" #include "Timeline.h" #include <sstream> #include <iomanip> using namespace Gdiplus; using namespace std; /// Constant ratio to convert radians to degrees const double RtoD = 57.295779513; /** Constructor for a top of the head object * \param name The drawab...
4,643
1,595
//***************************************************************************** // Copyright 2017-2020 Intel Corporation // // 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://w...
11,858
3,771
#include "orz/streamconv.h" #include "main.h" #include "orz/file_reader.h" #include "orz/types.h" #include <UnitTest++/UnitTest++.h> SUITE(StreamConverter) { TEST(Defaults) { Util::StreamConverter sc; // Should default to empty with wordsize 8 CHECK(sc.CurrentWordSize() == 8); CHECK(sc.IsWordsLeft() == fals...
1,120
511
#include "input_manager.hpp" #include "event.hpp" #include "trace/logger.hpp" #include <GLFW/glfw3.h> #include <iostream> namespace shady::app::input { void InputManager::InternalKeyCallback(GLFWwindow* /* window */, int32_t key, int32_t scancode, int32_t action, int32_t ...
4,109
1,339
// Copyright (c) 2021 The WhiteBox Authors. All rights reserved. // Use of this source code is governed by a 3-Clause BSD license that can be // found in the LICENSE file. // // Character set for parsers. #include "character_set.h" // #include "base/deps/googletest/gtest/gtest.h" // NOLINTNEXTLINE(cert-err58-cpp,cpp...
2,116
731
#include "GLFW_Init.h" core::GLFW_Init::GLFW_Init() { } core::GLFW_Init::GLFW_Init(int major_version, int minor_version, int opengl_profile, int msaa_factor) { this->major_context_version = major_version; this->minor_context_version = minor_version; this->opengl_profile = opengl_profile; this...
663
275
#include <luna/utils/CursorHelper.hpp> #include <QCursor> #include <QGuiApplication> namespace luna::utils { CursorHelper::CursorHelper(QObject* parent) : QObject(parent) {} CursorHelper::~CursorHelper() { QGuiApplication::restoreOverrideCursor(); } Qt::CursorShape CursorHelper::cursor() const { return QGuiAppli...
1,227
388
#ifndef MITAMA_DIMENSIONAL_DERIVED_UNITS_HEAT_HPP #define MITAMA_DIMENSIONAL_DERIVED_UNITS_HEAT_HPP #include <mitama/dimensional/systems/si/all.hpp> #include <mitama/dimensional/quantity.hpp> #include <mitama/dimensional/io.hpp> namespace mitama::systems::si { template<class> struct heat_synonym{}; using heat_t = ma...
795
345
#include <cstdlib> #include "list.hpp" #include "catch.hpp" using TinySTL::List; TEST_CASE("front and back") { SECTION("empty list") { List<int> l; CHECK_THROWS_AS(l.front(), std::out_of_range); CHECK_THROWS_AS(l.back(), std::out_of_range); } } TEST_CASE("push front") { SECTION("...
5,731
2,241
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * 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/. */ extern int c...
398
146
/** * Copyright (c) 2016 Thomas Richard * * Following MIT license (see copying.txt) * * The software is provided "as is", without warranty of any kind, express or * implied, including but not limited to the warranties of merchantability, * fitness for a particular purpose and noninfringement. */ #ifndef CITADEL...
2,774
850
#include "Process.h" namespace Core { auto Process::GetPath() const noexcept -> const FileSystem::Path& { return m_path; } auto Process::GetCmdLine() const noexcept -> const String& { return m_cmdLine; } auto Process::GetEnvironment() const noexcept -> const String& { return m_environme...
944
331
#include "../../pitensor.h" #include "itensor/util/args.h" #include <pybind11/embed.h> namespace py = pybind11; using namespace itensor; // TODO: Implement python version altogether? static inline auto initArgs(pybind11::module& module) { py::class_<Args> type(module, "Args"); using namespace pybind11::literals;...
1,991
630
/*========================================================================= medInria Copyright (c) INRIA 2013 - 2019. All rights reserved. See LICENSE.txt for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE....
4,671
1,334
/* This program is free software; you can redistribute it and/or modify it under the terms of the European Union Public Licence - EUPL v.1.1 as published by the European Commission. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCH...
12,962
4,777
// -*- C++ -*- // Copyright (C) Dmitry Igrishin // For conditions of distribution and use, see files LICENSE.txt or net.hpp #ifndef DMITIGR_NET_CLIENT_HPP #define DMITIGR_NET_CLIENT_HPP #include "dmitigr/net/descriptor.hpp" #include "dmitigr/net/endpoint.hpp" #include "dmitigr/net/socket.hpp" #include <cassert> #inc...
1,913
663
//---------------------------------------------------------------------------// /* Copyright (c) 2012, Stuart R. Slattery All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *: Redistributions o...
6,186
1,788