CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Apr 2007
    Location
    Mars NASA Station
    Posts
    1,436

    Template Template Parameter and Template Traits

    Hello to all, i have create a generic data manager which uses several data type format and different database but encountered an error to get the trait during object instantiation.

    Code:
    template <typename T, template <typename U> class backEndFactoryType = ClsBackEndTypeTraits >
    class ClsSqlDataManager
    {
    public:
        ClsSqlDataManager();
        ~ClsSqlDataManager();
    
        int ReadData(const int&, const std::string&, soci::row&);
        int WriteData(const int&, const std::string&, soci::row&);
    
    //typedef backEndFactoryType<U>::backEndType backEndType;
    
    };
    
    template <class T>
    class ClsBackEndTypeTraits
    {
    public:
        typedef T backEndType;
    };
    //----------------------------------------------------------------
    // Sqlite3 Back End Type Template Specialization
    template <>
    class ClsBackEndTypeTraits <soci::sqlite3_backend_factory>
    {
    public:
        typedef soci::sqlite3_backend_factory backEndType;
    };
    
    Main.cpp
    ClsSqlDataManager<Json::Value, ClsBackEndTypeTraits  > db;
    It cannot get the type traits defined.

    Please help.

    Thanks.
    Last edited by Peter_APIIT; October 20th, 2010 at 05:38 AM.
    Thanks for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured