Skip to content

模板参数可为浮点类型 #60

Description

@Haceau-Zoac
#include <iostream>

template <float a>
float qwq()
{
	return a;
}

template <double foo>
double awa()
{
	return foo;
}

int main(int argc, char* argv[])
{
	std::cout << qwq<3.14F>() << '\n'
		<< awa<6.28>() << '\n';
	
	return 0;
}

以上代码编译通过。
IDE:Microsoft Visual Studio Community 2019 16.9.0 Preview 2.0
编译器:msvc(启用 预览 - 最新 C++ 工作草案中的功能 (/std:c++latest)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions