Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-29-2007, 04:20 PM   #1
Registered: Feb 2004
Location: Athens, Greece
Distribution: Gentoo,FreeBSD, Debian
Posts: 705

Rep: Reputation: 30
unknown C++ function declaration syntax

this is the first time i see a function declaration like this - i code Java and i have just started learning C++.
template <>
struct hash<std::string> 
        size_t :)operator() (const std::string& x):) const 
                return hash<const char*>()(x.c_str());
    // hash<const char*> already exists
What does the part inside the smilies mean? It looks like a function with no parameters, but the other thing inside the parenthesis? Is this standard ISO?


Last edited by kpachopoulos; 08-29-2007 at 04:22 PM. Reason: mark questionable code clearer
Old 08-29-2007, 04:43 PM   #2
Senior Member
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
This is valid C++. It allows you to call an object like a function:
#include <iostream>

struct functor
    inline void operator() (const char *sString)
    { std::cout << sString << "\n"; }

int main()
    functor myfunctor;
    myfunctor("this is a string");


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Function Declaration in C frankie_DJ Programming 5 10-11-2006 01:44 PM
C: Function declaration woes websinger Programming 4 08-08-2006 03:56 PM
Arguments in PHP function declaration Parksy Programming 5 07-04-2004 05:22 PM
Problem with function declaration Linh Programming 3 04-26-2004 05:58 PM
declaration syntax errors with KYLIX rklosinski Programming 1 11-28-2002 02:49 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration