Typelist -> hirarchie



  • Typlisten wie von dir gezeigt sind sowas von out. Gehe mit der Zeit und nimm C++11.

    oh mein gott, gut das ich das gefragt habe 😃 jetzt schreibe ich seit 2 tagen an algorithmen für typelisten und jetzt sagst du mir, dass es in c++11 dafür variadische templates gibt...
    hab das gerade mal ausprobiert, aber anscheinend kapiert das mein "visual studio 2012 express desktop" nicht. Ich lade mal die updates runter und melde mich nochmal 😉



  • gibt immernoch einen fehler, wie gesagt ich hab es mit "visual studio 2012 express for desktop" ausgetestet, und da dass einer der neusten compiler ist , sollte es doch eigentlich funktionieren, aber naja... klappt nicht 😕

    error C2143: syntax error : missing ',' before '...'
    
    template<typename... Args> struct SomeStruct {
    };
    


  • ...



  • #include <iostream>
    using namespace std;
    
    //#include <delta\include.h>
    //using namespace delta;
    
    template <typename... T> struct typelist; 
    template <typename> class MyClass {}; 
    template <typename... T> class MyClass<typelist<T...> > : T... {}; 
    
    struct a{a(){std::cout << "construct a\n";}}; 
    struct b{b(){std::cout << "construct b\n";}}; 
    struct c{c(){std::cout << "construct c\n";}}; 
    
    int main() { 
      typedef typelist<a,b,c> type_list;
      MyClass<type_list> mc; 
    
      getchar();
    }
    

    fehler:

    1>------ Build started: Project: AppConsole, Configuration: Debug x64 ------
    1> main.cpp
    1>main.cpp(7): error C2143: syntax error : missing ',' before '...'
    1>main.cpp(9): error C2143: syntax error : missing ',' before '...'
    1>main.cpp(9): error C2065: 'T' : undeclared identifier
    1>main.cpp(9): error C2143: syntax error : missing ';' before '{'
    1>main.cpp(11): error C2143: syntax error : missing ';' before '{'
    1>main.cpp(12): error C2143: syntax error : missing ';' before '{'
    1>main.cpp(13): error C2143: syntax error : missing ';' before '{'
    1>main.cpp(15): error C2143: syntax error : missing ';' before '{'
    1>main.cpp(16): error C2065: 'a' : undeclared identifier
    1>main.cpp(16): error C2065: 'b' : undeclared identifier
    1>main.cpp(16): error C2065: 'c' : undeclared identifier
    1>main.cpp(16): error C2977: 'typelist' : too many template arguments
    1> main.cpp(7) : see declaration of 'typelist'
    1>main.cpp(17): error C2065: 'type_list' : undeclared identifier
    1>main.cpp(17): error C2923: 'MyClass' : 'type_list' is not a valid template type argument for parameter '<unnamed-symbol>'
    1>main.cpp(20): error C2143: syntax error : missing ';' before '}'
    1>main.cpp(21): error C2143: syntax error : missing ';' before '}'
    1>main.cpp(21): fatal error C1004: unexpected end-of-file found
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


  • Mod

    Anleitung beachtet?



  • update gedownloaded
    update installiert
    pc neugestartet
    neues projekt erstellt (win32 console application)
    debug win32
    code kopiert
    code kompeliert
    FEHLER


  • Mod

    Instructions

    After downloading and installing the program, you can launch Visual Studio 2012, load your C++ project and you can switch to the new compilers. We recommend you create a separate project configuration from menu Build > Configuration Manager by duplicating your existing configuration and then follow the steps below: 1.Open Project Property Pages (Alt+F7 under the Visual C++ mappings or right-click on the project in Solution Explorer) 2.From the ‘General’ tab, change ‘Platform toolset’ from ‘Visual Studio 2012 (v110)’ to ‘Microsoft Visual C++ Compiler Nov 2012 CTP (v120_CTP_Nov)’ and close the Property Pages 3.Launch a full rebuild of your project



  • 🤡 sorry, nicht richtig gelesen, klappt....

    eine frage aber noch nebenbei, lohnt nicht dafür ein thema aufzumachen 😉

    class c{
      int i;
      int getInt() const{
         return i;
      }
    };
    

    ist der zugriff auf i threadsafe? oder kann es zu fehlern kommen, wenn gleichzeitig ein anderer thread die variable ändert?



  • In solchen Situationen kann es immer zu Fehlern kommen. Thread Synchronisation ist hier definitiv erforderlich.



  • In solchen Situationen kann es immer zu Fehlern kommen. Thread Synchronisation ist hier definitiv erforderlich.

    okay, habs geändert 😉


Anmelden zum Antworten