16 #ifndef INCLUDE_MOLASSEMBLER_TEMPLE_ADD_TO_CONTAINER_H
17 #define INCLUDE_MOLASSEMBLER_TEMPLE_ADD_TO_CONTAINER_H
23 namespace Molassembler {
30 template<
class Container,
typename T>
40 template<
class Container,
typename T>
69 class TargetContainer,
70 class SourceContainer,
71 class SizeModifierUnary = Functor::Identity
73 TargetContainer& target,
74 const SourceContainer& source,
75 SizeModifierUnary&& sourceModifierUnary = SizeModifierUnary {}
81 template<
class Container,
typename T>
84 Traits::getValueType<Container>,
86 >::value && Traits::hasPushBack<Container>::value,
92 container.push_back(value);
96 template<
class Container,
typename T>
99 Traits::getValueType<Container>,
101 >::value && Traits::hasInsert<Container>::value,
107 container.insert(value);
111 template<
class Container,
typename T>
114 Traits::getValueType<Container>,
116 >::value && Traits::hasEmplaceBack<Container>::value,
118 > emplaceOrEmplaceBack(
122 container.emplace_back(std::forward<T>(value));
126 template<
class Container,
typename T>
129 Traits::getValueType<Container>,
131 >::value && Traits::hasEmplace<Container>::value,
133 > emplaceOrEmplaceBack(
137 container.emplace(std::forward<T>(value));
141 template<
class TargetContainer,
class SourceContainer,
class SizeModifierUnary>
144 Traits::hasSize<SourceContainer>::value
145 && Traits::hasReserve<TargetContainer>::value
149 TargetContainer& target,
150 const SourceContainer& source,
151 SizeModifierUnary&& sizeModifierUnary
161 template<
class TargetContainer,
class SourceContainer,
class SizeModifierUnary>
164 Traits::hasSize<SourceContainer>::value
165 && Traits::hasReserve<TargetContainer>::value
170 const SourceContainer& ,
178 template<
class Container,
typename T>
183 Detail::insertOrPushBack(container, value);
186 template<
class Container,
typename T>
191 Detail::emplaceOrEmplaceBack(
193 std::forward<T>(value)
198 class TargetContainer,
199 class SourceContainer,
200 class SizeModifierUnary
202 TargetContainer& target,
203 const SourceContainer& source,
204 SizeModifierUnary&& sourceModifierUnary
206 return Detail::reserve(
209 std::forward<SizeModifierUnary>(sourceModifierUnary)
void reserveIfPossible(TargetContainer &target, const SourceContainer &source, SizeModifierUnary &&sourceModifierUnary=SizeModifierUnary{})
Rerves the space required in the target container if size can be determined from the source container...
Definition: AddToContainer.h:201
Provides functors for transformations.
void addToContainer(Container &container, const T &value)
Adds an lvalue element to a container by calling the container's insert or push_back member functions...
Definition: AddToContainer.h:179
Compile-time container type traits.