[mlpack-git] [mlpack] static assertion failed: HRectBound can only be used with the LMetric<> metric type. (#525)

Li Dong notifications at github.com
Thu Feb 25 01:20:45 EST 2016


The documentation (http://www.mlpack.org/doxygen.php?doc=rstutorial.html) says
```
template<
  typename MetricType = mlpack::metric::EuclideanDistance,
  typename TreeType = mlpack::tree::BinarySpaceTree<bound::HRectBound<2>,
                                                           ^^^^^^^^^^^^^
                                                    tree::EmptyStatistic>
>
class RangeSearch;
```
where `HRectBound<2>` is not valid anymore, `g++` (5.2.0) complains:
```
error: type/value mismatch at argument 1 in template parameter list for 'template<class MetricType> class mlpack::bound::HRectBound'
     tree::BinarySpaceTree<bound::HRectBound<2>, range::RangeSearchStat> datasetTree(dataset);
                                              ^
/Users/dongli/Dropbox/Works/CxxExamples/src/UseLibraries/MLPACK/mlpack_exam03.cpp:56:46: note:   expected a type, got '2'
/Users/dongli/Dropbox/Works/CxxExamples/src/UseLibraries/MLPACK/mlpack_exam03.cpp:56:71: error: template argument 1 is invalid
     tree::BinarySpaceTree<bound::HRectBound<2>, range::RangeSearchStat> datasetTree(dataset);

```
after read the code `mlpack/core/tree/hrectbound.hpp`, I found `HRectBound` needs `MetricType` template argument. So I changed `bound::HRectBound<2>` to `bound::HRectBound<metric::LMetric<2, true>>`, then I got the new error:
```
error: static assertion failed: HRectBound can only be used with the LMetric<> metric type.
   static_assert(meta::IsLMetric<MetricType>::Value == true,
```
but the MetricType is a LMetric.

---
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/issues/525
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160224/7cf78257/attachment.html>


More information about the mlpack-git mailing list