Minor fix in std::packed_any

This commit is contained in:
Eduardo Bart
2012-08-02 06:27:16 -03:00
parent 57785d2001
commit ee4f155b92
3 changed files with 4 additions and 2 deletions

View File

@@ -81,7 +81,7 @@ public:
bool empty() const { return !scalar && !content; }
template<typename T> T cast() const;
const std::type_info& type() const {
if(scalar)
if(!scalar)
return content ? content->type() : typeid(void);
else
return typeid(std::size_t);

View File

@@ -44,7 +44,7 @@ public:
~packed_storage() { if(m_values) delete[] m_values; }
template<typename T>
void set(Key id, T value) {
void set(Key id, const T& value) {
for(SizeType i=0;i<m_size;++i) {
if(m_values[i].id == id) {
m_values[i].value = value;