summaryrefslogtreecommitdiff
path: root/libpqpp/pq-column.h
diff options
context:
space:
mode:
Diffstat (limited to 'libpqpp/pq-column.h')
-rw-r--r--libpqpp/pq-column.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/libpqpp/pq-column.h b/libpqpp/pq-column.h
index b43880e..f893fef 100644
--- a/libpqpp/pq-column.h
+++ b/libpqpp/pq-column.h
@@ -2,6 +2,7 @@
#define PG_COLUMN_H
#include <column.h>
+#include <cstring>
#include <libpq-fe.h>
namespace PQ {
@@ -19,13 +20,9 @@ namespace PQ {
inline T
valueAs() const
{
- return *(T *)(value());
- }
- template<typename T>
- inline T *
- valueAsPtr() const
- {
- return (T *)(value());
+ T v {};
+ std::memcpy(&v, value(), sizeof(T));
+ return v;
}
const char * value() const;
std::size_t length() const;