Skip to content

Commit

Permalink
Creating empty constructor for rowset
Browse files Browse the repository at this point in the history
  • Loading branch information
cstiborg committed Oct 11, 2023
1 parent 6f40cf6 commit 356deec
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions include/soci/rowset.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class rowset_iterator
: st_(0), define_(0)
{}

rowset_iterator(statement & st, T & define)
: st_(&st), define_(&define)
rowset_iterator(statement * st, T * define)
: st_(st), define_(define)
{
// Fetch first row to properly initialize iterator
++(*this);
Expand Down Expand Up @@ -113,6 +113,11 @@ class rowset_impl

typedef rowset_iterator<T> iterator;

rowset_impl()
: refs_(1), st_(nullptr), define_(nullptr)
{
}

rowset_impl(details::prepare_temp_type const & prep)
: refs_(1), st_(new statement(prep)), define_(new T())
{
Expand All @@ -136,7 +141,7 @@ class rowset_impl
iterator begin() const
{
// No ownership transfer occurs here
return iterator(*st_, *define_);
return iterator(st_.get(), define_.get());
}

iterator end() const
Expand Down Expand Up @@ -184,6 +189,11 @@ class rowset

rowset(session const & session) = delete;

rowset()
: pimpl_(new details::rowset_impl<T>())
{
}

~rowset()
{
pimpl_->decRef();
Expand Down

0 comments on commit 356deec

Please sign in to comment.