Title
Problems with restrictions on taking the address of a member of a concept map
Status
concepts
Section
7.6.2.2 [expr.unary.op]
Submitter
UK

Created on 2009-03-03.00:00:00 last changed 187 months ago

Messages

Date: 2009-06-19.00:00:00

Additional note, June, 2009:

Here is an example illustrating the question:

    auto concept Fooable<T> {
       void foo(T);
    }

    struct test_type {
       void foo() {
          cout << "foo test_type\n";
       }
    };

    concept_map Fooable<test_type> {
       void foo(test_type& t) {
          t.foo();
       }
    }

    void foo(int x) {
       cout "foo int\n";
    }

    template<typename T>
       requires Fooable<T>
    function<void(T)> callback(T t) {
       void(*fn)(T) = foo;
       return fn;
    }

    int main() {
       auto fn1 = factory(test_type{});
       auto fn2 = factory(0);
       fn1(test_type{});
       fn2(0);
       return 0;
    }
Date: 2009-03-03.00:00:00
N2800 comment UKĀ 69

If we cannot bind references/take address of functions in concept_maps, does that mean we cannot use generic bind in constrained templates? Launch threads with expressions found via concept map lookup? Hit problems creating std::function objects? Does the problem only occur if we use qualified lookup to explicitly name a concept map? Does it only kick in if we rely on the implicit function implementation provided by a concept_map, so some types will work and others won't for the same algorithm?!

History
Date User Action Args
2009-08-03 00:00:00adminsetstatus: open -> concepts
2009-06-19 00:00:00adminsetmessages: + msg2064
2009-03-03 00:00:00admincreate