Esempio n. 1
0
	iterator emplace(Tn&&... argn) {
		if (container.empty()) {
			return container.emplace(cend(), std::forward<Tn>(argn)...);
		}
		auto elementgreaterthanorequalto = std::lower_bound(cbegin(), cend(), val, std::ref(compare_predicate));
		return container.emplace(elementgreaterthanorequalto, std::forward<Tn>(argn)...);
	}
Esempio n. 2
0
	iterator emplace(Tn&&... argn) {
		if (container.empty()) {
			return container.insert(detail::adl_cend(container), std::forward<Tn>(argn)...);
		}
		auto elementgreaterthanorequalto = std::lower_bound(detail::adl_cbegin(container), detail::adl_cend(container), val, std::ref(predicate));
		return container.emplace(elementgreaterthanorequalto, std::forward<Tn>(argn)...);
	}
Esempio n. 3
0
 inline std::enable_if_t<std::is_base_of<T, std::decay_t<U>>::value> push(U&& value) {
     std::unique_lock<std::mutex> lock(mut);
     // only add the value on the stack if there is room
     data_cond.wait(lock, [this]{
         return (data_queue.size() < capacity) || shutdownFlag;
     });
     data_queue.emplace(std::make_shared<
         std::decay_t<U>> (std::forward<U>(value)));
     data_cond.notify_one();
 }
Esempio n. 4
0
 inline std::enable_if_t<std::is_base_of<T, U>::value> push(std::shared_ptr<U>&& ptr)
 {
     std::unique_lock<std::mutex> lock(mut);
     // only add the value on the stack if there is room
     data_cond.wait(lock, [this]{
         return (data_queue.size() < capacity) || shutdownFlag;
     });
     if (!shutdownFlag) {
         data_queue.emplace(std::move(ptr)); // move the pointer
     }
     data_cond.notify_one();
 }
Esempio n. 5
0
	iterator emplace(Tn&&... argn) {
		auto x = container.emplace(std::forward<Tn>(argn)...);
		return x.first;
	}