lang
stringclasses
10 values
seed
stringlengths
5
2.12k
cpp
ObjMap::ObjMap(const std::string& filename, TextureAtlas& atlas) : m_atlas(atlas) { this->rng = SeedRNG(); this->loadFromFile(filename); }
cpp
bool _clockFrequencyFixed = false; // Default to 1 THz (1 Tick == 1 ps) Tick _ticksPerSecond = 1e12; } // anonymous namespace void fixClockFrequency() { if (_clockFrequencyFixed)
cpp
// // SRPC-abstraction wrappers around PPB_NetworkMonitor_Private functions. #include <string.h> #include <limits> #include "native_client/src/include/nacl_macros.h" #include "native_client/src/shared/ppapi_proxy/browser_callback.h" #include "native_client/src/shared/ppapi_proxy/browser_globals.h" #include "native_cl...
cpp
else { x1 = (-b+sqrt(D)) / (2 * a); x2 = (-b - sqrt(D)) / (2 * a); cout << x1 << " " << x2 << endl; }
cpp
} } } void KernelGraph::ReplaceNode(NotNull<AnfNodePtr> old_anf_node, NotNull<AnfNodePtr> new_anf_node) { MS_EXCEPTION_IF_NULL(inputs_); { std::queue<AnfNodePtr> seed_nodes; UpdateNodeEdgeList(&seed_nodes); } auto it = node_output_edges_.find(old_anf_node); if (it != node_output_edges_.end()) {...
cpp
items.pop(); } else { return false; } } return true; }
cpp
const char* interpretNewLine(int modifiers) { WebKeyboardEvent keyboardEvent; setupKeyDownEvent(&keyboardEvent, '\r', modifiers); return interpretKeyEvent(keyboardEvent, PlatformEvent::Char); } // A name for "no modifiers set". static const int noModifiers = 0; };
cpp
// This file has been generated by Py++. #ifndef QPolygon_hpp__pyplusplus_wrapper #define QPolygon_hpp__pyplusplus_wrapper void register_QPolygon_class(); #endif//QPolygon_hpp__pyplusplus_wrapper
cpp
//////////////////////////////////////////////////////////////////////////////// #include "HoardResourceCache.h" Hoard::HoardResourceCache::HoardResourceCache() {
cpp
memory[address >> 1] = value | (readByte(address + 1) << 8); } void USB_SRAM::writeHalfword(uint32_t address, uint16_t value) { auto memory = (uint16_t*)BASE_ADDRESS; address >>= 1; memory[address] = value; }
cpp
draw(world); } } int main(){ std::string A_world[r][c]; Player player; init(A_world, player);
cpp
buffer = StripLeft(buffer, end); if (buffer < end) { switch (*buffer) { case '}': /* end of block */ if (block)
cpp
<gh_stars>1-10 #include "symbol.h" #include "symbol_table.h" symbol::symbol(typesystem::info* info, symbol_reference* definition) : info { info } , definition { definition } , inner_scope { nullptr }
cpp
* Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkFlattenableSerialization.h" #include "SkData.h" #include "SkImageFilter.h" SkData* SkValidatingSerializeFlattenable(SkFlattenable* flattenable) { return flattenable->serialize().release(); }
cpp
bool bcells = true; map_type cell_map = map_reduce(graph_traversal_cell_wf(), reduce_map_wf(), mesh_vw); bcells = bcells && (cell_map.size() == mesh_vw.size()); ct = 0; for (map_it = cell_map.begin(); map_it != cell_map.end(); ++map_it) { if ((map_it->first != ct) || (map_it->second != 1))
cpp
int main() { //freopen("factor.in","r",stdin);freopen("factor.out","w",stdout); scanf("%d %d %d %d %d", &a, &b, &k, &n, &m); triangle[1][1] = 1; triangle[1][2] = 1; for (int i = 2; i <= k; i++) for (int j = 1; j <= i + 1; j++) triangle[i][j] = (triangle[i - 1][j] + triangle[i - 1][j - 1]) % MOD; ans = triang...
cpp
B<T>::foo(); // expected-error {{call to non-static member function without an object argument}} } void test3() { C<T>::foo(); // expected-error {{no member named 'foo'}} } }; template <class T> struct B : A<T> {
cpp
dir = dir * mat; up = up * mat; mat.makeRotate(osg::DegreesToRadians(ae[0]), zAxis); dir = dir * mat; up = up * mat; } osg::Vec2d VectorFunctions::azElFromVec(osg::Vec3d vecDir)
cpp
} else { const int iMaxBitAllowedCode = CSurveyData::BitCode::OrdLine | CSurveyData::BitCode::OnlyTxt | CSurveyData::BitCode::OnlyBlk | CSurveyData::BitCode::MidPt; double dValue; const char chConstMinCol = 'A'; if(!_ParseRawXLData(OleVar, &dValue)) { strMsg.Format("ERROR: Invalid val...
cpp
vtkInformation *outInfo = outInfoVec->GetInformationObject(0); // get the input and output vtkDataSet *input = vtkDataSet::SafeDownCast( inInfo->Get(vtkDataObject::DATA_OBJECT())); vtkDataSet *output = vtkDataSet::SafeDownCast(
cpp
IoControlCode); SynaPrint(DEBUG_LEVEL_INFO, DBG_IOCTL, "%s, Queue:0x%p, Request:0x%p\n", DbgHidInternalIoctlString(IoControlCode), FxQueue, FxRequest ); // // Translate the test IOCTL into the appropriate // SPB API method. Open and close are completed // synchronously. // switch (IoControlCode)
cpp
void bar (char *p, int size) { __builtin_strncpy (p, "good", size); } class Base {}; struct A : virtual public Base { A() {} };
cpp
case L1Cache_State_M: return AccessPermission_Read_Write; case L1Cache_State_MI: return AccessPermission_Busy; case L1Cache_State_MII: return AccessPermission_Busy;
cpp
typedef itk::BinaryThresholdImageFilter<ImageType, ImageType> BinaryThresholdFilterType; typedef itk::BinaryContourImageFilter <ImageType, ImageType > binaryContourImageFilterType; typedef itk::ConnectedComponentImageFilter<ImageType, OutputImageType> ConnectednessFilterType; typedef itk::RelabelComponentIm...
cpp
/* LC_NOTICE_BEGIN =============================================================================== | Copyright (C) 2021 <NAME> | |-----------------------------------------------------------------------------| | Important notices: ...
cpp
namespace plansys2 { class PlannerClient : public PlannerInterface { public: PlannerClient();
cpp
k[1][1] = 2; //ss a[0][0] = 0.475; //ff a[1][0] = a[0][1] = 0.8; //fs a[1][1] = 0.619; //ss b[0][0] = 1.5; b[1][0] = b[0][1] = 1.2;
cpp
HttpController controller; qDebug() << controller.Get("http://doc.qt.io/qt-4.8/qtnetwork-module.html");
cpp
typedef struct treeNode { char data; bool ltag = false, rtag = false;//提示左右节点是否存在
cpp
namespace aiko { namespace postprocessing { Effect::Effect(const std::string& name) : m_name(name) , m_enabled(false) { }
cpp
#include <boost/test/unit_test.hpp> using namespace std; extern "C" { void validate_pffft_simd(); } // extern "C" BOOST_AUTO_TEST_CASE( test_pffft_vectorization ) {
cpp
const Eigen::MatrixBase<JacobianOut_t> & J) const { if (arg == ARG0) PINOCCHIO_EIGEN_CONST_CAST(JacobianOut_t,J) = -JacobianMatrix_t::Identity(); else if (arg == ARG1) PINOCCHIO_EIGEN_CONST_CAST(JacobianOut_t,J).setIdentity(); } template <class ConfigI...
cpp
#include <boost/detail/workaround.hpp> namespace boost { namespace spirit { namespace detail { template <typename Context> struct what_function { what_function(info& what, Context& context) : what(what), context(context)
cpp
m_background_color = _color_from_attribute(m_default_background >> WINCC_BG_SHIFT); m_current_text_attribute = _compute_text_attribute(m_foreground_color, m_background_color); SetConsoleTextAttribute(m_console_handle, (WORD)m_current_text_attribute); } void wincc::Console::write(const char *msg) { pri...
cpp
agentTree_[node].left = node + 1; agentTree_[node].right = node + 2 * leftSize; buildAgentTreeRecursive(begin, left, agentTree_[node].left); buildAgentTreeRecursive(left, end, agentTree_[node].right); } }
cpp
double minDistance(Point A, Point B, Point E); double lineLength(Point p1, Point p2); void findBaseLine(Mat src, Point& A, Point& B, double max_a=1.0); void findTriangle(Mat src, Point A, Point B, Point2f (&triangle)[3], double& line_len); vector<cv::Point> findHighestWhitePixels(int img_height, vector<int> vector_of_...
cpp
class StdSelect_BRepOwner; class TopoDS_Face; //! Tool to create specific selections (sets of primitives) //! for Shapes from Topology.
cpp
EXPECT_FEQ(ClearColor, c1); Color3f c2; m_tile.get_pixel(TileWidth - 1, TileHeight - 1, c2); EXPECT_FEQ(ClearColor, c2); } }
cpp
* 42. * Convert the following while loop to a for loop: * * int count = 0; * * while (count < 50) * { * cout << "count is " << count << endl;
cpp
start_pos(start), end_pos(end) { } // Create a path with an explicit coordinate start and end point derived from velocity Path(game::EntityId id, math::Vec2d start, const math::Velocity& velocity, double radius) : Path(id, start, start + velocity,radius) { }
cpp
// configure new docsum tools if (docsumTools->obtainFieldNames(vsmSummary)) { // latch new docsum tools into production _docsumTools.set(docsumTools.release()); _docsumTools.latch(); } else { throw std::runtime_error("(re-)configuration of VSM (docsum tools) failed"); } ...
cpp
iterate(Y, X, mode, direction); if(onBoard(Y, X)) if(board[Y][X] != '0') return true; } } return false; }
cpp
vector<int> findErrorNums(vector<int>& nums) { int n = nums.size(), sum = 0, dup = 0, miss = 0; vector<int>count(n, 0); for(int i = 0; i < n; sum += nums[i++]) if(++count[nums[i] - 1] > 1) dup = nums[i]; miss = n * (n + 1) / 2 - sum + dup;
cpp
#include <vector> using namespace std; int maxArea(vector<int>& height) { int max_global = 0; for (int i = 0; i<height.size() - 1; i++) { int max_sub = 0; for (int j = i + 1; j<height.size(); j++) { int sum = 0; int shorter = (height[j] > height[i]) ? height[i] : height[j];
cpp
# titanium.dat matid = 2961 name = titanium # These set the number of grid poitns per decade # for each variable. The default is 50 points. numrho/decade = 30 numT/decade = 25
cpp
{ return baseTotalAmountWithoutTax_; } std::string GetInvoiceInfoResult::getInvoiceCode()const { return invoiceCode_; } long GetInvoiceInfoResult::getCreatedStamp()const {
cpp
import M; #include <stdio.h> int main() { printf("%d\n", f(5)); printf("%f\n", g(0.0, 1)); return 0; }
cpp
typename C<T>::T const& y, typename C<T>::T const& z, typename C<T>::T const& w ) {
cpp
const std::list<IM::BaseDefine::IpAddr>& addrs = ConfigUtil::GetInstance()->GetAddressList(); for (std::list<IM::BaseDefine::IpAddr>::const_iterator it=addrs.begin(); it!=addrs.end(); ++it) { IM::BaseDefine::IpAddr* addr = msg.add_ip_addr_list(); *addr = *it; log("Upload file_client...
cpp
} return res; } }a,dp,res; int n,m,x,y; inline void read(int &x)
cpp
} } void displayPassengers(Flight* flight) { Passengers* temp = flight->pHead; cout << "\n\nPassengers: " << endl; while (temp != NULL) { cout << temp->Name << endl;
cpp
BlastFamilyDesc familyDesc {*m_asset, m_mockListener.get(), nullptr, Physics::MaterialId(), *m_blastMaterial, m_fakeActorFactory, m_fakeEntityProvider, blastActorConfigurati...
cpp
} }; } auto forEach = [](auto task) { return [task](auto&&xs) -> seq<decltype(first(xs))> { return F::forEach(FWD(xs), task); };
cpp
int func(int x) { return x + 2; } int main(int argc, char* argv[]) { std::promise<int> pr; std::thread th([] (std::promise<int>& p) { p.set_value_at_thread_exit(9); }, std::ref(pr));
cpp
int dx = abs(bx - x), dy = abs(by - y); if (!((dx == 1 && dy == 2) || (dx == 2 && dy == 1))) { //cout << bx << ", " << by << " => " << x << ", " << y << endl; invalid = true; } else { VIS[y][x] = 1; } bx = x, by = y; } int total = 0; for (int i = 1; i <= 6; i++) for (int j = 1; j <= 6; j++) ...
cpp
if (!ok) { int index1 = range_index(preproc_ranges, i); int index2 = range_index(singleline_comment_ranges, i); int index3 = range_index(multiline_comment_ranges, i); if (index1 > -1) { i = preproc_ranges[index1].second + 1; } else if (...
cpp
#include "utils.h" std::string human_join_or(std::vector<std::string> const &parts) { std::string output; for (int i = 0, n = parts.size(); i < n; i++) { if (i != 0 && i == n - 1) { output += " or "; } else if (i != 0) { output += ", ";
cpp
}} #endif
cpp
if (path == QLatin1String("404") || path == QLatin1String("500")) { auto *reply = new QCustomNetworkReply(this); if (path == QLatin1String("404")) { reply->setHttpStatusCode(404, "Not Found"); reply->setNetworkError(QNetworkReply::ContentNotFoundError, QStringLiteral("Not Found")); } else ...
cpp
std::cout << std::setw(2) << std::setfill('0') << std::hex << static_cast<int>(c); } #endif size_t send_result = sendto(fd_, data_to_send.data(), data_to_send.size(), 0, (struct sockaddr *) &gripper_sockaddr_...
cpp
ambigAlts, configs); } } void ProxyErrorListener::reportAttemptingFullContext( Parser* recognizer, const dfa::DFA& dfa, size_t startIndex, size_t stopIndex, const antlrcpp::BitSet& conflictingAlts, atn::ATNConfigSet* configs) { for (auto listener : _delegates) { listen...
cpp
//create non-central relative adapter relative_pose::NoncentralRelativeAdapter adapter( bearingVectors1, bearingVectors2, camCorrespondences1, camCorrespondences2, camOffsets, camRotations, position, rota...
cpp
} // Perform non-vector operations for any remaining items. for (int k = limit - limit_by_4 * 4; k > 0; --k, ++h_p, ++x_p) { const float x_k = *x_p; x2_sum += x_k * x_k; s += *h_p * x_k; }
cpp
public: explicit Timers(QObject *parent); void load(const QList<Interval> &intervals); private: void reset(); void add(const Interval &interval); static auto timeTo(const QTime &time) -> int; auto getInterval(QTimer *timer) -> Interval; void notify(const Interval &interval); QHash<QTimer*, Interval> timers;
cpp
int Hav = -10000; totalHit = 0; for (int i = 0; i < BOARD_NUMBER; i++) { // next user drop check
cpp
#include <boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp>
cpp
PrintError("expected escape: \\uxxxx"); return wabt::Result::Error; } uint16_t code = 0; for (int i = 0; i < 4; ++i) { c = ReadChar(); int cval; if (c >= '0' && c <= '9') { cval = c - '0'; } else if (c >= 'a' && c <= 'f') { cval = c -...
cpp
// Remove now the anchor view and make sure that the original found rect // is still kept, so that the bubble does not jump when the view gets deleted. anchor_widget->GetContentsView()->RemoveChildView(anchor_view.get()); anchor_view.reset(); EXPECT_EQ(NULL, bubble_delegate->GetAnchorView()); EXPECT_EQ(view...
cpp
#include "StdString.h" #include "UiText.h" #include "Widget.h" #include "Color.h" #include "Panel.h" #include "Label.h" #include "TextFlow.h" #include "Image.h" #include "ImageWindow.h" #include "UiConfiguration.h" #include "HelpActionWindow.h" #include "HyperlinkWindow.h" #include "HelpWindow.h" HelpWindow::HelpWindo...
cpp
.name(name() + ".readPktSize") .desc("Read request sizes (log2)"); writePktSize .init(ceilLog2(burstLength) + 1) .name(name() + ".writePktSize") .desc("Write request sizes (log2)"); /*rdQLenPdf .init(readBufferSize)
cpp
pid_t pid; //create a child process if ((pid = fork()) < 0) { std::cout << "can't create child process!" << std::endl; } else { if (pid != 0) { exit(0); } } if (chdir("/") < 0) {
cpp
set_table_layout(1,0); // When in network mode, display only local map info (and nickname changer) // When not in network mode, display server picker if ( !env_t::networkmode ) { new_component<gui_label_t>("Select a server to join:" );
cpp
} y += 3; } } }
cpp
void BLEAdvertisedDevice::setAppearance(uint16_t appearance) { m_appearance = appearance; m_haveAppearance = true; ESP_LOGD(LOG_TAG, "- appearance: %d", m_appearance); } // setAppearance /** * @brief Set the manufacturer data for this device. * @param [in] The discovered manufacturer data.
cpp
auto& magma_singleton = MagmaSingleton::get_magma_singleton(); magma_scopymatrix(m_, n_, mat.storage_.get(), m_, storage_.get(), m_, magma_singleton.queue_); } } #endif template <typename DataType, typename MemorySpaceType> void LocalMatrices<DataType, MemorySpaceType>::allocate() { ...
cpp
childHyperedgeState[index] = 3; } else { childHyperedgeState[index] = 2; } } } edgeIntroductionCheckNeeded = edgeIn...
cpp
deck.clear(); for(x = 0; x<2;x++) { scanf("%s",msk); deck+=msk; } for(x=0;x<4;x++) card[x].clear(); for(x=0;x<deck.size();x+=2) { for(y=0;y<4;y++) if(deck[x]==color[y]) break; for(z=0;z<13;z++) if(deck[x+1]==value[z]) break; now = (now+1)%4;
cpp
float producto = 0; //Precio definido del producto int cantidad = 0; //Cantidad de productos que se compran float iva = 0.15; //Será igual al 15% del costottl float costo1 = 0; //Suma de costo e iva float costo2 = 0; //Costo bruto menos el descuento float descuento = 0.05; //si se desea mostrar el descuento void ingr...
cpp
"ldr x20, [%x[a_ptr], #0x8]\n" // Load A[B].upper "smlal v10.4s, %[b0].4h, %[aa].h[5]\n" "smlal v11.4s, %[b0].4h, %[aa].h[6]\n" "ldr %d[b2], [%x[b_ptr], #0x8]\n" // Load B[2].lower "ins %[ab].d[1], x20\n" // Merge A[B].lower and .upper "smlal v12.4s, %[b0]....
cpp
const EVP_PKEY* _pEVP; EVPPKeyContext _pCtx; int _blockSize; std::streamsize _pos; unsigned char* _pBuf; }; class EVPDecryptImpl: public CryptoTransform { public: EVPDecryptImpl(const EVP_PKEY* pEVP): _pEVP(pEVP), _pCtx(_pEVP),
cpp
typedef std::vector<char> bytes; struct permission_level_weight { permission_level permission; weight_type weight; // explicit serialization macro is not necessary, used here only to improve compilation time
cpp
// 8. Let patternParts be PartitionPattern(pattern). auto pattern_parts = pattern->visit([](auto const& p) { return partition_pattern(p); }); // 9. For each Record { [[Type]], [[Value]] } patternPart of patternParts, do for (auto& pattern_part : pattern_parts) { // a. Let p be patternPart.[[Ty...
cpp
namespace commands { AudioStopStreamRequest::AudioStopStreamRequest( const MessageSharedPtr& message) : RequestToHMI(message) { } AudioStopStreamRequest::~AudioStopStreamRequest() { } void AudioStopStreamRequest::Run() { LOG4CXX_INFO(logger_, "AudioStopStreamRequest::Run");
cpp
const std::string &skip) { facilities::Util::expandEnvVar(&inputFile); std::ifstream file(inputFile.c_str()); lines.clear(); std::string line; while (std::getline(file, line, '\n')) { if (line != "" && line != " " //skip (most) blank lines ...
cpp
size_t lens = outer_dim_size * sizeof(float); for (size_t i = 0; i < indices_lens; ++i) { int index = indices_addr[i] - offset; if (index >= 0 && index < SizeToInt(first_dim_size)) { size_t pos = index * outer_dim_size; auto ret = memcpy_s(output_addr, lens, input_addr + pos, lens); if (re...
cpp
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INC...
cpp
#include <propeller.h> #include "test043.h" int32_t test043::Getx(void) { return test001::X; }
cpp
this->get_service().async_accept(this->get_implementation(), &io_context, static_cast<endpoint_type*>(0), init.completion_handler); return init.result.get(); #endif // defined(EGT_ASIO_ENABLE_OLD_SERVICES) } /// Accept a new connection. /** * This function is used to accept a new connection ...
cpp
const string& dir_with_data = JoinPathSegments(ets_src->data_dirs()[0], "data"); ASSERT_GT(inspect_->CountFilesInDir(dir_with_data), 3); }); // Now kick off the tablet copies. HostPort src_addr; ASSERT_OK(HostPortFromPB(ts_src->registration.rpc_addresses(0), &src_addr)); vector<thread> threads; aut...
cpp
//! @todo How to forward `x` here? Since the arguments to `if_` //! can be evaluated in any order, we have to be careful not to //! use `x` in a moved-from state. return hana::if_(x, x, static_cast<Y&&>(y)); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA...
cpp
#pragma once #include <memory> #include <string> namespace zizany { class unity_value; class unity_value_member { public: const std::string name; std::unique_ptr<unity_value> value; unity_value_member(const std::string &name_, std::unique_ptr<unity_value> &&value_); };
cpp
//These features only have locations set for them for (unsigned int i = 0; i < numkpts; i++) { vital::feature_f *f = new vital::feature_f();
cpp
void withdraw(double amount) { std::lock_guard<std::mutex> lg(m); balance += amount; } void deposit(double amount) { std::lock_guard<std::mutex> lg(m); balance += amount; }
cpp
} catch (std::exception const& e) { string s = "Could not index element: " + string(e.what()); PyErr_SetString(PyExc_BaseException, s.c_str()); return NULL; } } PyObject* _GreedyCoverInstance_size(PyObject* self, PyObject* args, PyObject* keywds) { PyObject* py_gci = NULL; stati...
cpp
* @param time start time at which the activity should be scheduled * @param activity activity index * @return true if the activity satisfies all resource constraints, else false */ bool is_schedulable(unsigned int time, unsigned int activity) const; /**
cpp
Action* sequence = Actions::Sequence::New( { Actions::FadeIn::New( Seconds( 0.125 ) ), Actions::Delay::New( Seconds( 2.5 ) ), Actions::FadeOut::New( Seconds( 0.125 ) ), Actions::Close::New() } ); tv->runAction( sequence ); return tv;
cpp
Bowtie2SettingsWidget::Bowtie2SettingsWidget(QWidget *parent) : DnaAssemblyAlgorithmMainWidget(parent) { setupUi(this); layout()->setContentsMargins(0, 0, 0, 0); threadsSpinBox->setMaximum(AppContext::getAppSettings()->getAppResourcePool()->getIdealThreadCount()); threadsSpinBox->setValue(AppContex...
cpp
} /***************************************** CONSTRUCTOR *****************************************/ Walker::Walker(int x, int y) { this->x = x; this->y = y; } /***********************************************************************************************/ /************************************** PRIVATE FUN...
cpp
// // You should have received a copy of the GNU Lesser General Public License // along with this library; if not, write to the Free Software Foundation, // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // The developer's email is <EMAIL> (for great email, take // off every 'zig'.) // #incl...
cpp
int main() { srand(time(NULL)); for(int _ = 21; _ <= 25; ++_) { string str = "problem12/";