mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-16 18:56:52 +02:00
removed Var iterators, fixed SOO alignment
- removed unnecessary using directives in Data library - removed iterator pointers from Var (reduce size, always return copy) - added Alignment header (adapted from LLVM infrastructure) - added alignment guards to SOO implementations
This commit is contained in:
@@ -110,14 +110,10 @@ public:
|
||||
Var(const T& val)
|
||||
/// Creates the Var from the given value.
|
||||
#ifdef POCO_NO_SOO
|
||||
: _pHolder(new VarHolderImpl<T>(val)),
|
||||
_pBegin(new Iterator(this, false)),
|
||||
_pEnd(new Iterator(this, true))
|
||||
: _pHolder(new VarHolderImpl<T>(val))
|
||||
{
|
||||
}
|
||||
#else
|
||||
: _pBegin(new Iterator(this, false)),
|
||||
_pEnd(new Iterator(this, true))
|
||||
{
|
||||
construct(val);
|
||||
}
|
||||
@@ -135,10 +131,10 @@ public:
|
||||
void swap(Var& other);
|
||||
/// Swaps the content of the this Var with the other Var.
|
||||
|
||||
ConstIterator& begin() const;
|
||||
ConstIterator begin() const;
|
||||
/// Returns the const Var iterator.
|
||||
|
||||
ConstIterator& end() const;
|
||||
ConstIterator end() const;
|
||||
/// Returns the const Var iterator.
|
||||
|
||||
Iterator begin();
|
||||
@@ -629,7 +625,7 @@ private:
|
||||
{
|
||||
if (sizeof(VarHolderImpl<ValueType>) <= Placeholder<ValueType>::Size::value)
|
||||
{
|
||||
new (reinterpret_cast<VarHolder*>(_placeholder.holder)) VarHolderImpl<ValueType>(value);
|
||||
new (reinterpret_cast<VarHolder*>(_placeholder.holder.h)) VarHolderImpl<ValueType>(value);
|
||||
_placeholder.setLocal(true);
|
||||
}
|
||||
else
|
||||
@@ -644,7 +640,7 @@ private:
|
||||
std::string val(value);
|
||||
if (sizeof(VarHolderImpl<std::string>) <= Placeholder<std::string>::Size::value)
|
||||
{
|
||||
new (reinterpret_cast<VarHolder*>(_placeholder.holder)) VarHolderImpl<std::string>(val);
|
||||
new (reinterpret_cast<VarHolder*>(_placeholder.holder.h)) VarHolderImpl<std::string>(val);
|
||||
_placeholder.setLocal(true);
|
||||
}
|
||||
else
|
||||
@@ -676,9 +672,6 @@ private:
|
||||
Placeholder<VarHolder> _placeholder;
|
||||
|
||||
#endif // POCO_NO_SOO
|
||||
|
||||
Iterator* _pBegin;
|
||||
Iterator* _pEnd;
|
||||
};
|
||||
|
||||
|
||||
@@ -732,30 +725,28 @@ inline const std::type_info& Var::type() const
|
||||
}
|
||||
|
||||
|
||||
inline Var::ConstIterator& Var::begin() const
|
||||
inline Var::ConstIterator Var::begin() const
|
||||
{
|
||||
if (isEmpty()) _pBegin->setPosition(Iterator::POSITION_END);
|
||||
else if (*_pBegin == *_pEnd) _pBegin->setPosition(0);
|
||||
if (isEmpty()) return ConstIterator(const_cast<Var*>(this), true);
|
||||
|
||||
return *_pBegin;
|
||||
return ConstIterator(const_cast<Var*>(this), false);
|
||||
}
|
||||
|
||||
inline Var::ConstIterator& Var::end() const
|
||||
inline Var::ConstIterator Var::end() const
|
||||
{
|
||||
return *_pEnd;
|
||||
return ConstIterator(const_cast<Var*>(this), true);
|
||||
}
|
||||
|
||||
inline Var::Iterator Var::begin()
|
||||
{
|
||||
if (isEmpty()) _pBegin->setPosition(Iterator::POSITION_END);
|
||||
else if (*_pBegin == *_pEnd) _pBegin->setPosition(0);
|
||||
if (isEmpty()) return Iterator(const_cast<Var*>(this), true);
|
||||
|
||||
return *_pBegin;
|
||||
return Iterator(const_cast<Var*>(this), false);
|
||||
}
|
||||
|
||||
inline Var::Iterator Var::end()
|
||||
{
|
||||
return *_pEnd;
|
||||
return Iterator(this, true);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user