File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -44,9 +44,14 @@ impl Node {
4444 }
4545 }
4646
47+ /// Returns the number of children of the node.
48+ pub fn n_children ( & self ) -> usize {
49+ unsafe { ffi:: SCIPgetNChildren ( self . scip . raw ) as usize }
50+ }
51+
4752 /// Returns the children of the node.
4853 pub fn children ( & self ) -> Option < Vec < Node > > {
49- let num_children = unsafe { ffi :: SCIPgetNChildren ( self . scip . raw ) } ;
54+ let num_children = self . n_children ( ) ;
5055 if num_children == 0 {
5156 return None ;
5257 }
@@ -55,9 +60,9 @@ impl Node {
5560 unsafe {
5661 ffi:: SCIPgetChildren ( self . scip . raw , & mut child_nodes_ptr, std:: ptr:: null_mut ( ) ) ;
5762 }
58- let child_nodes_slice = unsafe { std:: slice:: from_raw_parts ( child_nodes_ptr, num_children as usize ) } ;
63+ let child_nodes_slice = unsafe { std:: slice:: from_raw_parts ( child_nodes_ptr, num_children) } ;
5964 // put into a Vec and transform to Node
60- let mut children_vec = Vec :: with_capacity ( num_children as usize ) ;
65+ let mut children_vec = Vec :: with_capacity ( num_children) ;
6166 for child in child_nodes_slice {
6267 children_vec. push ( Node {
6368 raw : * child,
You can’t perform that action at this time.
0 commit comments