void hashtable<_Val,_Key,_HF,_ExK,_EqK,_All> ::resize(__size_type__ __num_elements_hint) { const size_type __old_n = _M_buckets.size(); if (__num_elements_hint > __old_n) { const size_type __n = _M_next_size(__num_elements_hint); if (__n > __old_n) { _BucketVector __tmp(__n, (void*)(0), _M_buckets.get_allocator()); __STL_TRY { for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) { _Node* __first = (_Node*)_M_buckets[__bucket]; while (__first) { size_type __new_bucket = _M_bkt_num(__first->_M_val, __n); _M_buckets[__bucket] = __first->_M_next; __first->_M_next = (_Node*)__tmp[__new_bucket]; __tmp[__new_bucket] = __first; __first = (_Node*)_M_buckets[__bucket]; } } _M_buckets.swap(__tmp); } # ifdef __STL_USE_EXCEPTIONS catch(...) { for (size_type __bucket = 0; __bucket < __tmp.size(); ++__bucket) { while (__tmp[__bucket]) { _Node* __next = ((_Node*)__tmp[__bucket])->_M_next; _M_delete_node((_Node*)__tmp[__bucket]); __tmp[__bucket] = __next; } } throw; } # endif /* __STL_USE_EXCEPTIONS */ }
template < typename _Tp > void stdswap (_Tp & __a, _Tp & __b) { _Tp __tmp (__a); __a = (__b); __b = (__tmp); }
valarray<_Tp> valarray<_Tp>::operator[](const _Valarray_size_t& __addr) const { valarray<_Tp> __tmp(__addr.size(), _NoInit()); for (size_t __i = 0; __i < __addr.size(); ++__i) __tmp[__i] = (*this)[__addr[__i]]; return __tmp; }
valarray<_Tp> valarray<_Tp>::operator[](const gslice& __slice) const { valarray<_Tp> __tmp(__slice._M_size(), _NoInit()); if (__tmp.size() != 0) { _Gslice_Iter __i(__slice); do __tmp[__i._M_step] = (*this)[__i._M_1d_idx]; while(__i._M_incr()); } return __tmp; }
valarray<_Tp> valarray<_Tp>::operator[](slice __slice) const { valarray<_Tp> __tmp(__slice.size(), _NoInit()); size_t __index = __slice.start(); for (size_t __i = 0; __i < __slice.size(); ++__i, __index += __slice.stride()) __tmp[__i] = (*this)[__index]; return __tmp; }
void _VECTOR_IMPL<_Tp, _Alloc>::_M_fill_assign(size_t __n, const _Tp& __val) { if (__n > capacity()) { _VECTOR_IMPL<_Tp, _Alloc> __tmp(__n, __val, get_allocator()); __tmp.swap(*this); } else if (__n > size()) { fill(begin(), end(), __val); this->_M_finish = __uninitialized_fill_n(this->_M_finish, __n - size(), __val, _PODType()); } else erase(__fill_n(begin(), __n, __val), end()); }
transducer_ptr_type clone() const { std::auto_ptr<GrammarUnknown> __tmp(new GrammarUnknown(*this)); __tmp->signature = &signature_type::create(signature->algorithm()); if (__grammar_oov) __tmp->__grammar_oov = __grammar_oov->clone(); return transducer_ptr_type(__tmp.release()); }
void __vector__<_Tp, _Alloc>::_M_fill_assign(size_t __n, const _Tp& __val) { if (__n > capacity()) { __vector__<_Tp, _Alloc> __tmp(__n, __val, get_allocator()); __tmp.swap(*this); } else if (__n > size()) { fill(begin(), end(), __val); this->_M_finish = _STLP_STD::uninitialized_fill_n(this->_M_finish, __n - size(), __val); } else erase(_STLP_STD::fill_n(begin(), __n, __val), end()); }
valarray<_Tp> valarray<_Tp>::shift(int __n) const { valarray<_Tp> __tmp(this->size()); if (__n >= 0) { if (__n < this->size()) copy(this->_M_first + __n, this->_M_first + this->size(), __tmp._M_first); } else { if (-__n < this->size()) copy(this->_M_first, this->_M_first + this->size() + __n, __tmp._M_first - __n); } return __tmp; }
valarray<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask) const { size_t _p_size = 0; { for (size_t __i = 0; __i < __mask.size(); ++__i) if (__mask[__i]) ++_p_size; } valarray<_Tp> __tmp(_p_size, _NoInit()); size_t __idx = 0; { for (size_t __i = 0; __i < __mask.size(); ++__i) if (__mask[__i]) __tmp[__idx++] = (*this)[__i]; } return __tmp; }
valarray<_Tp> valarray<_Tp>::cshift(int __m) const { valarray<_Tp> __tmp(this->size()); // Reduce __m to an equivalent number in the range [0, size()). We // have to be careful with negative numbers, since the sign of a % b // is unspecified when a < 0. long __n = __m; if (this->size() < (numeric_limits<long>::max)()) __n %= long(this->size()); if (__n < 0) __n += this->size(); copy(this->_M_first, this->_M_first + __n, __tmp._M_first + (this->size() - __n)); copy(this->_M_first + __n, this->_M_first + this->size(), __tmp._M_first); return __tmp; }
void DGLProgram::Load() { DResource::Load(); this->ProgramID = glCreateProgram(); for (auto &Shader : this->Shaders) { glAttachShader(this->ProgramID, Shader->GetShader()); } glLinkProgram(this->ProgramID); GLint Result = GL_FALSE; int InfoLogLength; glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result); glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength); if (Result == GL_FALSE){ std::vector<char> ProgramErrorMessage(std::max(InfoLogLength + 1, 1)); glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]); std::string __tmp(ProgramErrorMessage.begin(), ProgramErrorMessage.end()); DApp::DF->DebugManager->Error(this, "Program Status: " + __tmp); } }
_Valarray_bool valarray<_Tp>:: operator!() const { _Valarray_bool __tmp(this->size(), _Valarray_bool::_NoInit()); for (size_t __i = 0; __i < this->size(); ++__i) __tmp[__i] = !(*this)[__i]; return __tmp; }
FILE *rpp::pp::find_include_file(std::string const &p_input_filename, std::string *p_filepath, INCLUDE_POLICY p_include_policy, bool p_skip_current_path) { assert(p_filepath != 0); assert(!p_input_filename.empty()); p_filepath->assign(p_input_filename); if(is_absolute(*p_filepath)) return std::fopen(p_filepath->c_str(), "r"); if(!env.current_file.empty()) _PP_internal::extract_file_path(env.current_file, p_filepath); if(p_include_policy == INCLUDE_LOCAL && !p_skip_current_path) { std::string __tmp(*p_filepath); __tmp += p_input_filename; if(file_exists(__tmp) && !file_isdir(__tmp)) { p_filepath->append(p_input_filename); if((verbose & DEBUGLOG_INCLUDE_DIRECTIVE) != 0) std::cout << "** INCLUDE local " << *p_filepath << ": found" << std::endl; return std::fopen(p_filepath->c_str(), "r"); } } std::vector<std::string>::const_iterator it = include_paths.begin(); if(p_skip_current_path) { it = std::find(include_paths.begin(), include_paths.end(), *p_filepath); if(it != include_paths.end()) { ++it; } else { it = include_paths.begin(); } } for(; it != include_paths.end(); ++it) { if(p_skip_current_path && it == include_paths.begin()) continue; p_filepath->assign(*it); p_filepath->append(p_input_filename); #ifdef Q_OS_MAC /* On MacOSX for those not familiar with the platform, it can group a collection of things * like libraries/header files as installable modules called a framework. A framework has * a well defined layout, so <OpenGL/gl.h> would be transformed into a path * /.../OpenGL.framework/Headers/gl.h */ QString string = QString::fromStdString(p_input_filename); //QStringList list = string.split("/"); //could be used for error checks QString module = string.split("/")[0]; if(!module.contains('.')) { string.replace(module + "/", module + ".framework/Headers/"); string = QString::fromStdString(*it) + string; QFileInfo file = QFileInfo(string); if(file.exists() && file.isFile()) { QString path = QString::fromStdString(*it) + module + ".framework/Headers"; push_include_path(path.toStdString()); if((verbose & DEBUGLOG_INCLUDE_DIRECTIVE) != 0) std::cout << "** INCLUDE system " << string.toStdString() << ": found" << std::endl; return std::fopen(string.toLatin1().data(), "r"); } } #endif if(file_exists(*p_filepath) && !file_isdir(*p_filepath)) { if((verbose & DEBUGLOG_INCLUDE_DIRECTIVE) != 0) std::cout << "** INCLUDE system " << *p_filepath << ": found" << std::endl; return std::fopen(p_filepath->c_str(), "r"); } // Log all search attempts if((verbose & DEBUGLOG_INCLUDE_FULL) != 0) std::cout << "** INCLUDE system " << *p_filepath << ": " << strerror(errno) << std::endl; } return 0; }