Friend function in-class definition only allowed in non-local class definitions. What does it mean?

Emerald Weapon

Here (see point 2 description) I read that a friend function in-class definition is only allowed in non-local class definition.

What does that mean?

milleniumbug

Non-local class is a class that's not local.

A local class is a class defined in a function - see paragraph "Local classes" on this page

"Friend function in-class definition" refers to ability to declare and define a non-member function inside a class, which is a friend of the class it's enclosed in.

class a_class
{
    friend std::ostream& operator<<(std::ostream& os, const a_class& x)
    {
        // ...
    }
};

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Friend function in-class definition only allowed in non-local class definitions. What does it mean?

From Dev

friend not allowed outside of a class definition

From Dev

What does `template <class> friend class Foo` mean?

From Dev

What does `template <class> friend class Foo` mean?

From Dev

Friend function inside class and outside class, what difference does it make?

From Dev

what does this extra private[class]() in scala class definition mean?

From Dev

Friend template function in-class definition

From Dev

What does (new Class())->Function(); mean?

From Java

What does the "has" keyword mean before "method" in a Raku class definition?

From Java

What does -> mean in Python function definitions?

From Dev

What does "class ClassName;" mean when put in header file of other class definition?

From Dev

What are macros in class definitions and function signatures for?

From Dev

What does this weird function definition mean?

From Dev

What does $;$ mean in a Perl function definition?

From Dev

What does :: mean in class signature?

From Dev

What does this class declaration mean?

From Dev

What does it mean to destroy a class

From Dev

What does it mean by Lock on class?

From Dev

What does this class declaration mean?

From Dev

What does "unload class" mean?

From Dev

What does "Class<?" mean in Java?

From Dev

What does :: mean in class signature?

From Dev

What does Class.this mean?

From Dev

A friend function of a class that can only be used by a specific class

From Dev

What does it mean for a class to be composed of another class?

From Java

std::function as a friend of the class

From Dev

Friend function is not visible in the class

From Dev

Multiple definitions of friend operator in templated class

From Dev

How to define a friend function operator>> inside a local class?

Related Related

  1. 1

    Friend function in-class definition only allowed in non-local class definitions. What does it mean?

  2. 2

    friend not allowed outside of a class definition

  3. 3

    What does `template <class> friend class Foo` mean?

  4. 4

    What does `template <class> friend class Foo` mean?

  5. 5

    Friend function inside class and outside class, what difference does it make?

  6. 6

    what does this extra private[class]() in scala class definition mean?

  7. 7

    Friend template function in-class definition

  8. 8

    What does (new Class())->Function(); mean?

  9. 9

    What does the "has" keyword mean before "method" in a Raku class definition?

  10. 10

    What does -> mean in Python function definitions?

  11. 11

    What does "class ClassName;" mean when put in header file of other class definition?

  12. 12

    What are macros in class definitions and function signatures for?

  13. 13

    What does this weird function definition mean?

  14. 14

    What does $;$ mean in a Perl function definition?

  15. 15

    What does :: mean in class signature?

  16. 16

    What does this class declaration mean?

  17. 17

    What does it mean to destroy a class

  18. 18

    What does it mean by Lock on class?

  19. 19

    What does this class declaration mean?

  20. 20

    What does "unload class" mean?

  21. 21

    What does "Class<?" mean in Java?

  22. 22

    What does :: mean in class signature?

  23. 23

    What does Class.this mean?

  24. 24

    A friend function of a class that can only be used by a specific class

  25. 25

    What does it mean for a class to be composed of another class?

  26. 26

    std::function as a friend of the class

  27. 27

    Friend function is not visible in the class

  28. 28

    Multiple definitions of friend operator in templated class

  29. 29

    How to define a friend function operator>> inside a local class?

HotTag

Archive