名前空間
変種
操作

std::experimental::reflect::get_source_line

From cppreference.com
 
 
 
リフレクション拡張
コンセプト
メタオブジェクト操作
Variable
FunctionParameter
Callable
VariableCallable
NamespaceCallable
ParenthesizedExpression
FunctionCallExpression
FunctionalConversion
VariableFunction
 
ヘッダ <experimental/reflect> で定義
template< Object T >
struct get_source_line;
(reflection TS)

T によってリフレクションされるエンティティまたは typedef 名の宣言の推定行番号に等しいメンバ定数valueを提供します。

目次

[編集] ヘルパー変数テンプレート

template< class T >
constexpr auto get_source_line_v = get_source_line<T>::value;
(reflection TS)

std::integral_constant から継承

メンバ定数

value
[static]
T によってリフレクションされるエンティティまたは typedef 名の宣言の推定行番号
(公開静的メンバ定数)

メンバ関数

operator std::uint_least32_t
オブジェクトをstd::uint_least32_tに変換します。valueを返します。
(public member function)
operator()
(C++14)
value を返します。
(public member function)

メンバ型

定義
value_type std::uint_least32_t
type std::integral_constant<std::uint_least32_t, value>

[編集]

以下のコードは、オブジェクトまたはクラスのソースコード行を示します。

#include<experimental/reflect>
#include<iostream>
 
using refl = std::experimental::reflect;
 
float f;
struct P{};
 
int main()
{
    std::cout << refl::get_source_line_v<reflexpr(f)> << '\n';
    std::cout << refl::get_source_line_v<reflexpr(P)> << '\n';
}

出力

6
7

[編集] 関連項目

このオブジェクトが表す行番号を返す
(std::source_location の public メンバ関数) [編集]
stacktrace_entryによって表される評価に字義通り関連する行番号を取得します。
(std::stacktrace_entry の public メンバ関数) [編集]
English 日本語 中文(简体) 中文(繁體)