fix bug that treebox::item_proxy::size returns the depth of the node

This commit is contained in:
Jinhao 2018-04-01 00:11:19 +08:00
parent dd0c75fb0d
commit 335305c97c

View File

@ -1,7 +1,7 @@
/*
* A Treebox Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@ -958,10 +958,14 @@ namespace nana
return *this;
}
std::size_t item_proxy::size() const
{
std::size_t n = 0;
for(auto child = node_->child; child; child = child->child)
//Fixed by ErrorFlynn
//this method incorrectly returned the number of levels beneath the nodes using child = child->child
for(auto child = node_->child; child; child = child->next)
++n;
return n;