Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6786603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:15:55+00:00 2026-05-26T17:15:55+00:00

C++11 introduced a new syntax for function declaration, auto func(T rhs, U lhs) ->

  • 0

C++11 introduced a new syntax for function declaration,

auto func(T rhs, U lhs) -> V

This was to solve some problems that appeared in the old C++ standard with function templates. Read this short Wikipedia article section for details about the problem:
> http://en.wikipedia.org/wiki/C%2B%2B11#Alternative_function_syntax

My question is, does D confront with the same problem? If so, how does it fix it (if at all)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:15:56+00:00Added an answer on May 26, 2026 at 5:15 pm

    In D, the compiler can deduce the return type for you. So there’s no need to have the -> V syntax.

    auto func(T, U)(T lhs, U rhs) { return lhs + rhs; }
    

    or if you want to be more specific (but it’s better to let the compiler figure out the type with auto!)

    typeof(T.init + U.init) func(T, U)(T lhs, U rhs) { return lhs + rhs; }
    

    Like C++, you cannot use typeof(lhs + rhs) in that place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just read an article that supposedly introduced me to a new concept: Up
Matlab R2009b introduced a new operator - ~ - to symbolize an unused function
In the current C++0x draft I've noticed they introduced some new explicit keywords to
I just found out that jQuery 1.7 introduced a new method, on() . With
Django 1.2 introduced a new template loader, that stores data in cache ( django.template.loaders.cached.Loader
Microsoft introduced a new System.IO.MemoryMappedFiles namespace in .Net 4. Does anyone know if it
Firefox 3 has introduced a new behavior in which line-height, when unset, differs from
C# 4.0 introduced a new type called 'dynamic'. It all sounds good, but what
JavaFX is a new technology introduced by Sun. I would like to know what
A few months ago I was introduced to the new DateTimeOffset type and was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.