Ignore:
Timestamp:
Mar 5, 2008, 3:56:13 AM (14 years ago)
Author:
Peter
Message:

returning SmartPtr? rather than conventional pointer when object is dynamically allocated - also fixed bug in SubsetGenerator? for Kernel with feature selection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/SubsetGenerator.h

    r1186 r1201  
    3333#include "Sampler.h"
    3434#include "yat/utility/Index.h"
     35#include "yat/utility/SmartPtr.h"
    3536#include "yat/utility/yat_assert.h"
    3637
     
    278279        }
    279280        features_.push_back(f_selector_->features());
    280         const KernelLookup* kl = kernel.selected(features_.back());
     281        utility::SmartPtr<const KernelLookup> kl =
     282          kernel.selected(features_.back());
    281283        // Dynamically allocated. Must be deleted in destructor.
    282         training_data_.push_back(new KernelLookup(kernel,training_index(k),
     284        training_data_.push_back(new KernelLookup(*kl,training_index(k),
    283285                                                  training_index(k)));
    284         validation_data_.push_back(new KernelLookup(kernel, training_index(k),
     286        validation_data_.push_back(new KernelLookup(*kl, training_index(k),
    285287                                                    validation_index(k)));
    286         utility::yat_assert<std::runtime_error>(kl);
    287         delete kl;
    288288      }
    289289      else {// no feature selection
Note: See TracChangeset for help on using the changeset viewer.