Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    addsomebass
    @addsomebass
    interesting take on function pointers:
    I got booted from meeting, and the event has ended in meetup. Can I get the invite link again?
    addsomebass
    @addsomebass
    meeting link for posterity:
    Grant Rostig
    @grantrostig
    zoom link ^^
    Grant Rostig
    @grantrostig
    Gitter
    ^^ is a funny link for our new AI-Machine_Learning gitter "room": https://gitter.im/CppMSG/AI-Machine_Learning
    Grant Rostig
    @grantrostig
    @/all We have two new "rooms" one above and one for "testing" here: https://gitter.im/CppMSG/Testing_and_Frameworks
    Grant Rostig
    @grantrostig
    I don't know enough about the subtleties of testing/mocking/"avoiding mocking"and frameworks, to have an option, but it would be nice if CppMSG could designate a "recommended" testing method/framework that we support (with priority) during meetups, as we do Qt Creator and our books, for example. But I would appreciate serious discussion of the matter from informed people, especially those familiar with more than one good framework, at this gitter location here: https://gitter.im/CppMSG/Testing_and_Frameworks
    addsomebass
    @addsomebass
    running late, will be in by 8:15 Eastern
    addsomebass
    @addsomebass
    have to run, thanks for the meeting (this is Joe)
    AlanU
    @AlanU
    this might help
    Hrishikesh
    @hspd
    #include <iostream>
    #include <string>
    #include <typeinfo>
    
    class Product {
    public:
        int hash() {
    
        }
    };
    
    template<typename K, typename V>
    class X {
    public:
    
        void typeof_k() {
            std::cout << "Type of K ?" << typeid(K).name() <<std::endl;
            std::cout << std::boolalpha << "Is it class type : " << std::is_class<K>::value << std::endl;
        }
    
        void typeof_v() {
            std::cout << "Type of V ?" << typeid(V).name() << std::endl;
        }
    
    private:
        K key;
        V value;
    };
    
    int main()
    {
        X <int, std::string> obj1{};
        obj1.typeof_k();
        X <std::string, double> obj2{};
        obj2.typeof_k();
        X <Product, int> obj3{};
        obj3.typeof_k();
    }
    Grant Rostig
    @grantrostig
    https://en.cppreference.com/w/cpp/types/is_same was close but not what Rishi wanted. :)
    Hrishikesh
    @hspd
    // TemplateClass.cpp : This file contains the 'main' function. Program execution begins and ends there.
    //
    
    #include <iostream>
    #include <string>
    #include <typeinfo>
    #include <cstddef>
    #include <concepts>
    using namespace std::literals;
    
    
    template <typename T>
    concept Hashable = requires(T a) {
        { a.hash() };
    };
    
    template <typename K>
    struct hash_traits;
    
    class Product {
    
    public:
        size_t hashkey()const {
            return 100;
        }
    };
    
    //template<> 
    //struct hash_traits<Product>
    //    {
    //       struct hash {
    //            std::size_t operator() (Product k) {
    //                return 44;
    //            }
    //        };
    //    };
    
    template<typename K>
    requires requires (K k) { k.hashkey(); }
    struct hash_traits<K>
    {
        struct hash {
            std::size_t operator() (K k) {
                return k.hashkey();
            }
        };
    };
    
    
    class Square {
    public:
    
    };
    
    
    //
    //template <>
    //struct hash_traits<int> {
    //    struct hash {
    //        std::size_t operator() (int i) {
    //            return static_cast<size_t>(i+2);
    //        }
    //    };
    //};
    
    
    template<typename K> requires std::integral<K>
    struct hash_traits<K> 
    {
    
        struct hash {
            std::size_t operator() (K k) {
                return static_cast<size_t>(k%10);
            }
        };
    };
    
    
    
    template<typename K> requires std::floating_point<K>
        struct hash_traits<K>
        {
          struct hash {
                std::size_t operator() (K k) {
                    return static_cast<size_t>(k +10);
                }
            };
        };
    
    
    
    template<typename K, typename V>
    class X {
    public:
    
        void typeof_k() {
            std::cout << "Type of K ?" << typeid(K).name() <<std::endl;
            std::cout << std::boolalpha << "Is it class type : " << std::is_class<K>::value << std::endl;
        }
    
        void insert(K identifier, V value) {
            std::size_t hash_key = 
                typename
                hash_traits<K>::hash{}(identifier);
            std::cout << hash_key;
        }
    
        void typeof_v() {
            std::cout << "Type of V ?" << typeid(V).name() << std::endl;
        }
    
    
    private:
        K identifier;
        V value;
    };
    
    union sample{
       Product i;
        Square d;
    };
    
    int main()
    {
    
    
        X <int, std::string> obj1{};
        obj1.insert(23,"Hello");
        std::cout << std::endl;
    
        X <float, std::string> obj2{};
        obj2.insert(30.5, "Hello");
        std::cout << std::endl;
    
        X <Product, std::string> obj3{};
        obj3.insert(Product{}, "Hello");
        std::cout << std::endl;
        /*
        X <std::string, double> obj2{};
        obj2.typeof_k();
    
        X <Product, int> obj3{};
        obj3.typeof_k();
    
        X <sample, int> obj4{};
        obj4.typeof_k();*/
    
    }
    1 reply
    Grant Rostig
    @grantrostig
    NEW room: are you ready to compete? https://gitter.im/CppMSG/Programming_Contests
    Vijayendar
    @Vijayendar
    Oh god I would love to join the coding review
    but I am on my way to get my 2nd vaccination dose 😊
    It has been a long time since I came here. A lot has changed.
    Grant Rostig
    @grantrostig
    It ended already. We started 2 hours ago. Join the meetup to be notified. @Vijayendar Have we met in person in Austin?
    Vijayendar
    @Vijayendar
    Oh ok. Nope, never been to Austin before. I am in Canberra, Australia. A long way from Austin
    Grant Rostig
    @grantrostig
    Maybe I remember you...
    Welcome back.
    Vijayendar
    @Vijayendar
    Yes, I haven’t joined since last year, because I was I had meetings during that time on Thursday afternoon.
    but I do get regular notifications via mail.
    Thanks a lot.
    Vijayendar
    @Vijayendar
    I would like to add C++ interview questions that I have faced so far. Can I post them in the Programming_Contests room?
    2 replies
    Grant Rostig
    @grantrostig
    VOTE IN POLL: Shall we designate "cppreference.com" as an official "reference" for CppMSG question asking priority status? Y or N. If N, please state why, in the "thread". :
    3 replies
    @/all please vote in above poll re: cppref.
    Grant Rostig
    @grantrostig
    @/all 2nd VOTE in poll: Shall we modify the "no questioner twice in a row" rule to state that "recommended" resources questions override that restriction? It would focus us more on recommended resources where we are supposed to have greater familiarity and knowledge. Of course certain person's questions (Grant's mostly) questions would likely be more prevalent.
    1 reply
    @/all 3nd VOTE in poll: Shall we modify the "no questioner twice in a row" rule to state that "questions asked in the questions for meetings room" questions override that restriction? It would focus us more on questions asked in advance and or properly prepared questions where we can consider the question in advance, and not be taken off-guard. Of course certain person's questions (Grant's mostly) would likely be more prevalent.
    1 reply
    Grant Rostig
    @grantrostig
    4th VOTE: make this a recommended reference: ISO C++ faq: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
    5 replies
    Grant Rostig
    @grantrostig
    Working Draft?? what is this and how up to date is it? As of when? Is there another place to find a dated versioned publication of this same material? Is this the famous ISO spec, but free of charge? https://eel.is/c++draft/
    1 reply
    Vijayendar Sridharan
    @Veejay_83_twitter
    Grant Rostig
    @grantrostig
    when should you give things the same name talk by ODwyer.
    Vijayendar Sridharan
    @Veejay_83_twitter
    Grant Rostig
    @grantrostig
    hi
    Vijayendar Sridharan
    @Veejay_83_twitter
    "people"
    Grant Rostig
    @grantrostig
    We had a great meeting, with a new modern C++ "celebrity" joining us on Saturday (for the second time a while back) for or new feature "code reviews". More std::visit amazement.