iitii icon indicating copy to clipboard operation
iitii copied to clipboard

example.cc doesn't compile

Open kcleal opened this issue 2 months ago • 0 comments

Hi @mlin, I would like to try your code, but I couldn't get the example code to compile (clang14, Mac). I get lots of errors (see below). I tried fixing a few of the template definitions, but to no avail. Do you know how I can get it working? Thanks:

 iitii % g++ -std=c++11 -o example example.cc
In file included from example.cc:4:
./iitii.h:327:130: error: template template argument has different template parameters than its corresponding template template parameter
template<typename Pos, typename Item, Pos get_beg(const Item&), Pos get_end(const Item&), template<class> class NodeArray = std::vector>
                                                                                                                                 ^
./iitii.h:336:69: note: while checking a default template argument used here
    using builder = iit_builder_base<iit<Pos, Item, get_beg, get_end>, Item, Node, NodeArray>;
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:339:1: note: too many template parameters in template template argument
template <class _Tp, class _Allocator /* = allocator<_Tp> */>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./iitii.h:327:91: note: previous template template parameter is here
template<typename Pos, typename Item, Pos get_beg(const Item&), Pos get_end(const Item&), template<class> class NodeArray = std::vector>
                                                                                          ^~~~~~~~~~~~~~~
./iitii.h:337:12: error: C++ requires a type specifier for all declarations
    friend builder;    
    ~~~~~~ ^
./iitii.h:337:12: error: friends can only be classes or functions
./iitii.h:403:130: error: template template argument has different template parameters than its corresponding template template parameter
template<typename Pos, typename Item, Pos get_beg(const Item&), Pos get_end(const Item&), template<class> class NodeArray = std::vector>
                                                                                                                                 ^
./iitii.h:607:71: note: while checking a default template argument used here
    using builder = iit_builder_base<iitii<Pos, Item, get_beg, get_end>, Item, Node, NodeArray>;
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:339:1: note: too many template parameters in template template argument
template <class _Tp, class _Allocator /* = allocator<_Tp> */>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./iitii.h:403:91: note: previous template template parameter is here
template<typename Pos, typename Item, Pos get_beg(const Item&), Pos get_end(const Item&), template<class> class NodeArray = std::vector>
                                                                                          ^~~~~~~~~~~~~~~
./iitii.h:608:12: error: C++ requires a type specifier for all declarations
    friend builder;
    ~~~~~~ ^
./iitii.h:608:12: error: friends can only be classes or functions
./iitii.h:403:130: error: template template argument has different template parameters than its corresponding template template parameter
template<typename Pos, typename Item, Pos get_beg(const Item&), Pos get_end(const Item&), template<class> class NodeArray = std::vector>
                                                                                                                                 ^
./iitii.h:634:65: note: while checking a default template argument used here
        auto self = const_cast<iitii<Pos, Item, get_beg, get_end>*>(this);  // getting around const
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:339:1: note: too many template parameters in template template argument
template <class _Tp, class _Allocator /* = allocator<_Tp> */>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./iitii.h:403:91: note: previous template template parameter is here
template<typename Pos, typename Item, Pos get_beg(const Item&), Pos get_end(const Item&), template<class> class NodeArray = std::vector>
                                                                                          ^~~~~~~~~~~~~~~
./iitii.h:403:130: error: template template argument has different template parameters than its corresponding template template parameter
template<typename Pos, typename Item, Pos get_beg(const Item&), Pos get_end(const Item&), template<class> class NodeArray = std::vector>
                                                                                                                                 ^
example.cc:9:57: note: while checking a default template argument used here
using p_iitii = iitii<int, intpair, p_get_beg, p_get_end>;  // first arg is position type
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:339:1: note: too many template parameters in template template argument
template <class _Tp, class _Allocator /* = allocator<_Tp> */>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./iitii.h:403:91: note: previous template template parameter is here
template<typename Pos, typename Item, Pos get_beg(const Item&), Pos get_end(const Item&), template<class> class NodeArray = std::vector>
                                                                                          ^~~~~~~~~~~~~~~
example.cc:12:5: error: use of undeclared identifier 'p_iitii'
    p_iitii::builder br;
    ^
example.cc:16:5: error: use of undeclared identifier 'p_iitii'; did you mean 'iitii'?
    p_iitii db = br.build(1);  // 1 = # domains
    ^~~~~~~
    iitii
./iitii.h:404:7: note: 'iitii' declared here
class iitii : public iit_base<Pos, Item, iitii_node<Pos, Item, get_beg, get_end>, NodeArray> {
      ^
example.cc:16:5: error: unknown type name 'p_iitii'
    p_iitii db = br.build(1);  // 1 = # domains
    ^
11 errors generated.

kcleal avatar Apr 14 '24 14:04 kcleal